Start work on testing Hyperspace desktop app (note: BROKEN)
This commit is contained in:
parent
bd9e096bd8
commit
a58a172fe5
File diff suppressed because it is too large
Load Diff
46
package.json
46
package.json
|
@ -2,6 +2,7 @@
|
||||||
"name": "hyperspace",
|
"name": "hyperspace",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
|
"homepage": "./",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@date-io/moment": "^1.3.5",
|
"@date-io/moment": "^1.3.5",
|
||||||
"@material-ui/core": "^3.9.3",
|
"@material-ui/core": "^3.9.3",
|
||||||
|
@ -27,11 +28,17 @@
|
||||||
"react-scripts": "^2.1.8",
|
"react-scripts": "^2.1.8",
|
||||||
"react-swipeable-views": "^0.13.1",
|
"react-swipeable-views": "^0.13.1",
|
||||||
"react-web-share-api": "^0.0.2",
|
"react-web-share-api": "^0.0.2",
|
||||||
"typescript": "3.4.1"
|
"typescript": "3.4.1",
|
||||||
|
"electron": "^5.0.0",
|
||||||
|
"electron-builder": "^20.39.0",
|
||||||
|
"electron-updater": "^4.0.6"
|
||||||
},
|
},
|
||||||
|
"main": "public/desktop.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "HTTPS=true BROWSER='Safari Technology Preview' react-scripts start",
|
"start": "HTTPS=true BROWSER='Safari Technology Preview' react-scripts start",
|
||||||
|
"electrify": "npm run build; electron .",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
|
"build-desktop": "build -mwl deb AppImage snap",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test",
|
||||||
"eject": "react-scripts eject"
|
"eject": "react-scripts eject"
|
||||||
},
|
},
|
||||||
|
@ -43,5 +50,40 @@
|
||||||
"not dead",
|
"not dead",
|
||||||
"not ie <= 11",
|
"not ie <= 11",
|
||||||
"not op_mini all"
|
"not op_mini all"
|
||||||
]
|
],
|
||||||
|
"build": {
|
||||||
|
"appId": "net.marquiskurt.hyperspace",
|
||||||
|
"directories": {
|
||||||
|
"buildResources": "desktop"
|
||||||
|
},
|
||||||
|
"mac": {
|
||||||
|
"category": "public.app-category.social-networking",
|
||||||
|
"icon": "desktop/app.icns",
|
||||||
|
"target": [
|
||||||
|
"dmg",
|
||||||
|
"mas"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"mas": {
|
||||||
|
"entitlements": "desktop/entitlements.mas.plist",
|
||||||
|
"provisioningProfile": "desktop/embedded.provisionprofile"
|
||||||
|
},
|
||||||
|
"win": {
|
||||||
|
"target": [
|
||||||
|
"nsis"
|
||||||
|
],
|
||||||
|
"icon": "desktop/app.ico"
|
||||||
|
},
|
||||||
|
"linux": {
|
||||||
|
"target": [
|
||||||
|
"${@:1}"
|
||||||
|
],
|
||||||
|
"icon": "linux",
|
||||||
|
"category": "Network"
|
||||||
|
},
|
||||||
|
"snap": {
|
||||||
|
"confinement": "strict",
|
||||||
|
"summary": "A beautiful, fluffy client for the fediverse"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,157 @@
|
||||||
|
const electron = require('electron');
|
||||||
|
const app = electron.app;
|
||||||
|
const menu = electron.Menu;
|
||||||
|
const BrowserWindow = electron.BrowserWindow;
|
||||||
|
const {autoUpdater} = require('electron-updater');
|
||||||
|
|
||||||
|
const path = require('path');
|
||||||
|
autoUpdater.checkForUpdatesAndNotify();
|
||||||
|
|
||||||
|
let mainWindow;
|
||||||
|
|
||||||
|
function createWindow() {
|
||||||
|
mainWindow = new BrowserWindow(
|
||||||
|
{
|
||||||
|
width: 1000,
|
||||||
|
height: 600,
|
||||||
|
minWidth: 476,
|
||||||
|
titleBarStyle: 'hidden',
|
||||||
|
webPreferences: {nodeIntegration: true}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
mainWindow.loadURL(`file://${path.join(__dirname, '../build/index.html')}`);
|
||||||
|
|
||||||
|
mainWindow.on('closed', () => {
|
||||||
|
mainWindow = null
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function createMenubar() {
|
||||||
|
const menuBar = [
|
||||||
|
{
|
||||||
|
label: 'File',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'New Window',
|
||||||
|
accelerator: 'CmdOrCtrl+N',
|
||||||
|
click() {
|
||||||
|
if (mainWindow == null)
|
||||||
|
createWindow();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'Edit',
|
||||||
|
submenu: [
|
||||||
|
{ role: 'undo' },
|
||||||
|
{ role: 'redo' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ role: 'cut' },
|
||||||
|
{ role: 'copy' },
|
||||||
|
{ role: 'paste' },
|
||||||
|
{ role: 'pasteandmatchstyle' },
|
||||||
|
{ role: 'delete' },
|
||||||
|
{ role: 'selectall' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label: 'View',
|
||||||
|
submenu: [
|
||||||
|
{ role: 'reload' },
|
||||||
|
{ role: 'forcereload' },
|
||||||
|
{
|
||||||
|
label: 'Open Dev Tools',
|
||||||
|
click () {
|
||||||
|
try {
|
||||||
|
mainWindow.webContents.openDevTools({mode: 'undocked'});
|
||||||
|
} catch (err) {
|
||||||
|
console.error("Couldn't open dev tools: " + err);
|
||||||
|
}
|
||||||
|
|
||||||
|
},
|
||||||
|
accelerator: 'Shift+CmdOrCtrl+I'
|
||||||
|
},
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ role: 'togglefullscreen' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'window',
|
||||||
|
submenu: [
|
||||||
|
{ role: 'minimize' },
|
||||||
|
{ role: 'close' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
role: 'help',
|
||||||
|
submenu: [
|
||||||
|
{
|
||||||
|
label: 'Report a Bug',
|
||||||
|
click () { require('electron').shell.openExternal('https://github.com/hyperspacedev/hyperspace/issues') }
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
menuBar.unshift({
|
||||||
|
label: app.getName(),
|
||||||
|
submenu: [
|
||||||
|
{ role: 'about' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ role: 'services' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ role: 'hide' },
|
||||||
|
{ role: 'hideothers' },
|
||||||
|
{ role: 'unhide' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ role: 'quit' }
|
||||||
|
]
|
||||||
|
})
|
||||||
|
|
||||||
|
// Edit menu
|
||||||
|
menuBar[2].submenu.push(
|
||||||
|
{ type: 'separator' },
|
||||||
|
{
|
||||||
|
label: 'Speech',
|
||||||
|
submenu: [
|
||||||
|
{ role: 'startspeaking' },
|
||||||
|
{ role: 'stopspeaking' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
// Window menu
|
||||||
|
menuBar[4].submenu = [
|
||||||
|
{ role: 'close' },
|
||||||
|
{ role: 'minimize' },
|
||||||
|
{ role: 'zoom' },
|
||||||
|
{ type: 'separator' },
|
||||||
|
{ role: 'front' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
const thisMenu = menu.buildFromTemplate(menuBar);
|
||||||
|
menu.setApplicationMenu(thisMenu);
|
||||||
|
}
|
||||||
|
|
||||||
|
app.on('ready', () => {
|
||||||
|
createWindow();
|
||||||
|
createMenubar();
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on('window-all-closed', () => {
|
||||||
|
if (process.platform !== 'darwin') {
|
||||||
|
app.quit()
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
app.on('activate', () => {
|
||||||
|
if (mainWindow === null) {
|
||||||
|
createWindow()
|
||||||
|
createMenubar()
|
||||||
|
}
|
||||||
|
});
|
Loading…
Reference in New Issue