Fixes for app review

* Better public ID retrieval workaround
* Put App ID back
* Fix up links/capitalization on admin page
This commit is contained in:
John Bintz 2020-04-21 07:23:40 -04:00
parent 6515d573c9
commit 5dff305a54
7 changed files with 109 additions and 33 deletions

View File

@ -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`:

Binary file not shown.

View File

@ -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

View File

@ -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.

View File

@ -1,4 +1,4 @@
## 0.69.0 (2020-04-14)
## 0.69.0 (2020-04-21)
### Enhancements

View File

@ -47,9 +47,9 @@
:template="'git clone -c credential.helper=store ' + this.gitUrl + ' site'"/>
<p>Here are a few pointers to help you get started:</p>
<ul>
<li>Choose a theme to make your site look nice. Hugo's <a href="https://themes.gohugo.io">theme showcase</a> is a good place to start.</li>
<li>Choose a theme to make your site look nice. Hugo's <a target="_blank" rel="noopener" href="https://themes.gohugo.io">theme showcase</a> is a good place to start.</li>
<li>Add the theme to your Git repository as a subtree at <code>themes/themename</code>.</li>
<li>Add <code>theme = "themename"</code> to <code>Config.toml</code>.</li>
<li>Add <code>theme = "themename"</code> to <code>config.toml</code>.</li>
<li>Push the repository, and your new site will be immediately published.</li>
</ul>
<h2>Pushing Existing Site</h2>
@ -59,9 +59,6 @@
:template="'git remote add origin ' + this.gitUrl + '\ngit push -fu origin master'"/>
<h2>Upgrade notes from the 0.20 Sandstorm release:</h2>
<ul>
<li>
</li>
<li>
If you were using inline HTML in any Markdown files, enter the following into
your <code>config.toml</code> file:
@ -70,12 +67,17 @@
unsafe= true
</pre>
</li>
<li>
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.
</li>
</ul>
<p>
Be sure to <a href="https://gohugo.io/news/">read through the Hugo release notes</a>
Be sure to <a href="https://gohugo.io/news/" target="_blank" rel="noopener">read through the Hugo release notes</a>
if you notice any other odd behavior after upgrading.
</p>
<h2>Admin Interface (<a href="https://cloudcmd.io/">Cloud Commander</a>)</h2>
<h2>Admin Interface (<a href="https://cloudcmd.io/" target="_blank" rel="noopener">Cloud Commander</a>)</h2>
<a :class="{disabled: !dirty}" class="button" @click="commitLocal">Commit &amp; publish local changes</a>
<a :class="{disabled: !dirty}" class="button" @click="deleteLocal">Delete local changes (git reset --hard)</a>
<iframe id="files" src="/admin" style="width: 100%; height: 800px; margin-top: 1rem"></iframe>
@ -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

View File

@ -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")