Commit 70ef62e92b6493d5a2b7193806b674157cabcab0
Merge branch 'mixmix-linux'
andre alves garzia committed on 7/1/2018, 10:07:27 PMParent: c3840081d9c3529672b66b5d47b2013475fc783c
Parent: ff415cfd94d87c90cfd7d775564a459508a86ea6
Files changed
.gitignore | changed |
host-app.js | changed |
package-lock.json | changed |
package.json | changed |
scripts/check-configuration.js | changed |
scripts/setup.js | changed |
server.js | changed mode from 100644 to 100755 |
scuttleshell.json | deleted |
scuttleshell.template.json | added |
.gitignore | ||
---|---|---|
@@ -67,5 +67,4 @@ | ||
67 | 67 … | .yarn-integrity |
68 | 68 … | |
69 | 69 … | # dotenv environment variables file |
70 | 70 … | .env |
71 | - |
host-app.js | ||
---|---|---|
@@ -1,5 +1,4 @@ | ||
1 | - | |
2 | 1 … | const nativeMessage = require('chrome-native-messaging') |
3 | 2 … | const { spawn } = require('child_process') |
4 | 3 … | const path = require('path') |
5 | 4 … | const fs = require('fs') |
package-lock.json | ||
---|---|---|
The diff is too large to show. Use a local git client to view these changes. Old file size: 168702 bytes New file size: 159046 bytes |
package.json | ||
---|---|---|
@@ -19,19 +19,23 @@ | ||
19 | 19 … | "chrome-native-messaging": "^0.2.0", |
20 | 20 … | "ecstatic": "^3.1.0", |
21 | 21 … | "minimist": "^1.2.0", |
22 | 22 … | "node-notifier": "^5.2.1", |
23 | - "scuttlebot": "10.4.10", | |
23 … | + "scuttlebot": "^11.3.3", | |
24 | 24 … | "ssb-about": "^0.1.2", |
25 | 25 … | "ssb-backlinks": "^0.7.1", |
26 | 26 … | "ssb-blobs": "^1.1.4", |
27 … | + "ssb-chess-db": "^1.0.2", | |
27 | 28 … | "ssb-config": "^2.2.0", |
28 | - "ssb-ebt": "^2.0.0", | |
29 … | + "ssb-ebt": "^5.2.0", | |
29 | 30 … | "ssb-friends": "^2.4.0", |
30 | 31 … | "ssb-keys": "^7.0.13", |
32 … | + "ssb-meme": "^1.0.4", | |
31 | 33 … | "ssb-names": "^3.1.0", |
32 | 34 … | "ssb-ooo": "^1.0.7", |
35 … | + "ssb-private": "^0.2.1", | |
33 | 36 … | "ssb-query": "^2.1.0", |
37 … | + "ssb-search": "^1.1.1", | |
34 | 38 … | "ssb-web-resolver": "^1.1.2", |
35 | 39 … | "ssb-ws": "^2.0.0", |
36 | 40 … | "systray": "^1.0.3" |
37 | 41 … | }, |
@@ -51,5 +55,5 @@ | ||
51 | 55 … | "eslint-config-standard": "^11.0.0-beta.0" |
52 | 56 … | }, |
53 | 57 … | "peerDependencies": {}, |
54 | 58 … | "license": "MIT" |
55 | -} | |
59 … | +} |
scripts/check-configuration.js | ||
---|---|---|
@@ -1,45 +1,39 @@ | ||
1 | - | |
2 | - | |
1 … | +var fs = require('fs') | |
2 … | +var path = require('path') | |
3 | 3 … | var homedir = require('os').homedir() |
4 | -var macPath = homedir + "/Library/Application Support/Mozilla/NativeMessagingHosts/scuttleshell.json" | |
5 | -var linuxPath = homedir + "/.mozilla/native-messaging-hosts/scuttleshell.json" | |
6 | -var manifestPath = process.platform === "darwin" ? macPath : linuxPath | |
7 | -var fs = require("fs") | |
4 … | +var manifestPath = process.platform === 'darwin' | |
5 … | + ? path.join(homedir, '/Library/Application Support/Mozilla/NativeMessagingHosts/scuttleshell.json') | |
6 … | + : path.join(homedir, '/.mozilla/native-messaging-hosts/scuttleshell.json') | |
8 | 7 … | |
9 | -function check() { | |
10 | - | |
11 | - if (process.platform === "win32") { | |
12 | - console.log("This script does not work on windows") | |
8 … | +function check () { | |
9 … | + if (process.platform === 'win32') { | |
10 … | + console.log('This script does not work on windows') | |
13 | 11 … | process.exit(1) |
14 | 12 … | } |
15 | 13 … | |
16 | 14 … | if (!fs.existsSync(manifestPath)) { |
17 | - console.log("[ERROR] App manifest not found at declared location", manifestPath) | |
18 | - console.log("\nTry: npm run setup\n") | |
15 … | + console.log('[ERROR] App manifest not found at declared location', manifestPath) | |
16 … | + console.log('\nTry: npm run setup\n') | |
19 | 17 … | process.exit(1) |
20 | 18 … | } |
21 | 19 … | |
22 | - console.log("[INFO] App manifest path location:", manifestPath) | |
20 … | + console.log('[INFO] App manifest path location:', manifestPath) | |
23 | 21 … | |
24 | - let manifest = JSON.parse(fs.readFileSync(manifestPath)) | |
22 … | + var manifest = require(manifestPath) | |
25 | 23 … | |
26 | - let applicationLauncherPath = manifest.path | |
27 | - | |
28 | - if (!fs.existsSync(applicationLauncherPath)) { | |
29 | - console.log("[ERROR] Launcher not found at declared location", applicationLauncherPath) | |
30 | - console.log("\nTry: npm run setup\n") | |
24 … | + if (!fs.existsSync(manifest.path)) { | |
25 … | + console.log('[ERROR] Launcher not found at declared location', manifest.path) | |
26 … | + console.log('\nTry: npm run setup\n') | |
31 | 27 … | process.exit(1) |
32 | 28 … | } |
33 | 29 … | |
34 | - console.log("[OK] Configuration appears correct\n[INFO] App located at:", applicationLauncherPath) | |
30 … | + console.log('[OK] Configuration appears correct\n[INFO] App located at:', manifest.path) | |
35 | 31 … | |
36 | 32 … | process.exit(0) |
37 | - | |
38 | 33 … | } |
39 | 34 … | |
40 | - | |
41 | 35 … | module.exports = check |
42 | 36 … | |
43 | 37 … | if (require.main === module) { |
44 | 38 … | var errorLevel = check() |
45 | -} | |
39 … | +} |
scripts/setup.js | |||
---|---|---|---|
@@ -1,52 +1,46 @@ | |||
1 | - | ||
2 | - | ||
3 | 1 … | var homedir = require('os').homedir() | |
4 | 2 … | var path = require('path') | |
5 | -var macPath = homedir + "/Library/Application Support/Mozilla/NativeMessagingHosts/scuttleshell.json" | ||
6 | -var linuxPath = homedir + "/.mozilla/native-messaging-hosts/scuttleshell.json" | ||
7 | -var manifestPath = process.platform === "darwin" ? macPath : linuxPath | ||
8 | -var manifestFolderPath = manifestPath.replace("scuttleshell.json", "") | ||
9 | -var appPath = path.resolve("../host-app.js") | ||
10 | -var localManifestFile = path.resolve("../scuttleshell.json") | ||
11 | -var fs = require("fs") | ||
12 | -var mkdirp = require("mkdirp") | ||
3 … | +var fs = require('fs') | ||
4 … | +var mkdirp = require('mkdirp') | ||
13 | 5 … | ||
14 | -function setup() { | ||
6 … | +var appPath = path.join(__dirname, '../host-app.js') | ||
15 | 7 … | ||
16 | - if (process.platform == "win32") { | ||
8 … | +function setup () { | ||
9 … | + if (process.platform === 'win32') { | ||
17 | 10 … | console.log("This script doesn't work on windows, try npm run setup-win") | |
18 | 11 … | return 1 | |
19 | 12 … | } | |
20 | 13 … | ||
21 | 14 … | if (!fs.existsSync(appPath)) { | |
22 | - console.log("[ERROR] Application not found at: ", appPath) | ||
15 … | + console.log('[ERROR] Application not found at: ', appPath) | ||
23 | 16 … | return 1 | |
24 | 17 … | } | |
25 | 18 … | ||
26 | - if (!fs.existsSync(localManifestFile)) { | ||
27 | - console.log("[ERROR] Local copy of app manifest not found at: ", localManifestFile) | ||
28 | - return 1 | ||
29 | - } | ||
19 … | + var manifest = buildManifest() | ||
20 … | + setupMozillaManifest(manifest) | ||
30 | 21 … | ||
31 | - let manifest = JSON.parse(fs.readFileSync(localManifestFile)) | ||
22 … | + return 0 | ||
23 … | +} | ||
32 | 24 … | ||
33 | - let applicationLauncherPath = manifest.path | ||
25 … | +function buildManifest () { | ||
26 … | + const template = require(path.join(__dirname, '../scuttleshell.template.json')) | ||
27 … | + return Object.assign(template, { path: appPath }) | ||
28 … | +} | ||
34 | 29 … | ||
35 | - if (!fs.existsSync(applicationLauncherPath)) { | ||
36 | - console.log("[ERROR] App not found at declared location", applicationLauncherPath) | ||
37 | - console.log("FIXING...") | ||
38 | - manifest.path = appPath | ||
39 | - fs.writeFileSync(localManifestFile, JSON.stringify(manifest)) | ||
40 | - } else { | ||
41 | - console.log("[OK] Application found at the correct location", applicationLauncherPath) | ||
42 | - } | ||
30 … | +function setupMozillaManifest (manifest) { | ||
31 … | + var manifestFolderPath = process.platform === 'darwin' | ||
32 … | + ? path.join(homedir, '/Library/Application Support/Mozilla/NativeMessagingHosts') | ||
33 … | + : path.join(homedir, '/.mozilla/native-messaging-hosts') | ||
43 | 34 … | ||
44 | 35 … | mkdirp.sync(manifestFolderPath) | |
45 | - fs.writeFileSync(manifestPath, JSON.stringify(manifest)) | ||
46 | 36 … | ||
47 | - console.log("[OK] Wrote manifest path to registry.\n[INFO] Try: npm run check") | ||
48 | - return 0 | ||
37 … | + fs.writeFileSync( | ||
38 … | + path.join(manifestFolderPath, 'scuttleshell.json'), | ||
39 … | + JSON.stringify(manifest, null, 2) | ||
40 … | + ) | ||
41 … | + | ||
42 … | + console.log('[OK] Wrote manifest path to registry.\n[INFO] Try: npm run check') | ||
49 | 43 … | } | |
50 | 44 … | ||
51 | 45 … | module.exports = setup | |
52 | 46 … |
server.js | ||
---|---|---|
@@ -1,8 +1,8 @@ | ||
1 | 1 … | #! /usr/bin/env node |
2 | 2 … | |
3 | -const http = require('http') | |
4 | -const serve = require('ecstatic') | |
3 … | +// const http = require('http') | |
4 … | +// const serve = require('ecstatic') | |
5 | 5 … | const fs = require('fs') |
6 | 6 … | const path = require('path') |
7 | 7 … | const ssbKeys = require('ssb-keys') |
8 | 8 … | const minimist = require('minimist') |
@@ -28,19 +28,23 @@ | ||
28 | 28 … | // .use(require('scuttlebot/plugins/plugins')) |
29 | 29 … | .use(require('scuttlebot/plugins/master')) |
30 | 30 … | .use(require('scuttlebot/plugins/gossip')) |
31 | 31 … | .use(require('scuttlebot/plugins/replicate')) |
32 | - .use(require('ssb-friends')) | |
33 | - .use(require('ssb-blobs')) | |
34 | 32 … | .use(require('scuttlebot/plugins/invite')) |
35 | 33 … | .use(require('scuttlebot/plugins/local')) |
34 … | + .use(require('ssb-about')) | |
35 … | + .use(require('ssb-backlinks')) | |
36 … | + .use(require('ssb-blobs')) | |
37 … | + .use(require('ssb-ebt')) | |
38 … | + .use(require('ssb-chess-db')) | |
39 … | + .use(require('ssb-friends')) | |
40 … | + .use(require('ssb-meme')) | |
41 … | + .use(require('ssb-names')) | |
42 … | + .use(require('ssb-ooo')) | |
43 … | + .use(require('ssb-private')) | |
44 … | + .use(require('ssb-search')) | |
36 | 45 … | .use(require('ssb-query')) |
37 | - .use(require('ssb-ooo')) | |
38 | - .use(require('ssb-ebt')) | |
39 | 46 … | .use(require('ssb-ws')) |
40 | - .use(require('ssb-names')) | |
41 | - .use(require('ssb-backlinks')) | |
42 | - .use(require('ssb-about')) | |
43 | 47 … | |
44 | 48 … | // start server |
45 | 49 … | |
46 | 50 … | config.keys = keys |
@@ -88,5 +92,5 @@ | ||
88 | 92 … | |
89 | 93 … | tray.onExit((code, signal) => { |
90 | 94 … | setTimeout(() => |
91 | 95 … | process.exit(0), 2000) |
92 | -}) | |
96 … | +}) |
scuttleshell.json | ||
---|---|---|
@@ -1,12 +1,0 @@ | ||
1 | -{ | |
2 | - "name": "scuttleshell", | |
3 | - "description": "Native app companion to sbot webextensions", | |
4 | - "path": "C:\\Users\\soapdog\\prog\\ssbc\\scuttle-shell\\app.bat", | |
5 | - "type": "stdio", | |
6 | - "allowed_extensions": [ | |
7 | - "share_on_scuttlebutt@andregarzia.com", | |
8 | - "ssb_protocol_handler@andregarzia.com", | |
9 | - "sbot_test@andregarzia.com", | |
10 | - "patchfox@andregarzia.com" | |
11 | - ] | |
12 | -} |
scuttleshell.template.json | ||
---|---|---|
@@ -1,0 +1,12 @@ | ||
1 … | +{ | |
2 … | + "name": "scuttleshell", | |
3 … | + "description": "Native app companion to sbot webextensions", | |
4 … | + "path": "TO BE DETERMINED", | |
5 … | + "type": "stdio", | |
6 … | + "allowed_extensions": [ | |
7 … | + "share_on_scuttlebutt@andregarzia.com", | |
8 … | + "ssb_protocol_handler@andregarzia.com", | |
9 … | + "sbot_test@andregarzia.com", | |
10 … | + "patchfox@andregarzia.com" | |
11 … | + ] | |
12 … | +} |
Built with git-ssb-web