worldwideweb 0.0.16 → 0.0.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/main.cjs +20 -6
  2. package/package.json +6 -2
  3. package/run.js +12 -0
package/main.cjs CHANGED
@@ -1,8 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  const { app, BrowserWindow, Menu } = require('electron')
4
+ const path = require('path')
5
+ const url = require('url')
4
6
 
5
- function createWindow () {
7
+ function createWindow() {
6
8
  const mainWindow = new BrowserWindow({
7
9
  width: 1024,
8
10
  height: 768,
@@ -11,7 +13,19 @@ function createWindow () {
11
13
  }
12
14
  })
13
15
 
14
- mainWindow.loadURL('https://databrowser.io/') // Load a URL to start with
16
+ const start = 'https://solidos.solidcommunity.net/public/Roadmap/Tasks/'
17
+ // mainWindow.loadURL('https://solidos.github.io/mashlib/dist/browse.html')
18
+ // Load a URL to start with
19
+
20
+ const uri = url.format({
21
+ pathname: path.join('https://', 'index.html'),
22
+ protocol: 'file:',
23
+ slashes: true,
24
+ query: { uri: start }
25
+ })
26
+
27
+ console.log('loading', uri)
28
+ mainWindow.loadURL('https://solidos.github.io/mashlib/dist/browse.html?uri=' + start)
15
29
 
16
30
  const mainMenu = Menu.buildFromTemplate(menuTemplate)
17
31
  Menu.setApplicationMenu(mainMenu)
@@ -23,7 +37,7 @@ const menuTemplate = [
23
37
  submenu: [
24
38
  {
25
39
  label: 'Exit',
26
- click () {
40
+ click() {
27
41
  app.quit()
28
42
  }
29
43
  }
@@ -35,21 +49,21 @@ const menuTemplate = [
35
49
  {
36
50
  label: 'Back',
37
51
  accelerator: 'CmdOrCtrl+[',
38
- click (item, focusedWindow) {
52
+ click(item, focusedWindow) {
39
53
  if (focusedWindow) focusedWindow.webContents.goBack()
40
54
  }
41
55
  },
42
56
  {
43
57
  label: 'Forward',
44
58
  accelerator: 'CmdOrCtrl+]',
45
- click (item, focusedWindow) {
59
+ click(item, focusedWindow) {
46
60
  if (focusedWindow) focusedWindow.webContents.goForward()
47
61
  }
48
62
  },
49
63
  {
50
64
  label: 'Reload',
51
65
  accelerator: 'CmdOrCtrl+R',
52
- click (item, focusedWindow) {
66
+ click(item, focusedWindow) {
53
67
  if (focusedWindow) focusedWindow.reload()
54
68
  }
55
69
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worldwideweb",
3
- "version": "0.0.16",
3
+ "version": "0.0.18",
4
4
  "description": "WorldWideWeb browser in JavaScript",
5
5
  "main": "main.cjs",
6
6
  "scripts": {
@@ -9,7 +9,7 @@
9
9
  "start": "electron ."
10
10
  },
11
11
  "bin": {
12
- "worldwideweb": "./worldwideweb.sh"
12
+ "worldwideweb": "./run.js"
13
13
  },
14
14
  "repository": {
15
15
  "type": "git",
@@ -27,5 +27,9 @@
27
27
  "homepage": "https://github.com/melvincarvalho/worldwideweb#readme",
28
28
  "devDependencies": {
29
29
  "electron": "^24.2.0"
30
+ },
31
+ "dependencies": {
32
+ "path": "^0.12.7",
33
+ "url": "^0.11.0"
30
34
  }
31
35
  }
package/run.js ADDED
@@ -0,0 +1,12 @@
1
+ #!/usr/bin/env node
2
+
3
+ const { spawn } = require('child_process')
4
+ const path = require('path')
5
+ const electronPath = require('electron')
6
+
7
+ const appPath = path.join(__dirname, '.')
8
+
9
+ const child = spawn(electronPath, [appPath], { stdio: 'inherit' })
10
+ child.on('close', (code) => {
11
+ process.exit(code)
12
+ })