Wow 0.69.0 came out fast. Update index with modern Vue stuff

This commit is contained in:
John Bintz 2020-04-10 08:06:19 -04:00
parent aed2de4c95
commit 1106e225fe
11 changed files with 107 additions and 238 deletions

View File

@ -88,17 +88,15 @@ opt/app/.git/objects/pack
opt/app/.git/refs
opt/app/.git/refs/heads/master
opt/app/.git/refs/heads/updates
opt/app/.nuxt/dist/0.nuxt.bundle.167f644ccb03fd653411.js
opt/app/.nuxt/dist/1.nuxt.bundle.dbbab3b729d6edd6dcf9.js
opt/app/.nuxt/dist/0.nuxt.bundle.cabb8e44fef2f7294b40.js
opt/app/.nuxt/dist/1.nuxt.bundle.bbbffbc78054dc5f0891.js
opt/app/.nuxt/dist/index.html
opt/app/.nuxt/dist/manifest.1cb5288f1432e027da47.js
opt/app/.nuxt/dist/nuxt.bundle.ae61936ddd6a7ca46365.js
opt/app/.nuxt/dist/manifest.a99b97d9c9bc251323e7.js
opt/app/.nuxt/dist/nuxt.bundle.dbf51a8ed53569a6c1b0.js
opt/app/.nuxt/dist/server-bundle.json
opt/app/.nuxt/dist/vendor.bundle.1cb5288f1432e027da47.js
opt/app/.nuxt/dist/vendor.bundle.a99b97d9c9bc251323e7.js
opt/app/.sandstorm/launcher.sh
opt/app/Caddyfile
opt/app/README.md
opt/app/commit-on-save
opt/app/node_modules/.bin/babel-node
opt/app/node_modules/accepts/index.js
opt/app/node_modules/accepts/package.json

View File

@ -21,7 +21,7 @@ const pkgdef :Spk.PackageDefinition = (
appVersion = 4, # Increment this for every release.
appMarketingVersion = (defaultText = "0.68.3-sandstorm3"),
appMarketingVersion = (defaultText = "0.69.0-sandstorm"),
# Human-readable representation of appVersion. Should match the way you
# identify versions of your app in documentation and marketing.

View File

@ -5,7 +5,7 @@
set -euo pipefail
export HUGO_VERSION=0.68.3
export HUGO_VERSION=0.69.0
export NODE_VERSION=10
apt-get update
@ -19,24 +19,18 @@ if [ ! -e /usr/local/bin/capnp ] ; then
cd /tmp
if [ ! -e capnproto ]; then git clone https://github.com/capnproto/capnproto; fi
cd capnproto
#git checkout master
git checkout master
cd c++
make clean || true
autoreconf -i
./configure
make -j2
sudo make install
fi
rm /opt/app/sandstorm-integration/getPublicId || true
rm -Rf /opt/app/sandstorm-integration/tmp || true
# Second, compile the small C++ program within
# /opt/app/sandstorm-integration.
if [ ! -e /opt/app/sandstorm-integration/getPublicId ] ; then
pushd /opt/app/sandstorm-integration
make clean || true
make
fi

View File

@ -1,3 +1,27 @@
# V0 (2016-10-10)
## V0 (2016-10-10)
* Initial release.
* Initial release.
## 0.69.0 (2020-04-10)
The "I can't stand Hugo 0.20.somethng anymore" release.
### Enhancements
* Upgrade Hugo to 0.69.0
* Remove Caddy & admin interface for now
* This never quite worked right for me and direct support for
Hugo management was [dropped during Caddy 2 development](https://caddy.community/t/new-old-plugin-http-filebrowser/5103).
Bringing back Caddy would require a bit more work than I'm able to put into
it for this release.
* Update NodeJS to 10 and `yarn upgrade` all transitive dependencies
### Workarounds
* For some reason the `getPublicId` script causes some part of Cap'n Proto to
crash the grain when executed, specifically as the script is exiting.
I've tried everything I know to have it not do that, but ended up with a
terrible workaround: capture the stdout of the script to a file as it
executes and memoize the output based on the session ID parameter.
For my single-person Sandstorm server, this seems fine. I would love help
figuring this out.

View File

@ -1,9 +0,0 @@
127.0.0.1:8001 {
root /var/git
}
errors stderr
log stdout
hugo /var/git {
allow_commands false
after_save "/opt/app/commit-on-save {path}"
}

View File

@ -1,34 +1,36 @@
Hugo Sandstorm package
===========================
# Hugo Sandstorm package
This is the [Sandstorm](https://sandstorm.io) package of [Hugo](https://gohugo.io/).
The version of Hugo in this build is 0.68.3.
![Hugo screenshot](.sandstorm/app-graphics/screenshot2.png "Hugo administration view in Sandstorm")
## Development
# How to
The package is done with [vagrant-spk](https://github.com/sandstorm-io/vagrant-spk), a tool designed to help app developers package apps for [Sandstorm](https://sandstorm.io).
The package is built with [vagrant-spk](https://github.com/sandstorm-io/vagrant-spk),
a tool designed to help app developers package apps for [Sandstorm](https://sandstorm.io).
You can follow the below mentioned steps to make your own package or to contribute.
## Prerequisites
### Prerequisites
You will need to install:
- [Vagrant](https://www.vagrantup.com/)
- [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
- Git
* [Vagrant](https://www.vagrantup.com/)
* [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
* Git
## Step by Step
```
git clone https://github.com/sandstorm-io/vagrant-spk
git clone https://github.com/ndarilek/hugo-sandstorm
git clone https://github.com/johnbintz/hugo-sandstorm
export PATH=$(pwd)/vagrant-spk:$PATH
cd hugo-sandstorm
vagrant-spk vm up
vagrant-spk dev
```
visit [http://local.sandstorm.io:6080/](http://local.sandstorm.io:6080/) in a web browser
Visit [http://local.sandstorm.io:6080/](http://local.sandstorm.io:6080/) in a web browser.
Note: when you want to fork this repo and create actual app packages for the app store you would need either the original app key or create a new one and make your own version of the app.
Note: when you want to fork this repo and create actual app packages for the app
store you would need either the original app key or
[create a new one and make your own version of the app](https://docs.sandstorm.io/en/latest/developing/publishing-apps/).

View File

@ -1,5 +0,0 @@
#!/bin/sh
cd /var/git
git add $1
git commit $1 -m "Saved $1 via administrative interface."
/var/git/.git/hooks/post-receive

View File

@ -1,3 +1,3 @@
Introducing [Hugo](https://gohugo.io), a new idea for making website creation simple again. Hugo works flexibly with many formats, and is ideal for blogs, docs, portfolios and much more. Hugos speed fosters creativity—it makes building a website fun again.
Enjoy powerful syntax highlighting for a large variety of programming languages with integrated Pygments support. Publish books, manuals, and other complex Asciidoc material with the included Asciidoctor distribution. Updates and themes can be pushed directly to an embedded Git repository, or can be edited via a web-based administrative interface.
Enjoy powerful syntax highlighting for a large variety of programming languages with integrated Pygments support. Publish books, manuals, and other complex Asciidoc material with the included Asciidoctor distribution. Updates and themes are pushed directly to an embedded Git repository.

View File

@ -1,28 +1,41 @@
<template>
<div>
<p>Your public site is available at <a :href="url" target="_blank">{{ url }}</a>.</p>
<div v-if="!isDemo">
<p>To set up your domain to point at your public site, add the following DNS records to your domain. Replace <code>blog.example.com</code> with your site's hostname.</p>
<table>
<thead>
<th>Name</th>
<th>Type</th>
<th>Value</th>
</thead>
<tbody>
<tr>
<td>blog.example.com</td>
<td>CNAME</td>
<td>{{ domain }}</td>
</tr>
<tr>
<td>sandstorm-www.blog.example.com</td>
<td>TXT</td>
<td>{{ publicId }}</td>
</tr>
</tbody>
</table>
</div>
<template v-if="isLoading">
<p>
Loading public site information...
</p>
</template>
<template v-else-if="loadError">
<p>
Unable to load public site information! Try restarting the grain.
This is a known bug.
</p>
</template>
<template v-else>
<p>Your public site is available at <a :href="url" target="_blank">{{ url }}</a>.</p>
<div v-if="!isDemo">
<p>To set up your domain to point at your public site, add the following DNS records to your domain. Replace <code>blog.example.com</code> with your site's hostname.</p>
<table>
<thead>
<th>Name</th>
<th>Type</th>
<th>Value</th>
</thead>
<tbody>
<tr>
<td>blog.example.com</td>
<td>CNAME</td>
<td>{{ domain }}</td>
</tr>
<tr>
<td>sandstorm-www.blog.example.com</td>
<td>TXT</td>
<td>{{ publicId }}</td>
</tr>
</tbody>
</table>
</div>
</template>
<h2>Editing Your Site</h2>
<p>To check out the Git repository containing your site, first add an authorization key to Git:</p>
<render-template
@ -56,7 +69,9 @@
isDemo: true,
url: "",
domain: "",
publicId: ""
publicId: "",
isLoading: true,
loadError: null
}),
computed: {
gitHost: () => {
@ -72,17 +87,25 @@
return ""
}
},
mounted() {
fetch("/publicId", {
credentials: "same-origin"
}).then((r) => r.json())
.then((r) => {
this.isDemo = r.isDemo
this.url = r.url
this.publicId = r.publicId
this.domain = r.domain
})
.catch(console.error)
// mounted actions occur immediately. we use async here to
// 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
}
},
head: {
title: "Home"

View File

@ -1,75 +0,0 @@
// Sandstorm - Personal Cloud Sandbox
// Copyright (c) 2014 Sandstorm Development Group, Inc. and contributors
//
// Hack around stdlib bug with C++14.
#include <initializer_list> // force libstdc++ to include its config
#undef _GLIBCXX_HAVE_GETS // correct broken config
// End hack.
#include <kj/main.h>
#include <kj/debug.h>
#include <kj/async-io.h>
#include <kj/async-unix.h>
#include <kj/io.h>
#include <capnp/rpc-twoparty.h>
#include <capnp/rpc.capnp.h>
#include <capnp/ez-rpc.h>
#include <sandstorm/sandstorm-http-bridge.capnp.h>
#include <unistd.h>
#include <sandstorm/hack-session.capnp.h>
namespace sandstorm {
class GetPublicIdMain {
public:
GetPublicIdMain(kj::ProcessContext& context): context(context) { }
kj::MainFunc getMain() {
return kj::MainBuilder(context, "GetPublicId version: 0.0.2",
"Runs the getPublicId command from hack-session.capnp. "
"Outputs the return arguments as separate lines on stdout.")
.expectArg("<sessionId>", KJ_BIND_METHOD(*this, setSessionId))
.callAfterParsing(KJ_BIND_METHOD(*this, run))
.build();
}
kj::MainBuilder::Validity setSessionId(kj::StringPtr id) {
sessionId = kj::heapString(id);
return true;
}
kj::MainBuilder::Validity run() {
capnp::EzRpcClient client("unix:/tmp/sandstorm-api");
SandstormHttpBridge::Client restorer = client.getMain<SandstormHttpBridge>();
auto request = restorer.getSessionContextRequest();
request.setId(sessionId);
auto session = request.send().getContext().castAs<HackSessionContext>();
kj::Promise<void> promise = session.getPublicIdRequest().send().then([](auto result) {
auto publicId = result.getPublicId();
auto hostname = result.getHostname();
auto autoUrl = result.getAutoUrl();
auto isDemoUser = result.getIsDemoUser();
kj::String msg = kj::str(publicId, "\n", hostname, "\n", autoUrl, "\n",
isDemoUser ? "true" : "false", "\n");
kj::FdOutputStream(STDOUT_FILENO).write(msg.begin(), msg.size());
}, [] (auto e) {
auto desc = e.getDescription();
kj::FdOutputStream(STDOUT_FILENO).write(desc.begin(), desc.size());
});
promise.wait(client.getWaitScope());
return true;
}
private:
kj::ProcessContext& context;
kj::String sessionId;
};
} // namespace sandstorm
KJ_MAIN(sandstorm::GetPublicIdMain)

View File

@ -1,83 +0,0 @@
// Sandstorm - Personal Cloud Sandbox
// Copyright (c) 2014 Sandstorm Development Group, Inc. and contributors
//
// Hack around stdlib bug with C++14.
#include <initializer_list> // force libstdc++ to include its config
#undef _GLIBCXX_HAVE_GETS // correct broken config
// End hack.
#include <kj/main.h>
#include <kj/debug.h>
#include <kj/async-io.h>
#include <kj/async-unix.h>
#include <kj/io.h>
#include <capnp/rpc-twoparty.h>
#include <capnp/rpc.capnp.h>
#include <capnp/ez-rpc.h>
#include <sandstorm/sandstorm-http-bridge.capnp.h>
#include <unistd.h>
#include <sandstorm/hack-session.capnp.h>
namespace sandstorm {
class GetPublicIdMain {
public:
GetPublicIdMain(kj::ProcessContext& context): context(context) { }
kj::MainFunc getMain() {
return kj::MainBuilder(context, "GetPublicId version: 0.0.2",
"Runs the getPublicId command from hack-session.capnp. "
"Returns the ID and the host name as two lines on stdout.")
.expectArg("<sessionId>", KJ_BIND_METHOD(*this, setSessionId))
.callAfterParsing(KJ_BIND_METHOD(*this, run))
.build();
}
kj::MainBuilder::Validity setSessionId(kj::StringPtr id) {
sessionId = kj::heapString(id);
return true;
}
kj::MainBuilder::Validity run() {
capnp::EzRpcClient client("unix:/tmp/sandstorm-api");
SandstormHttpBridge::Client restorer = client.getMain<SandstormHttpBridge>();
auto request = restorer.getSessionContextRequest();
request.setId(sessionId);
auto session = request.send().getContext().castAs<HackSessionContext>();
kj::Promise<void> promise = session.getPublicIdRequest().send().then(
[](HackSessionContext::GetPublicIdResults::Reader result) {
auto publicId = result.getPublicId();
auto hostname = result.getHostname();
auto autoUrl = result.getAutoUrl();
kj::String msg =
kj::str(
"Your content has automatically been published at\n",
" ", autoUrl, "\n",
"You can show this content on a custom domain by adding the following\n"
"DNS records:\n"
" <host> IN CNAME ", hostname, "\n"
" sandstorm-www.<host> IN TXT ", publicId, "\n");
kj::FdOutputStream(STDOUT_FILENO).write(msg.begin(), msg.size());
}, [] (kj::Exception&& e) {
auto desc = e.getDescription();
kj::FdOutputStream(STDOUT_FILENO).write(desc.begin(), desc.size());
});
promise.wait(client.getWaitScope());
return true;
}
private:
kj::ProcessContext& context;
kj::String sessionId;
};
} // namespace sandstorm
KJ_MAIN(sandstorm::GetPublicIdMain)