Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
gustavosbarreto committed Mar 14, 2024
0 parents commit b3e22ce
Show file tree
Hide file tree
Showing 43 changed files with 5,181 additions and 0 deletions.
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
out
.gitignore
17 changes: 17 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/* eslint-env node */
require('@rushstack/eslint-patch/modern-module-resolution')

module.exports = {
extends: [
'eslint:recommended',
'plugin:vue/vue3-recommended',
'@electron-toolkit',
'@electron-toolkit/eslint-config-ts/eslint-recommended',
'@vue/eslint-config-typescript/recommended',
'@vue/eslint-config-prettier'
],
rules: {
'vue/require-default-prop': 'off',
'vue/multi-word-component-names': 'off'
}
}
90 changes: 90 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Build
on:
push:
branches: [ master ]
tags:
- v*
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
platform: [linux, windows, macos]
include:
- platform: linux
os: ubuntu-latest
target: AppImage
extension: AppImage
- platform: windows
os: ubuntu-latest
target: nsis
extension: exe
- platform: macos
os: macos-latest
target: dmg
extension: dmg
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v2
with:
node-version: '18'
- name: Install wine
if: ${{ matrix.platform == 'windows' }}
run: |
sudo dpkg --add-architecture i386
wget -nc https://dl.winehq.org/wine-builds/winehq.key
sudo apt-key add winehq.key
sudo add-apt-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ focal main'
sudo apt-get update
sudo apt install -y winehq-stable
- name: Build
env:
PLATFORM: ${{ matrix.platform }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ matrix.platform }}" == "macos" ]; then
export CSC_IDENTITY_AUTO_DISCOVERY=false
EXTRA_ARGS="-c.mac.identity=null"
fi
yarn install
yarn build
npx electron-builder --${{ matrix.platform }} ${{ matrix.target }} -p never $EXTRA_ARGS
- name: Upload artifact
if: "contains(github.ref, 'refs/tags/v')"
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.platform }}
path: dist/*.${{ matrix.extension }}
publish:
if: "contains(github.ref, 'refs/tags/v')"
needs: build
runs-on: ubuntu-latest
steps:
- name: Download windows artifact
uses: actions/download-artifact@v4
with:
name: windows
- name: Download linux artifact
uses: actions/download-artifact@v4
with:
name: linux
- name: Download macos artifact
uses: actions/download-artifact@v4
with:
name: macos
- name: Create release draft
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
files: |
*.exe
*.AppImage
*.dmg
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules
dist
out
*.log*
6 changes: 6 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
out
dist
pnpm-lock.yaml
LICENSE.md
tsconfig.json
tsconfig.*.json
4 changes: 4 additions & 0 deletions .prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
singleQuote: true
semi: false
printWidth: 100
trailingComma: none
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div align="center>
<a href="https://shellhub.io"><img src="http://docs.shellhub.io/img/logo.png" alt="ShellHub"></a>

<hr/>

<h1 align="center">ShellHub Connect</h1>

<p align="center">Download ShellHub Connect for your platform:</p>

<p align="center">
<a href="https://redir-url.fly.dev/?url=https://api.github.com/repos/shellhub-io/desktop/releases/latest&query=$.assets[0].browser_download_url)">
<img src="https://img.shields.io/badge/Windows-rgb(102,122,204)?style=flat-rounded&logo=windows&logoColor=white" height="28px"/>
</a>
<a href="https://redir-url.fly.dev/?url=https://api.github.com/repos/shellhub-io/desktop/releases/latest&query=$.assets[1].browser_download_url)">
<img src='https://img.shields.io/badge/Linux-rgb(102,122,204)?style=flat-rounded&logo=linux&logoColor=white' height="28px"/>
</a>
<a href="https://redir-url.fly.dev/?url=https://api.github.com/repos/shellhub-io/desktop/releases/latest&query=$.assets[2].browser_download_url)">
<img src='https://img.shields.io/badge/MacOS_X-rgb(102,122,204)?style=flat-rounded&logo=apple&logoColor=white' height="28px"/>
</a>
</p>
</div>

##

ShellHub Connect is an application designed to simplify and enhance the experience of connecting and managing
remote devices via ShellHub. With an intuitive and user-friendly interface, ShellHub Connect allows users to
easily access their devices in **ShellHub Cloud** and on custom instances of ShellHub, whether it's
the **Enterprise Edition** or **Community Edition**, managed or self-hosted.

<p align="center">
<img src="https://github.com/shellhub-io/desktop/assets/86747/2a92b9e4-8c39-4c7f-9bfd-b85049f4eca4" border=1/>
</p>
12 changes: 12 additions & 0 deletions build/entitlements.mac.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.cs.allow-jit</key>
<true/>
<key>com.apple.security.cs.allow-unsigned-executable-memory</key>
<true/>
<key>com.apple.security.cs.allow-dyld-environment-variables</key>
<true/>
</dict>
</plist>
Binary file added build/icon.icns
Binary file not shown.
Binary file added build/icon.ico
Binary file not shown.
Binary file added build/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions dev-app-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
provider: generic
url: https://example.com/auto-updates
updaterCacheDirName: shellhub-updater
43 changes: 43 additions & 0 deletions electron-builder.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
appId: com.electron.app
productName: shellhub
directories:
buildResources: build
files:
- '!**/.vscode/*'
- '!src/*'
- '!electron.vite.config.{js,ts,mjs,cjs}'
- '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}'
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
- '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}'
asarUnpack:
- resources/**
win:
executableName: shellhub
nsis:
artifactName: ${name}-${version}-setup.${ext}
shortcutName: ${productName}
uninstallDisplayName: ${productName}
createDesktopShortcut: always
mac:
entitlementsInherit: build/entitlements.mac.plist
extendInfo:
- NSCameraUsageDescription: Application requests access to the device's camera.
- NSMicrophoneUsageDescription: Application requests access to the device's microphone.
- NSDocumentsFolderUsageDescription: Application requests access to the user's Documents folder.
- NSDownloadsFolderUsageDescription: Application requests access to the user's Downloads folder.
notarize: false
dmg:
artifactName: ${name}-${version}.${ext}
linux:
target:
- AppImage
- snap
- deb
maintainer: electronjs.org
category: Utility
appImage:
artifactName: ${name}-${version}.${ext}
npmRebuild: false
publish:
provider: generic
url: https://example.com/auto-updates
28 changes: 28 additions & 0 deletions electron.vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { resolve } from 'path'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import vue from '@vitejs/plugin-vue'
import vuetify, { transformAssetUrls } from 'vite-plugin-vuetify'

export default defineConfig({
main: {
plugins: [externalizeDepsPlugin()]
},
preload: {
plugins: [externalizeDepsPlugin()]
},
renderer: {
resolve: {
alias: {
'@renderer': resolve('src/renderer/src')
}
},
plugins: [
vue({
template: { transformAssetUrls }
}),
vuetify({
autoImport: true
})
]
}
})
58 changes: 58 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
{
"name": "shellhub-connect",
"version": "1.0.0",
"description": "An application designed to simplify and enhance the experience of connecting and managing remote devices via ShellHub",
"main": "./out/main/index.js",
"author": "ShellHub <[email protected]>(https://shellhub.io)",
"homepage": "https://github.com/shellhub-io/desktop",
"scripts": {
"format": "prettier --write .",
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts,.vue --fix",
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false",
"typecheck:web": "vue-tsc --noEmit -p tsconfig.web.json --composite false",
"typecheck": "npm run typecheck:node && npm run typecheck:web",
"start": "electron-vite preview",
"dev": "electron-vite dev",
"build": "npm run typecheck && electron-vite build",
"postinstall": "electron-builder install-app-deps",
"build:win": "npm run build && electron-builder --win --config",
"build:mac": "npm run build && electron-builder --mac --config",
"build:linux": "npm run build && electron-builder --linux --config"
},
"dependencies": {
"@electron-toolkit/preload": "^2.0.0",
"@electron-toolkit/utils": "^2.0.0",
"@fortawesome/fontawesome-free": "^6.5.1",
"@mdi/font": "^7.3.67",
"@vueuse/core": "^10.7.0",
"axios": "^1.6.2",
"electron-updater": "^6.1.1",
"pinia": "^2.1.7",
"sass": "^1.69.5",
"vue-router": "^4.2.5",
"vuetify": "^3.4.6",
"webfontloader": "^1.6.28"
},
"devDependencies": {
"@electron-toolkit/eslint-config": "^1.0.1",
"@electron-toolkit/eslint-config-ts": "^1.0.0",
"@electron-toolkit/tsconfig": "^1.0.1",
"@rushstack/eslint-patch": "^1.3.3",
"@types/node": "^18.17.5",
"@vitejs/plugin-vue": "^4.3.1",
"@vue/eslint-config-prettier": "^8.0.0",
"@vue/eslint-config-typescript": "^11.0.3",
"electron": "^25.6.0",
"electron-builder": "^24.6.3",
"electron-vite": "^1.0.27",
"eslint": "^8.47.0",
"eslint-plugin-vue": "^9.17.0",
"less": "^4.2.0",
"prettier": "^3.0.2",
"typescript": "^5.1.6",
"vite": "^4.4.9",
"vite-plugin-vuetify": "^2.0.1",
"vue": "^3.3.4",
"vue-tsc": "^1.8.8"
}
}
Binary file added resources/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
74 changes: 74 additions & 0 deletions src/main/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import { app, shell, BrowserWindow } from 'electron'
import { join } from 'path'
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
import icon from '../../resources/icon.png?asset'

function createWindow(): void {
// Create the browser window.
const mainWindow = new BrowserWindow({
width: 900,
height: 670,
show: false,
autoHideMenuBar: true,
...(process.platform === 'linux' ? { icon } : {}),
webPreferences: {
webviewTag: true,
webSecurity: false,
partition: 'persist:shellhub',
preload: join(__dirname, '../preload/index.js'),
sandbox: false
}
})

mainWindow.on('ready-to-show', () => {
mainWindow.show()
})

mainWindow.webContents.setWindowOpenHandler((details) => {
shell.openExternal(details.url)
return { action: 'deny' }
})

// HMR for renderer base on electron-vite cli.
// Load the remote URL for development or the local html file for production.
if (is.dev && process.env['ELECTRON_RENDERER_URL']) {
mainWindow.loadURL(process.env['ELECTRON_RENDERER_URL'])
} else {
mainWindow.loadFile(join(__dirname, '../renderer/index.html'))
}
}

// This method will be called when Electron has finished
// initialization and is ready to create browser windows.
// Some APIs can only be used after this event occurs.
app.whenReady().then(() => {
// Set app user model id for windows
electronApp.setAppUserModelId('com.electron')

// Default open or close DevTools by F12 in development
// and ignore CommandOrControl + R in production.
// see https://github.com/alex8088/electron-toolkit/tree/master/packages/utils
app.on('browser-window-created', (_, window) => {
optimizer.watchWindowShortcuts(window)
})

createWindow()

app.on('activate', function () {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
if (BrowserWindow.getAllWindows().length === 0) createWindow()
})
})

// Quit when all windows are closed, except on macOS. There, it's common
// for applications and their menu bar to stay active until the user quits
// explicitly with Cmd + Q.
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit()
}
})

// In this file you can include the rest of your app"s specific main process
// code. You can also put them in separate files and require them here.
8 changes: 8 additions & 0 deletions src/preload/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { ElectronAPI } from '@electron-toolkit/preload'

declare global {
interface Window {
electron: ElectronAPI
api: unknown
}
}
Loading

0 comments on commit b3e22ce

Please sign in to comment.