From 2c46cbf6f25b140100cc9f1af86a51fec595b798 Mon Sep 17 00:00:00 2001 From: Cinnamon Date: Tue, 7 Jan 2020 11:53:46 -0800 Subject: [PATCH 1/3] Add CLI flag for offline mode (using temporary hack with globals) --- index.js | 12 +++++++++++- src/pages/models/lib/server.js | 19 ++++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index b57ac1e..99fa51e 100755 --- a/index.js +++ b/index.js @@ -8,12 +8,19 @@ const path = require('path') const config = yargs .env('OASIS') + .help('h') + .alias('h', 'help') .usage('Usage: $0 [options]') .options('open', { - describe: 'Automatically open app in web browser', + describe: 'Automatically open app in web browser. Use --no-open to disable.', default: true, type: 'boolean' }) + .options('offline', { + describe: "Don't try to connect to scuttlebutt peers or pubs", + default: false, + type: 'boolean' + }) .options('host', { describe: 'Hostname for web app to listen on', default: 'localhost', @@ -42,6 +49,9 @@ if (config.debug) { process.env.DEBUG = 'oasis,oasis:*' } +// Awful hack to get the offline config setting deep into src/pages/models/lib/server.js +process.env.OASIS_OFFLINE = '' + config.offline + const app = require('./src/app') const start = async () => { diff --git a/src/pages/models/lib/server.js b/src/pages/models/lib/server.js index 7e3aaa6..eef879c 100644 --- a/src/pages/models/lib/server.js +++ b/src/pages/models/lib/server.js @@ -1,5 +1,22 @@ const ssbConfig = require('ssb-config') const flotilla = require('@fraction/flotilla') +const debug = require('debug')('oasis') + +// Awful hack to get make offline CLI flag available here. +// It's set in index.js +const offline = process.env.OASIS_OFFLINE === 'true' +if (offline) { + debug.enabled = true + debug('Offline mode activated - not connecting to scuttlebutt peers or pubs') +} + +const server = flotilla({ + conn: { + autostart: !offline + }, + ws: { + http: false + } +}) -const server = flotilla({ ws: { http: false } }) server(ssbConfig) From 47c8c75a1a5762ef9c0231e8edf1df0e10b855df Mon Sep 17 00:00:00 2001 From: Cinnamon <32660718+cinnamon-bun@users.noreply.github.com> Date: Tue, 7 Jan 2020 13:29:08 -0800 Subject: [PATCH 2/3] Update README.md to include --offline in CLI help --- README.md | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 78afc0f..cd12a1c 100644 --- a/README.md +++ b/README.md @@ -9,15 +9,19 @@ some extra tools for debugging, _not_ to support all known message types. ```console $ oasis --help + Usage: oasis [options] Options: - --help Show help [boolean] - --version Show version number [boolean] - --open Automatically open app in web browser [boolean] [default: true] - --host Hostname for web app to listen on[string] [default: "localhost"] - --port Port for web app to listen on [number] [default: 3000] - --debug Use verbose output for debugging [boolean] [default: false] + --version Show version number [boolean] + -h, --help Show help [boolean] + --open Automatically open app in web browser. Use --no-open to disable. + [boolean] [default: true] + --offline Don't try to connect to scuttlebutt peers or pubs + [boolean] [default: false] + --host Hostname for web app to listen on [string] [default: "localhost"] + --port Port for web app to listen on [number] [default: 3000] + --debug Use verbose output for debugging [boolean] [default: false] ``` ## Installation From e0fef8ac2868b52ecfe7345937be8fe94dbcad21 Mon Sep 17 00:00:00 2001 From: Christian Bundy Date: Wed, 8 Jan 2020 08:04:42 -0800 Subject: [PATCH 3/3] Change issue template to be less annoying Problem: Old issue template felt annoying. Solution: Simpler issue template based on ZeroMQ's C4 development style. --- .github/ISSUE_TEMPLATE.md | 4 ++++ .github/ISSUE_TEMPLATE/BUG_REPORT.md | 18 ------------------ .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md | 16 ---------------- .github/PULL_REQUEST_TEMPLATE.md | 5 ++--- 4 files changed, 6 insertions(+), 37 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE.md delete mode 100644 .github/ISSUE_TEMPLATE/BUG_REPORT.md delete mode 100644 .github/ISSUE_TEMPLATE/FEATURE_REQUEST.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..fb56239 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,4 @@ +**What's the problem you want to solved?** + +**Is there a solution you'd like to recommend?** + diff --git a/.github/ISSUE_TEMPLATE/BUG_REPORT.md b/.github/ISSUE_TEMPLATE/BUG_REPORT.md deleted file mode 100644 index f8516a4..0000000 --- a/.github/ISSUE_TEMPLATE/BUG_REPORT.md +++ /dev/null @@ -1,18 +0,0 @@ ---- -name: "🐞 Bug report" -about: Report a problem with this software -title: '' -labels: '' -assignees: '' - ---- - -**What version of this package are you using?** - -**What operating system, Node.js, and npm version?** - -**What happened?** - -**What did you expect to happen?** - -**Are you willing to submit a pull request to fix this bug?** diff --git a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md b/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md deleted file mode 100644 index f79d822..0000000 --- a/.github/ISSUE_TEMPLATE/FEATURE_REQUEST.md +++ /dev/null @@ -1,16 +0,0 @@ ---- -name: "⭐️ Feature request" -about: Request a new feature to be added -title: '' -labels: '' -assignees: '' - ---- - -**What version of this package are you using?** - -**What problem do you want to solve?** - -**What do you think is the correct solution to this problem?** - -**Are you willing to submit a pull request to implement this change?** diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index 0cfc272..e0d58eb 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,5 +1,4 @@ -**What is the purpose of this pull request?** +**What's the problem you solved?** -**What changes did you make? (brief overview)** +**What solution are you recommending?** -**Is there anything you'd like reviewers to focus on?**