From dc1b9858b880d802cf54d568599607dd65bc3d39 Mon Sep 17 00:00:00 2001 From: "marius a. eriksen" Date: Wed, 13 Nov 2019 12:08:32 -0800 Subject: [PATCH 1/4] support go11x runtimes The old runtimes are no longer supported, and App Engine does not permit creating or updating go1 projects. This change introduces support of the go111 runtime. Newer runtimes no longer support login: handlers. --- README.md | 2 +- app.yaml | 8 +++----- tiddly.go | 44 ++++++++++++++++++++++++++++++-------------- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index a11695e..2699356 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,7 @@ tiddler content on demand. Create an Google App Engine standard app and deploy with - appcfg.py -A your-app -V your-version update . + gcloud --project=your-app app deploy Then visit https://your-app.appspot.com/. As noted above, only admins will have access to the content. diff --git a/app.yaml b/app.yaml index 89f56fe..35dbbf4 100644 --- a/app.yaml +++ b/app.yaml @@ -1,10 +1,8 @@ -application: tiddlywiki-gae -version: 2016-12-22 -runtime: go -api_version: go1 +# go112+ doesn't support login: handlers +runtime: go111 handlers: - url: /.* login: admin secure: always - script: _go_app + script: auto diff --git a/tiddly.go b/tiddly.go index 3803576..2e67a1c 100644 --- a/tiddly.go +++ b/tiddly.go @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. -package tiddly +package main import ( "bytes" @@ -10,8 +10,10 @@ import ( "encoding/json" "fmt" "io/ioutil" + "log" "net/http" "net/url" + "os" "strings" "google.golang.org/appengine" @@ -58,15 +60,6 @@ import ( // in the wiki. It seems like the TiddlyWeb plugin or the core syncer module // would need changes to understand a new "read-only" mode. -func init() { - http.HandleFunc("/", authCheck(main)) - http.HandleFunc("/auth", authCheck(auth)) - http.HandleFunc("/status", authCheck(status)) - http.HandleFunc("/recipes/all/tiddlers/", authCheck(tiddler)) - http.HandleFunc("/recipes/all/tiddlers.json", authCheck(tiddlerList)) - http.HandleFunc("/bags/bag/tiddlers/", authCheck(deleteTiddler)) -} - func authCheck(f http.HandlerFunc) http.HandlerFunc { return func(w http.ResponseWriter, r *http.Request) { if !mustBeAdmin(w, r) { @@ -87,12 +80,35 @@ func mustBeAdmin(w http.ResponseWriter, r *http.Request) bool { } type Tiddler struct { - Rev int `datastore:"Rev,noindex"` - Meta string `datastore:"Meta,noindex"` - Text string `datastore:"Text,noindex"` + Rev int `datastore:"Rev,noindex"` + Meta string `datastore:"Meta,noindex"` + Text string `datastore:"Text,noindex"` + Tags []string `datastore:"Tags",noindex` +} + +func main() { + http.HandleFunc("/", authCheck(index)) + http.HandleFunc("/auth", authCheck(auth)) + http.HandleFunc("/status", authCheck(status)) + http.HandleFunc("/recipes/all/tiddlers/", authCheck(tiddler)) + http.HandleFunc("/recipes/all/tiddlers.json", authCheck(tiddlerList)) + http.HandleFunc("/bags/bag/tiddlers/", authCheck(deleteTiddler)) + + port := os.Getenv("PORT") + if port == "" { + port = "8080" + log.Printf("Defaulting to port %s", port) + } + + appengine.Main() + + log.Printf("Listening on port %s", port) + if err := http.ListenAndServe(":"+port, nil); err != nil { + log.Fatal(err) + } } -func main(w http.ResponseWriter, r *http.Request) { +func index(w http.ResponseWriter, r *http.Request) { if r.Method != "GET" { http.Error(w, "bad method", 405) return From eed6f013f499306cb1929dd6b81aba474d371df4 Mon Sep 17 00:00:00 2001 From: "marius a. eriksen" Date: Thu, 14 Nov 2019 09:34:18 -0800 Subject: [PATCH 2/4] tiddlywiki: upgrade to 5.1.21 --- README.md | 6 +- index.html | 4243 +++++++++++++++++++++++++++++++++++++++++----------- 2 files changed, 3414 insertions(+), 835 deletions(-) diff --git a/README.md b/README.md index a11695e..a213a88 100644 --- a/README.md +++ b/README.md @@ -77,16 +77,16 @@ propagate to the other. ## TiddlyWiki base image The TiddlyWiki code is stored in and served from index.html, which -(as you can see by clicking on the Tools tab) is TiddlyWiki version 5.1.13. +(as you can see by clicking on the Tools tab) is TiddlyWiki version 5.1.21. Plugins must be pre-baked into the TiddlyWiki file, not stored on the server -as lazily loaded Tiddlers. The index.html in this directory is 5.1.13 with +as lazily loaded Tiddlers. The index.html in this directory is 5.1.21 with the TiddlyWeb and Markdown plugins added. The TiddlyWeb plugin is required, so that index.html talks back to the server for content. The process for preparing a new index.html is: -- Open tiddlywiki-5.1.13.html in your web browser. +- Open tiddlywiki-5.1.21.html in your web browser. - Click the control panel (gear) icon. - Click the Plugins tab. - Click "Get more plugins". diff --git a/index.html b/index.html index fc36056..3cf8e16 100644 --- a/index.html +++ b/index.html @@ -1,13 +1,16 @@ + - + - + + + - + @@ -15,40 +18,46 @@ +Copyright (c) 2004-2007, Jeremy Ruston +Copyright (c) 2007-2018, UnaMesa Association +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 'AS IS' +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." /> My TiddlyWiki — a non-linear personal web notebook - + + + + + + +