git ssb

1+

mixmix / scuttle-shell



Commit 70ef62e92b6493d5a2b7193806b674157cabcab0

Merge branch 'mixmix-linux'

andre alves garzia committed on 7/1/2018, 10:07:27 PM
Parent: c3840081d9c3529672b66b5d47b2013475fc783c
Parent: ff415cfd94d87c90cfd7d775564a459508a86ea6

Files changed

.gitignorechanged
host-app.jschanged
package-lock.jsonchanged
package.jsonchanged
scripts/check-configuration.jschanged
scripts/setup.jschanged
server.jschanged mode from 100644 to 100755
scuttleshell.jsondeleted
scuttleshell.template.jsonadded
.gitignoreView
@@ -67,5 +67,4 @@
6767 .yarn-integrity
6868
6969 # dotenv environment variables file
7070 .env
71-
host-app.jsView
@@ -1,5 +1,4 @@
1-
21 const nativeMessage = require('chrome-native-messaging')
32 const { spawn } = require('child_process')
43 const path = require('path')
54 const fs = require('fs')
package-lock.jsonView
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.jsonView
@@ -19,19 +19,23 @@
1919 "chrome-native-messaging": "^0.2.0",
2020 "ecstatic": "^3.1.0",
2121 "minimist": "^1.2.0",
2222 "node-notifier": "^5.2.1",
23- "scuttlebot": "10.4.10",
23 + "scuttlebot": "^11.3.3",
2424 "ssb-about": "^0.1.2",
2525 "ssb-backlinks": "^0.7.1",
2626 "ssb-blobs": "^1.1.4",
27 + "ssb-chess-db": "^1.0.2",
2728 "ssb-config": "^2.2.0",
28- "ssb-ebt": "^2.0.0",
29 + "ssb-ebt": "^5.2.0",
2930 "ssb-friends": "^2.4.0",
3031 "ssb-keys": "^7.0.13",
32 + "ssb-meme": "^1.0.4",
3133 "ssb-names": "^3.1.0",
3234 "ssb-ooo": "^1.0.7",
35 + "ssb-private": "^0.2.1",
3336 "ssb-query": "^2.1.0",
37 + "ssb-search": "^1.1.1",
3438 "ssb-web-resolver": "^1.1.2",
3539 "ssb-ws": "^2.0.0",
3640 "systray": "^1.0.3"
3741 },
@@ -51,5 +55,5 @@
5155 "eslint-config-standard": "^11.0.0-beta.0"
5256 },
5357 "peerDependencies": {},
5458 "license": "MIT"
55-}
59 +}
scripts/check-configuration.jsView
@@ -1,45 +1,39 @@
1-
2-
1 +var fs = require('fs')
2 +var path = require('path')
33 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')
87
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')
1311 process.exit(1)
1412 }
1513
1614 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')
1917 process.exit(1)
2018 }
2119
22- console.log("[INFO] App manifest path location:", manifestPath)
20 + console.log('[INFO] App manifest path location:', manifestPath)
2321
24- let manifest = JSON.parse(fs.readFileSync(manifestPath))
22 + var manifest = require(manifestPath)
2523
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')
3127 process.exit(1)
3228 }
3329
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)
3531
3632 process.exit(0)
37-
3833 }
3934
40-
4135 module.exports = check
4236
4337 if (require.main === module) {
4438 var errorLevel = check()
45-}
39 +}
scripts/setup.jsView
@@ -1,52 +1,46 @@
1-
2-
31 var homedir = require('os').homedir()
42 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')
135
14-function setup() {
6 +var appPath = path.join(__dirname, '../host-app.js')
157
16- if (process.platform == "win32") {
8 +function setup () {
9 + if (process.platform === 'win32') {
1710 console.log("This script doesn't work on windows, try npm run setup-win")
1811 return 1
1912 }
2013
2114 if (!fs.existsSync(appPath)) {
22- console.log("[ERROR] Application not found at: ", appPath)
15 + console.log('[ERROR] Application not found at: ', appPath)
2316 return 1
2417 }
2518
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)
3021
31- let manifest = JSON.parse(fs.readFileSync(localManifestFile))
22 + return 0
23 +}
3224
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 +}
3429
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')
4334
4435 mkdirp.sync(manifestFolderPath)
45- fs.writeFileSync(manifestPath, JSON.stringify(manifest))
4636
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')
4943 }
5044
5145 module.exports = setup
5246
server.jsView
@@ -1,8 +1,8 @@
11 #! /usr/bin/env node
22
3-const http = require('http')
4-const serve = require('ecstatic')
3 +// const http = require('http')
4 +// const serve = require('ecstatic')
55 const fs = require('fs')
66 const path = require('path')
77 const ssbKeys = require('ssb-keys')
88 const minimist = require('minimist')
@@ -28,19 +28,23 @@
2828 // .use(require('scuttlebot/plugins/plugins'))
2929 .use(require('scuttlebot/plugins/master'))
3030 .use(require('scuttlebot/plugins/gossip'))
3131 .use(require('scuttlebot/plugins/replicate'))
32- .use(require('ssb-friends'))
33- .use(require('ssb-blobs'))
3432 .use(require('scuttlebot/plugins/invite'))
3533 .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'))
3645 .use(require('ssb-query'))
37- .use(require('ssb-ooo'))
38- .use(require('ssb-ebt'))
3946 .use(require('ssb-ws'))
40- .use(require('ssb-names'))
41- .use(require('ssb-backlinks'))
42- .use(require('ssb-about'))
4347
4448 // start server
4549
4650 config.keys = keys
@@ -88,5 +92,5 @@
8892
8993 tray.onExit((code, signal) => {
9094 setTimeout(() =>
9195 process.exit(0), 2000)
92-})
96 +})
scuttleshell.jsonView
@@ -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.jsonView
@@ -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