From 5dff305a54c34c9402be6dc0068fc155e2ba0a0e Mon Sep 17 00:00:00 2001 From: John Bintz <27256+johnbintz@users.noreply.github.com> Date: Tue, 21 Apr 2020 07:23:40 -0400 Subject: [PATCH] Fixes for app review * Better public ID retrieval workaround * Put App ID back * Fix up links/capitalization on admin page --- .sandstorm/changelog.md | 2 +- .sandstorm/pgp-signature | Bin 580 -> 583 bytes .sandstorm/sandstorm-files.list | 52 ++++++++++++++++++++++-- .sandstorm/sandstorm-pkgdef.capnp | 4 +- CHANGELOG.md | 2 +- pages/index.vue | 64 ++++++++++++++++++++---------- server.js | 18 ++++++--- 7 files changed, 109 insertions(+), 33 deletions(-) diff --git a/.sandstorm/changelog.md b/.sandstorm/changelog.md index cf134db..0e35ac0 100644 --- a/.sandstorm/changelog.md +++ b/.sandstorm/changelog.md @@ -1,4 +1,4 @@ -# V0.69.0~2020-04-14 +# V0.69.0~2020-04-21 * Upgrade Hugo to 0.69.0. * Note: If you use inline HTML in your Markdown, add the following to `config.toml`: diff --git a/.sandstorm/pgp-signature b/.sandstorm/pgp-signature index c35b6b4d07a1d96ac6cfae4a4c58657baf6a3510..c5852767c7ebb4614b76b19c6ff63fd3623a69b0 100644 GIT binary patch literal 583 zcmV-N0=WI70Rcb)zx|L60{{vEBT(?m^N-nY0n2$}0A8L&PDvnPZ6I`LWgua7bZBpK zAa7MmANklpzYjb&Z zWH@m-Xg6|rIdw2FF=}ozI5IIdcx5*=VKOi5i^3;=+} zi7?wmomcFuFd}ebNf$k3^_~zq@`~Qgh(PP#brOSdAU*^XnBDIqj}B+-Ey%L<`ujB- zD2TQKSh!s33HG1zkjHE&jiY0osEMeC`9H7-xS~w~(1c%Uj%(qs``gsRXr6zqQu=z- zovS=ZpE!ll^t+(&w!ug*uNhj5x}>+giT}Yj`ML&)Phe%QhDiY zj+az$+^;9pudsl3rvf4>OdsxOip~6<(&{IilBbe(EauHt=Dm{417~&zvOg`a`AkmM z56S>=Vu9$G@w=BADXzW@rLQ31tG6OYl(ZV~tPA`03et{42Oj@fjt%(yh_(D(j~=P% zBIIdL!w3i-BVTdaGYu0uJ}}z7wkJ6Z2HSg^e_gT|gz)3MN@mXvRwdPCGuyHk@5V=g VLzl6+|H{}szfd_3+-E-n<7a|<6{-LL literal 580 zcmV-K0=xaA0h_?f%)rH{9Pr`v=l+}djHfG;7~&>ujq_AU%vC7KNL5HIEy>6)QpisO z^MVueQi@CRi*ofc^A!>c3KYsSOESPRY56%h`Q@2;=?b1MRthF%d6g+9$(BZz=@uyk zdBsLmsYMovY3W79WrkViiP?FDCdGM`<;EqYmIWqdxhA>g$p)Q_n^_nbxfo={6j=&? zUAkAX=dbpjd$${5ZewKvIgEjeQvfCsd76h|aX0JYbM?VxXICD-`c7c7%)Xs&$_gu| z`Q(UioM7~^LQ_?4{>n)T5=Txk2p(}Qc`c9_SX)}gvLm*0f%>_RM=spHa_5;%iC)O^ z4kHnh*x9p#da7!AnQA66EqT9JAhd2C@8R7ia(uYg6>iMFle5&};)j>-qWv|mEjQPC z`oC~vQU39C^~}}}-#xAsYVPECx8Sl>)Bgv*LMB~nSD)IUYGUH!p;mcd<9S}8z5i`4 zf9T(}O?cV5ggZsvVMZazvsaxgaLSs`86jaZHH|Z;q>*>~U*?t{SJ<6zze|6rtKuKl z>0{@3-9ba6GVS@DTk%hY{$9Vi(|u}y#$(~AT2nEt*Ln#RJ^uTCO=ovqVPC6y=hoWk zo+c@`lGYxv5fb&h#lR55bJ@n>f%L>|o>E=svZg@CIJRs((+_3-(o6S0=iZd9`MQ)T z%0|gNnm11Va`V2U_bf_0?ukxNtYT+ndgK}76ncPdsb6gDnM&Jl_qXNqaoVpJ*y(4I SsL*bfSypmf&ar28cq9O8BrlHu diff --git a/.sandstorm/sandstorm-files.list b/.sandstorm/sandstorm-files.list index f1701c2..c7fca74 100644 --- a/.sandstorm/sandstorm-files.list +++ b/.sandstorm/sandstorm-files.list @@ -90,13 +90,13 @@ lib64/ld-linux-x86-64.so.2 opt/app opt/app/.babelrc opt/app/.cloudcmd.menu.js -opt/app/.nuxt/dist/0.nuxt.bundle.58cdddcc661ce568abbd.js +opt/app/.nuxt/dist/0.nuxt.bundle.f2f0f05da0a6a435ee4c.js opt/app/.nuxt/dist/1.nuxt.bundle.89a9958091c34dcc68ed.js opt/app/.nuxt/dist/index.html -opt/app/.nuxt/dist/manifest.0ccde45fe1c448af06e2.js +opt/app/.nuxt/dist/manifest.1e9ee1e14867bf29e7ca.js opt/app/.nuxt/dist/nuxt.bundle.dbf51a8ed53569a6c1b0.js opt/app/.nuxt/dist/server-bundle.json -opt/app/.nuxt/dist/vendor.bundle.0ccde45fe1c448af06e2.js +opt/app/.nuxt/dist/vendor.bundle.1e9ee1e14867bf29e7ca.js opt/app/.sandstorm/launcher.sh opt/app/README.md opt/app/node_modules/.bin/babel-node @@ -4049,6 +4049,8 @@ usr/lib/node_modules/npm/node_modules/builtins/builtins.json usr/lib/node_modules/npm/node_modules/builtins/package.json usr/lib/node_modules/npm/node_modules/byline/lib/byline.js usr/lib/node_modules/npm/node_modules/byline/package.json +usr/lib/node_modules/npm/node_modules/capture-stack-trace/index.js +usr/lib/node_modules/npm/node_modules/capture-stack-trace/package.json usr/lib/node_modules/npm/node_modules/chownr/chownr.js usr/lib/node_modules/npm/node_modules/chownr/package.json usr/lib/node_modules/npm/node_modules/ci-info/index.js @@ -4069,14 +4071,20 @@ usr/lib/node_modules/npm/node_modules/console-control-strings/index.js usr/lib/node_modules/npm/node_modules/console-control-strings/package.json usr/lib/node_modules/npm/node_modules/core-util-is/lib/util.js usr/lib/node_modules/npm/node_modules/core-util-is/package.json +usr/lib/node_modules/npm/node_modules/create-error-class/index.js +usr/lib/node_modules/npm/node_modules/create-error-class/package.json usr/lib/node_modules/npm/node_modules/crypto-random-string/index.js usr/lib/node_modules/npm/node_modules/crypto-random-string/package.json +usr/lib/node_modules/npm/node_modules/deep-extend/lib/deep-extend.js +usr/lib/node_modules/npm/node_modules/deep-extend/package.json usr/lib/node_modules/npm/node_modules/delegates/index.js usr/lib/node_modules/npm/node_modules/delegates/package.json usr/lib/node_modules/npm/node_modules/dezalgo/dezalgo.js usr/lib/node_modules/npm/node_modules/dezalgo/package.json usr/lib/node_modules/npm/node_modules/dot-prop/index.js usr/lib/node_modules/npm/node_modules/dot-prop/package.json +usr/lib/node_modules/npm/node_modules/duplexer3/index.js +usr/lib/node_modules/npm/node_modules/duplexer3/package.json usr/lib/node_modules/npm/node_modules/encoding/lib/encoding.js usr/lib/node_modules/npm/node_modules/encoding/lib/iconv-loader.js usr/lib/node_modules/npm/node_modules/encoding/package.json @@ -4128,6 +4136,11 @@ usr/lib/node_modules/npm/node_modules/glob/common.js usr/lib/node_modules/npm/node_modules/glob/glob.js usr/lib/node_modules/npm/node_modules/glob/package.json usr/lib/node_modules/npm/node_modules/glob/sync.js +usr/lib/node_modules/npm/node_modules/got/index.js +usr/lib/node_modules/npm/node_modules/got/node_modules/get-stream/buffer-stream.js +usr/lib/node_modules/npm/node_modules/got/node_modules/get-stream/index.js +usr/lib/node_modules/npm/node_modules/got/node_modules/get-stream/package.json +usr/lib/node_modules/npm/node_modules/got/package.json usr/lib/node_modules/npm/node_modules/graceful-fs/clone.js usr/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js usr/lib/node_modules/npm/node_modules/graceful-fs/legacy-streams.js @@ -4168,6 +4181,12 @@ usr/lib/node_modules/npm/node_modules/is-fullwidth-code-point/index.js usr/lib/node_modules/npm/node_modules/is-fullwidth-code-point/package.json usr/lib/node_modules/npm/node_modules/is-obj/index.js usr/lib/node_modules/npm/node_modules/is-obj/package.json +usr/lib/node_modules/npm/node_modules/is-redirect/index.js +usr/lib/node_modules/npm/node_modules/is-redirect/package.json +usr/lib/node_modules/npm/node_modules/is-retry-allowed/index.js +usr/lib/node_modules/npm/node_modules/is-retry-allowed/package.json +usr/lib/node_modules/npm/node_modules/is-stream/index.js +usr/lib/node_modules/npm/node_modules/is-stream/package.json usr/lib/node_modules/npm/node_modules/isarray/index.js usr/lib/node_modules/npm/node_modules/isarray/package.json usr/lib/node_modules/npm/node_modules/isexe/index.js @@ -4177,7 +4196,11 @@ usr/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js usr/lib/node_modules/npm/node_modules/json-parse-better-errors/package.json usr/lib/node_modules/npm/node_modules/jsonparse/jsonparse.js usr/lib/node_modules/npm/node_modules/jsonparse/package.json +usr/lib/node_modules/npm/node_modules/latest-version/index.js +usr/lib/node_modules/npm/node_modules/latest-version/package.json usr/lib/node_modules/npm/node_modules/libnpm/fetch.js +usr/lib/node_modules/npm/node_modules/lowercase-keys/index.js +usr/lib/node_modules/npm/node_modules/lowercase-keys/package.json usr/lib/node_modules/npm/node_modules/lru-cache/index.js usr/lib/node_modules/npm/node_modules/lru-cache/package.json usr/lib/node_modules/npm/node_modules/make-dir/index.js @@ -4252,12 +4275,16 @@ usr/lib/node_modules/npm/node_modules/os-tmpdir/index.js usr/lib/node_modules/npm/node_modules/os-tmpdir/package.json usr/lib/node_modules/npm/node_modules/osenv/osenv.js usr/lib/node_modules/npm/node_modules/osenv/package.json +usr/lib/node_modules/npm/node_modules/package-json/index.js +usr/lib/node_modules/npm/node_modules/package-json/package.json usr/lib/node_modules/npm/node_modules/path-is-absolute/index.js usr/lib/node_modules/npm/node_modules/path-is-absolute/package.json usr/lib/node_modules/npm/node_modules/path-is-inside/lib/path-is-inside.js usr/lib/node_modules/npm/node_modules/path-is-inside/package.json usr/lib/node_modules/npm/node_modules/pify/index.js usr/lib/node_modules/npm/node_modules/pify/package.json +usr/lib/node_modules/npm/node_modules/prepend-http/index.js +usr/lib/node_modules/npm/node_modules/prepend-http/package.json usr/lib/node_modules/npm/node_modules/process-nextick-args/index.js usr/lib/node_modules/npm/node_modules/process-nextick-args/package.json usr/lib/node_modules/npm/node_modules/promise-retry/index.js @@ -4268,6 +4295,11 @@ usr/lib/node_modules/npm/node_modules/promise-retry/node_modules/retry/package.j usr/lib/node_modules/npm/node_modules/promise-retry/package.json usr/lib/node_modules/npm/node_modules/proto-list/package.json usr/lib/node_modules/npm/node_modules/proto-list/proto-list.js +usr/lib/node_modules/npm/node_modules/rc/index.js +usr/lib/node_modules/npm/node_modules/rc/lib/utils.js +usr/lib/node_modules/npm/node_modules/rc/node_modules/minimist/index.js +usr/lib/node_modules/npm/node_modules/rc/node_modules/minimist/package.json +usr/lib/node_modules/npm/node_modules/rc/package.json usr/lib/node_modules/npm/node_modules/read-cmd-shim/index.js usr/lib/node_modules/npm/node_modules/read-cmd-shim/package.json usr/lib/node_modules/npm/node_modules/read-package-json/package.json @@ -4279,6 +4311,11 @@ usr/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_transform.js usr/lib/node_modules/npm/node_modules/readable-stream/lib/_stream_writable.js usr/lib/node_modules/npm/node_modules/readable-stream/package.json usr/lib/node_modules/npm/node_modules/readable-stream/readable.js +usr/lib/node_modules/npm/node_modules/registry-auth-token/base64.js +usr/lib/node_modules/npm/node_modules/registry-auth-token/index.js +usr/lib/node_modules/npm/node_modules/registry-auth-token/package.json +usr/lib/node_modules/npm/node_modules/registry-url/index.js +usr/lib/node_modules/npm/node_modules/registry-url/package.json usr/lib/node_modules/npm/node_modules/request/index.js usr/lib/node_modules/npm/node_modules/request/lib/auth.js usr/lib/node_modules/npm/node_modules/request/lib/cookies.js @@ -4329,16 +4366,25 @@ usr/lib/node_modules/npm/node_modules/spdx-license-ids/index.json usr/lib/node_modules/npm/node_modules/spdx-license-ids/package.json usr/lib/node_modules/npm/node_modules/strip-ansi/index.js usr/lib/node_modules/npm/node_modules/strip-ansi/package.json +usr/lib/node_modules/npm/node_modules/strip-json-comments/index.js +usr/lib/node_modules/npm/node_modules/strip-json-comments/package.json usr/lib/node_modules/npm/node_modules/through/index.js usr/lib/node_modules/npm/node_modules/through/package.json +usr/lib/node_modules/npm/node_modules/timed-out/index.js +usr/lib/node_modules/npm/node_modules/timed-out/package.json usr/lib/node_modules/npm/node_modules/uid-number/package.json usr/lib/node_modules/npm/node_modules/uid-number/uid-number.js usr/lib/node_modules/npm/node_modules/umask/index.js usr/lib/node_modules/npm/node_modules/umask/package.json usr/lib/node_modules/npm/node_modules/unique-string/index.js usr/lib/node_modules/npm/node_modules/unique-string/package.json +usr/lib/node_modules/npm/node_modules/unzip-response/index.js +usr/lib/node_modules/npm/node_modules/unzip-response/package.json +usr/lib/node_modules/npm/node_modules/update-notifier/check.js usr/lib/node_modules/npm/node_modules/update-notifier/index.js usr/lib/node_modules/npm/node_modules/update-notifier/package.json +usr/lib/node_modules/npm/node_modules/url-parse-lax/index.js +usr/lib/node_modules/npm/node_modules/url-parse-lax/package.json usr/lib/node_modules/npm/node_modules/util-deprecate/node.js usr/lib/node_modules/npm/node_modules/util-deprecate/package.json usr/lib/node_modules/npm/node_modules/uuid/index.js diff --git a/.sandstorm/sandstorm-pkgdef.capnp b/.sandstorm/sandstorm-pkgdef.capnp index ef8fae1..f43ac25 100644 --- a/.sandstorm/sandstorm-pkgdef.capnp +++ b/.sandstorm/sandstorm-pkgdef.capnp @@ -9,7 +9,7 @@ const pkgdef :Spk.PackageDefinition = ( # The package definition. Note that the spk tool looks specifically for the # "pkgdef" constant. - id = "4vnyd4c929g8dpns2zer8afgrsv1j7aknq4snyw3tu9p4vm4mwc0", + id = "ksyud8q9h7rx9u001jn38216xe75a200avh7tg267wss6pq9zfkh", # Your app ID is actually its public key. The private key was placed in # your keyring. All updates must be signed with the same key. @@ -21,7 +21,7 @@ const pkgdef :Spk.PackageDefinition = ( appVersion = 4, # Increment this for every release. - appMarketingVersion = (defaultText = "0.69.0~2020-04-14"), + appMarketingVersion = (defaultText = "0.69.0~2020-04-21"), # Human-readable representation of appVersion. Should match the way you # identify versions of your app in documentation and marketing. diff --git a/CHANGELOG.md b/CHANGELOG.md index 3893b84..04e98eb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## 0.69.0 (2020-04-14) +## 0.69.0 (2020-04-21) ### Enhancements diff --git a/pages/index.vue b/pages/index.vue index 1d1b0ac..8e85ff2 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -47,9 +47,9 @@ :template="'git clone -c credential.helper=store ' + this.gitUrl + ' site'"/>

Here are a few pointers to help you get started:

    -
  • Choose a theme to make your site look nice. Hugo's theme showcase is a good place to start.
  • +
  • Choose a theme to make your site look nice. Hugo's theme showcase is a good place to start.
  • Add the theme to your Git repository as a subtree at themes/themename.
  • -
  • Add theme = "themename" to Config.toml.
  • +
  • Add theme = "themename" to config.toml.
  • Push the repository, and your new site will be immediately published.

Pushing Existing Site

@@ -59,9 +59,6 @@ :template="'git remote add origin ' + this.gitUrl + '\ngit push -fu origin master'"/>

Upgrade notes from the 0.20 Sandstorm release:

    -
  • - -
  • If you were using inline HTML in any Markdown files, enter the following into your config.toml file: @@ -70,12 +67,17 @@ unsafe= true
  • +
  • + There have been updates/changes to how previous/next item handling has + changed over time. Ensure your previous/next item handling is + working as intended. +

- Be sure to read through the Hugo release notes + Be sure to read through the Hugo release notes if you notice any other odd behavior after upgrading.

-

Admin Interface (Cloud Commander)

+

Admin Interface (Cloud Commander)

Commit & publish local changes Delete local changes (git reset --hard) @@ -114,20 +116,23 @@ unsafe= true // simplify promise handling. async mounted () { this.isLoading = true - try { - const result = await fetch("/publicId", { - credentials: "same-origin" - }) - const jsonResult = await result.json() - this.isDemo = jsonResult.isDemo - this.url = jsonResult.url - this.publicId = jsonResult.publicId - this.domain = jsonResult.domain - } catch (e) { - console.error(e) - this.loadError = e - } finally { - this.isLoading = false + + // TODO: needed until https://github.com/sandstorm-io/sandstorm/pull/3292 is merged + let publicIdLoadTries = 5 + + while (publicIdLoadTries > 0 && !this.url) { + try { + await this.fetchPublicId() + } catch (e) { + // wait 5 seconds and try again + await new Promise((resolve) => { setTimeout(resolve, 5000) }) + + publicIdLoadTries -= 1 + + if (publicIdLoadTries === 0) { + this.loadError = e + } + } } setInterval(this.checkDirty, 5000) @@ -136,6 +141,23 @@ unsafe= true title: "Home" }, methods: { + async fetchPublicId () { + try { + const result = await fetch("/publicId", { + credentials: "same-origin" + }) + const jsonResult = await result.json() + this.isDemo = jsonResult.isDemo + this.url = jsonResult.url + this.publicId = jsonResult.publicId + this.domain = jsonResult.domain + } catch (e) { + console.error(e) + this.loadError = e + } finally { + this.isLoading = false + } + }, async commitLocal () { if (!this.dirty) return diff --git a/server.js b/server.js index 66c6ae3..9544dd7 100644 --- a/server.js +++ b/server.js @@ -17,12 +17,20 @@ const port = process.env.PORT || "8000" app.set("port", port) app.get("/publicId", (req, res) => { + // For those reusing getPublicId, keep in mind that the session ID from the + // headers isn't used to generate the address for a grain, only the grain's + // internal ID. Once you've generated it once, that's it. + // + // See https://github.com/sandstorm-io/sandstorm/blob/1a1f5650472904e137393af077a3d90f094cd888/shell/imports/server/hack-session.js#L334-L365 + // for more information. const sessionId = req.headers["x-sandstorm-session-id"] let allData = "" - // TODO: figure out why Cap'n Proto keeps crashing when - // getPublicId exits so we can get rid of this weird - // memoization hack I had to do! - const file = `/var/publicid-${sessionId}` + // TODO: needed until https://github.com/sandstorm-io/sandstorm/pull/3292 is merged + // + // If this app is running in demo mode, its data will be thrown away in an hour, + // and the public ID assigned to the grain will also go away, so it's still OK + // to keep this file around, even in a demo scenario. + const file = `/var/publicid` const handleResult = () => { const lines = allData.split("\n") @@ -37,7 +45,7 @@ app.get("/publicId", (req, res) => { try { allData = fs.readFileSync(file, 'utf8').toString() } catch (e) { - // nothing + // file probably doesn't exist } const lines = allData.split("\n")