From 8c400e0ee2403da18afe671de2dd801fb729151b Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Mon, 26 Nov 2018 18:32:18 +0100 Subject: [PATCH 01/19] Also use bind address on standalone redirect --- app.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app.go b/app.go index 90193990..96c610b5 100644 --- a/app.go +++ b/app.go @@ -409,11 +409,12 @@ func Serve() { bindAddress = "localhost" } if app.cfg.IsSecureStandalone() { - log.Info("Serving redirects on http://localhost:80") + log.Info("Serving redirects on http://%s:80", bindAddress) go func() { - err = http.ListenAndServe(":80", http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - http.Redirect(w, r, app.cfg.App.Host, http.StatusMovedPermanently) - })) + err = http.ListenAndServe( + fmt.Sprintf("%s:80", bindAddress), http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + http.Redirect(w, r, app.cfg.App.Host, http.StatusMovedPermanently) + })) log.Error("Unable to start redirect server: %v", err) }() From 63d60f73929afed67ec412811099b5262b64ab8b Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Thu, 29 Nov 2018 21:27:51 +0100 Subject: [PATCH 02/19] Add support for custom aliasmap This is probably too specific for general use --- templates/include/post-render.tmpl | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/templates/include/post-render.tmpl b/templates/include/post-render.tmpl index 7079ccd3..81afd7aa 100644 --- a/templates/include/post-render.tmpl +++ b/templates/include/post-render.tmpl @@ -12,10 +12,20 @@ "markdown", "nginx", "objectivec", "perl", "php", "properties", "python", "ruby", "shell", "sql"]; + // Custom aliasmap + var aliasmap = { + 'elisp' :'lisp','emacs-lisp': 'lisp', + 'sh' : 'bash'}; + // Given a set of nodes, run highlighting on them function highlight(nodes) { for (i=0; i < nodes.length; i++) { - hljs.highlightBlock(nodes[i]); + lang = nodes[i].className.replace('language-',''); + if (aliasmap[lang]) { + lo = hljs.getLanguage(aliasmap[lang]); + hljs.registerLanguage(lang, function() {return lo;}); + } + hljs.highlightBlock(nodes[i]); } } @@ -44,12 +54,16 @@ // Check what we need to load for (i=0; i < lb.length; i++) { lang = lb[i].className.replace('language-',''); + + // Support a couple specific aliases + if(aliasmap[lang]) lang = aliasmap[lang]; + lurl = hlbaseUri + "languages/" + lang + ".min.js"; if (!(langs.includes(lang) || jss.includes(lurl))) { jss.push(lurl); } } - // Load files in order, higlight on last load + // Load files in order, highlight on last load loadLanguages(jss, () => {highlight(lb)}); } }); From dbd957c090f4742c8c9d1e223889ef65e9b929db Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Sat, 1 Dec 2018 23:19:53 +0100 Subject: [PATCH 03/19] Require hashtags to have 2 spaces around them to be rendered --- postrender.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/postrender.go b/postrender.go index f739bdcc..681a4937 100644 --- a/postrender.go +++ b/postrender.go @@ -21,7 +21,7 @@ var ( endBlockReg = regexp.MustCompile("\n") youtubeReg = regexp.MustCompile("(https?://www.youtube.com/embed/[a-zA-Z0-9\\-_]+)(\\?[^\t\n\f\r \"']+)?") titleElementReg = regexp.MustCompile("") - hashtagReg = regexp.MustCompile(`#([\p{L}\p{M}\d]+)`) + hashtagReg = regexp.MustCompile(` #([\p{L}\p{M}\d]+) `) markeddownReg = regexp.MustCompile("

(.+)

") ) @@ -36,8 +36,8 @@ func (p *Post) formatContent(c *Collection, isOwner bool) { // URL, so we rely on p.Tags as the final word on whether or not to link // a tag. for _, t := range p.Tags { - if string(b) == "#"+t { - return bytes.Replace(b, []byte("#"+t), []byte("#"+t+""), -1) + if string(b) == " #"+t+" " { + return bytes.Replace(b, []byte(" #"+t+" "), []byte(" #"+t+" "), -1) } } return b From c703865cfb42e38a1152644570517a2bca8cd470 Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Tue, 2 Jul 2019 09:23:34 +0200 Subject: [PATCH 04/19] Make sure we do not depend on case when loading language files --- templates/include/post-render.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/include/post-render.tmpl b/templates/include/post-render.tmpl index 97d44dfe..fe9a7e74 100644 --- a/templates/include/post-render.tmpl +++ b/templates/include/post-render.tmpl @@ -26,7 +26,7 @@ // Given a set of nodes, run highlighting on them function highlight(nodes) { for (i=0; i < nodes.length; i++) { - lang = nodes[i].className.replace('language-',''); + lang = toLowerCase(nodes[i].className.replace('language-','')); if (aliasmap[lang]) { lo = hljs.getLanguage(aliasmap[lang]); hljs.registerLanguage(lang, function() {return lo;}); @@ -64,7 +64,7 @@ var jss = [hlbaseUri + "highlight.min.js"]; // Check what we need to load for (i=0; i < lb.length; i++) { - lang = lb[i].className.replace('language-',''); + lang = toLowerCase(lb[i].className.replace('language-','')); // Support the aliases specified above if (aliasmap[lang]) lang = aliasmap[lang]; From 7dee66e235c04fd0e3232cced4efc0de9deb5ee7 Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Tue, 2 Jul 2019 09:29:02 +0200 Subject: [PATCH 05/19] Correct toLowerCase invocation --- templates/include/post-render.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/include/post-render.tmpl b/templates/include/post-render.tmpl index fe9a7e74..f8986ff3 100644 --- a/templates/include/post-render.tmpl +++ b/templates/include/post-render.tmpl @@ -26,7 +26,7 @@ // Given a set of nodes, run highlighting on them function highlight(nodes) { for (i=0; i < nodes.length; i++) { - lang = toLowerCase(nodes[i].className.replace('language-','')); + lang = nodes[i].className.replace('language-','').toLowerCase(); if (aliasmap[lang]) { lo = hljs.getLanguage(aliasmap[lang]); hljs.registerLanguage(lang, function() {return lo;}); @@ -64,7 +64,7 @@ var jss = [hlbaseUri + "highlight.min.js"]; // Check what we need to load for (i=0; i < lb.length; i++) { - lang = toLowerCase(lb[i].className.replace('language-','')); + lang = lb[i].className.replace('language-','').toLowerCase(); // Support the aliases specified above if (aliasmap[lang]) lang = aliasmap[lang]; From 574e2db4b1e16d589ab20301e899e0a79a3ddc6f Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Tue, 2 Jul 2019 10:06:57 +0200 Subject: [PATCH 06/19] Sync up with upstream functionally + consistent lambda use with => + consistent forEach use + tabs -> spaces --- templates/include/post-render.tmpl | 91 ++++++++++++++---------------- 1 file changed, 42 insertions(+), 49 deletions(-) diff --git a/templates/include/post-render.tmpl b/templates/include/post-render.tmpl index f8986ff3..ae84d589 100644 --- a/templates/include/post-render.tmpl +++ b/templates/include/post-render.tmpl @@ -22,17 +22,10 @@ "cxx" : "cpp", "sh" : "bash" }; - + // Given a set of nodes, run highlighting on them function highlight(nodes) { - for (i=0; i < nodes.length; i++) { - lang = nodes[i].className.replace('language-','').toLowerCase(); - if (aliasmap[lang]) { - lo = hljs.getLanguage(aliasmap[lang]); - hljs.registerLanguage(lang, function() {return lo;}); - } - hljs.highlightBlock(nodes[i]); - } + nodes.forEach(node => { hljs.highlightBlock(node); }); } // Given a array of URIs, load them in order @@ -41,11 +34,11 @@ var sc = document.createElement('script'); sc.src = uri; sc.async = false; // critical? - // Set callback on last script + // Set callback on last script if (uris.indexOf(uri) == uris.length-1) { - // Set callback regardless - // so we're sure it will run if last element had error - // (we only know after loading, so we've had load time already) + // Set callback regardless + // so we're sure it will run if last element had error + // (we only know after loading, so we've had load time already) sc.onload = callback; sc.onerror = callback; } document.head.appendChild(sc); @@ -54,45 +47,45 @@ // We don't have to do anything if there are no language blocks if (lb.length > 0) { - // We have blocks to be highlighted, so we load css - var st = document.createElement('link'); - st.rel = "stylesheet"; - st.href = "/css/lib/atom-one-light.min.css"; - document.head.appendChild(st); + // We have blocks to be highlighted, so we load css + var st = document.createElement('link'); + st.rel = "stylesheet"; + st.href = "/css/lib/atom-one-light.min.css"; + document.head.appendChild(st); - // Construct set of files to load, in order - var jss = [hlbaseUri + "highlight.min.js"]; - // Check what we need to load - for (i=0; i < lb.length; i++) { - lang = lb[i].className.replace('language-','').toLowerCase(); + // Construct set of files to load, in order + var jss = [hlbaseUri + "highlight.min.js"]; + // Check what we need to load + lb.forEach(block => { + lang = block.className.replace('language-','').toLowerCase(); - // Support the aliases specified above - if (aliasmap[lang]) lang = aliasmap[lang]; - lurl = hlbaseUri + "highlightjs/" + lang + ".min.js"; - if (!jss.includes(lurl)) { - jss.push(lurl); - } - } - // Load files in order, highlight on last load - loadLanguages(jss, () => {highlight(lb)}); + // Support the aliases specified above + if (aliasmap[lang]) lang = aliasmap[lang]; + lurl = hlbaseUri + "highlightjs/" + lang + ".min.js"; + if (!jss.includes(lurl)) { + jss.push(lurl); + } + }); + // Load files in order, highlight on last load + loadLanguages(jss, () => {highlight(lb)}); } - }); +}); -{{end}} + {{end}} - -{{define "mathjax"}} - - -{{end}} + + {{end}} From 80b75543d7aafabeb01798c323c4f84725678e2f Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Mon, 26 Aug 2019 17:03:49 +0200 Subject: [PATCH 07/19] Add mastodon admin contact, so it can be verified --- templates/include/footer.tmpl | 1 + 1 file changed, 1 insertion(+) diff --git a/templates/include/footer.tmpl b/templates/include/footer.tmpl index 16434b9c..cebfdabf 100644 --- a/templates/include/footer.tmpl +++ b/templates/include/footer.tmpl @@ -26,6 +26,7 @@
  • about
  • {{if and (and (not .SingleUser) .LocalTimeline) .CanViewReader}}reader{{end}}
  • privacy
  • +
  • Admin contact
  • From a51169e8ba54a3ef75c5515a533b14d730fc4e64 Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Fri, 25 Oct 2019 12:25:57 +0200 Subject: [PATCH 08/19] Make sure aliased languages render For now, set the classname of the block to the native language. --- templates/include/post-render.tmpl | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/include/post-render.tmpl b/templates/include/post-render.tmpl index ae84d589..0e184f8f 100644 --- a/templates/include/post-render.tmpl +++ b/templates/include/post-render.tmpl @@ -59,8 +59,9 @@ lb.forEach(block => { lang = block.className.replace('language-','').toLowerCase(); - // Support the aliases specified above + // Support the aliases specified above, make sure the block has the non-alias class if (aliasmap[lang]) lang = aliasmap[lang]; + block.className = 'language-' + lang; lurl = hlbaseUri + "highlightjs/" + lang + ".min.js"; if (!jss.includes(lurl)) { jss.push(lurl); From 9f12d0a6b0f5a29b1535395ec6c9646871593028 Mon Sep 17 00:00:00 2001 From: Matt Baer Date: Sat, 7 Dec 2019 09:06:31 -0500 Subject: [PATCH 09/19] Fix broken password-collection template Fixed "user-supsended" to "user-suspended" --- templates/password-collection.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/password-collection.tmpl b/templates/password-collection.tmpl index 73c44653..66a3befd 100644 --- a/templates/password-collection.tmpl +++ b/templates/password-collection.tmpl @@ -26,7 +26,7 @@ {{if .Suspended}} - {{template "user-supsended"}} + {{template "user-suspended"}} {{end}}

    {{.DisplayTitle}}

    From 49effe4d901755f82e9f832bca026c2d0b54cae5 Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Thu, 30 Jan 2020 09:34:25 +0100 Subject: [PATCH 10/19] Additional date munging related to upstream/fix-local-datetime --- templates/read.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/read.tmpl b/templates/read.tmpl index 7b43995b..ddcccddb 100644 --- a/templates/read.tmpl +++ b/templates/read.tmpl @@ -88,9 +88,9 @@
    {{range .Posts}}
    {{if .Title.String}}

    - + {{else}} -

    +

    {{end}}

    {{if .Collection}}from {{.Collection.DisplayTitle}}{{else}}Anonymous{{end}}

    {{if .Excerpt}}
    {{.Excerpt}}
    From ac921f9f4bac16683345f1aad637fbb24846a046 Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Tue, 4 Aug 2020 13:48:59 +0200 Subject: [PATCH 11/19] Add user silencing to CLI interface --- app.go | 45 +++++++++++++++++++++++++++++++++++++++++ cmd/writefreely/main.go | 7 +++++++ cmd/writefreely/user.go | 19 +++++++++++++++++ database.go | 28 +++++++++++++++++++++++++ 4 files changed, 99 insertions(+) diff --git a/app.go b/app.go index 2ba43fcf..5fd926b0 100644 --- a/app.go +++ b/app.go @@ -747,6 +747,51 @@ func DoDeleteAccount(apper Apper, username string) error { return nil } +func DoSilenceAccount(apper Apper, username string) error { + // Connect to the database + apper.LoadConfig() + connectToDatabase(apper.App()) + defer shutdown(apper.App()) + + // check user exists + u, err := apper.App().db.GetUserForAuth(username) + if err != nil { + log.Error("%s", err) + os.Exit(1) + } + userID := u.ID + + // do not silence the admin account + // TODO: check for other admins and skip? + if u.IsAdmin() { + log.Error("Can not silence admin account") + os.Exit(1) + } + + // confirm deletion, w/ w/out posts + prompt := promptui.Prompt{ + Templates: &promptui.PromptTemplates{ + Success: "{{ . | bold | faint }}: ", + }, + Label: fmt.Sprintf("Really silence user : %s", username), + IsConfirm: true, + } + _, err = prompt.Run() + if err != nil { + log.Info("Aborted...") + os.Exit(0) + } + + log.Info("Silencing...") + err = apper.App().db.SilenceAccount(userID) + if err != nil { + log.Error("%s", err) + os.Exit(1) + } + log.Info("Success.") + return nil +} + func connectToDatabase(app *App) { log.Info("Connecting to %s database...", app.cfg.Database.Type) diff --git a/cmd/writefreely/main.go b/cmd/writefreely/main.go index 45dfb800..d424dd84 100644 --- a/cmd/writefreely/main.go +++ b/cmd/writefreely/main.go @@ -85,6 +85,11 @@ func main() { Usage: "Delete a user with the given username", Hidden: true, }, + &cli.StringFlag{ + Name: "silence-user", + Usage: "Silence a user with the given username", + Hidden: true, + }, &cli.StringFlag{ Name: "reset-pass", Usage: "Reset the given user's password", @@ -152,6 +157,8 @@ func legacyActions(c *cli.Context) error { return writefreely.CreateUser(app, username, password, false) case c.IsSet("delete-user"): return writefreely.DoDeleteAccount(app, c.String("delete-user")) + case c.IsSet("silence-user"): + return writefreely.DoSilenceAccount(app, c.String("silence-user")) case c.IsSet("reset-pass"): return writefreely.ResetPassword(app, c.String("reset-pass")) } diff --git a/cmd/writefreely/user.go b/cmd/writefreely/user.go index 58ecbfbe..ff1ceae1 100644 --- a/cmd/writefreely/user.go +++ b/cmd/writefreely/user.go @@ -25,6 +25,7 @@ var ( Subcommands: []*cli.Command{ &cmdAddUser, &cmdDelUser, + &cmdSilenceUser, &cmdResetPass, // TODO: possibly add a user list command }, @@ -51,6 +52,13 @@ var ( Action: delUserAction, } + cmdSilenceUser cli.Command = cli.Command{ + Name: "silence", + Usage: "Silence user", + Aliases: []string{"sil", "s"}, + Action: silenceUserAction, + } + cmdResetPass cli.Command = cli.Command{ Name: "reset-pass", Usage: "Reset user's password", @@ -85,6 +93,17 @@ func delUserAction(c *cli.Context) error { return writefreely.DoDeleteAccount(app, username) } +func silenceUserAction(c *cli.Context) error { + username := "" + if c.NArg() > 0 { + username = c.Args().Get(0) + } else { + return fmt.Errorf("No user passed. Example: writefreely user silence [USER]") + } + app := writefreely.NewApp(c.String("c")) + return writefreely.DoSilenceAccount(app, username) +} + func resetPassAction(c *cli.Context) error { username := "" if c.NArg() > 0 { diff --git a/database.go b/database.go index 6f97d8cd..bd06d852 100644 --- a/database.go +++ b/database.go @@ -68,6 +68,7 @@ type writestore interface { GetTemporaryAccessToken(userID int64, validSecs int) (string, error) GetTemporaryOneTimeAccessToken(userID int64, validSecs int, oneTime bool) (string, error) DeleteAccount(userID int64) error + SilenceAccount(userID int64) error ChangeSettings(app *App, u *User, s *userSettings) error ChangePassphrase(userID int64, sudo bool, curPass string, hashedPass []byte) error @@ -2329,6 +2330,33 @@ func (db *datastore) DeleteAccount(userID int64) error { return nil } +func (db *datastore) SilenceAccount(userID int64) error { + // Start transaction + t, err := db.Begin() + if err != nil { + log.Error("Unable to begin: %v", err) + return err + } + + // Update user state + _, err = t.Exec("UPDATE users SET state=1 WHERE id=?", userID) + if err != nil { + t.Rollback() + return fmt.Errorf("Unable to update user state: %s", err) + } + + // Commit all changes to the database + err = t.Commit() + if err != nil { + t.Rollback() + log.Error("Unable to commit: %v", err) + return err + } + + // TODO: federate delete actor here too? + return nil +} + func (db *datastore) GetAPActorKeys(collectionID int64) ([]byte, []byte) { var pub, priv []byte err := db.QueryRow("SELECT public_key, private_key FROM collectionkeys WHERE collection_id = ?", collectionID).Scan(&pub, &priv) From 3979a4876cd1d4899cf91d026891bd36055f9e00 Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Tue, 4 Aug 2020 13:54:40 +0200 Subject: [PATCH 12/19] Column is named status, not state --- database.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/database.go b/database.go index bd06d852..e2847738 100644 --- a/database.go +++ b/database.go @@ -2339,10 +2339,10 @@ func (db *datastore) SilenceAccount(userID int64) error { } // Update user state - _, err = t.Exec("UPDATE users SET state=1 WHERE id=?", userID) + _, err = t.Exec("UPDATE users SET status=1 WHERE id=?", userID) if err != nil { t.Rollback() - return fmt.Errorf("Unable to update user state: %s", err) + return fmt.Errorf("Unable to update user status: %s", err) } // Commit all changes to the database From 12514f50febb1fcb02e60ebe89752424c1086777 Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Sat, 9 Jan 2021 15:59:40 +0100 Subject: [PATCH 13/19] Use newer mixin syntax for less 4.x compatibility See https://github.com/less/less.js/releases/tag/v4.0.0 This syntax also works with less 3.x --- less/core.less | 10 +++++----- less/pad-theme.less | 10 +++++----- less/pad.less | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/less/core.less b/less/core.less index b0852412..82952608 100644 --- a/less/core.less +++ b/less/core.less @@ -77,7 +77,7 @@ body { margin-bottom: -0.5rem; } h2#title { - .article-title; + .article-title() {}; } h1 { font-size: 1.5em; @@ -108,7 +108,7 @@ body { &#post, &#collection, &#subpage { code { - .article-code; + .article-code() {}; } img, video, audio { max-width: 100%; @@ -118,7 +118,7 @@ body { white-space: initial; } pre { - .code-block; + .code-block() {}; code { background: transparent; @@ -133,7 +133,7 @@ body { } } blockquote { - .article-blockquote; + .article-blockquote() {}; } article { hr { @@ -516,7 +516,7 @@ abbr { } body#collection article p, body#subpage article p { - .article-p; + .article-p() {}; } pre, body#post article, #post .alert, #subpage .alert, body#collection article, body#subpage article, body#subpage #wrapper h1 { max-width: 40rem; diff --git a/less/pad-theme.less b/less/pad-theme.less index a8f668e5..eb46947f 100644 --- a/less/pad-theme.less +++ b/less/pad-theme.less @@ -49,13 +49,13 @@ body#pad-sub #posts, .atoms { } body#pad, body#pad-sub { - .pad-theme-transition; + .pad-theme-transition() {}; &.light { background-color: @lightBG; color: @lightTextColor; #tools { - .pad-theme-transition; + .pad-theme-transition() {}; background-color: transparent; h1 { a { @@ -92,7 +92,7 @@ body#pad, body#pad-sub { background-color: @darkBG; color: @darkTextColor; #tools { - .pad-theme-transition; + .pad-theme-transition() {}; background-color: #262626; h1 { a { @@ -186,10 +186,10 @@ body#pad, body#pad-sub { } body#pad { - .pad-theme-transition; + .pad-theme-transition() {}; textarea { - .pad-theme-transition; + .pad-theme-transition() {}; } &.dark { diff --git a/less/pad.less b/less/pad.less index 91c002d1..57d50d4d 100644 --- a/less/pad.less +++ b/less/pad.less @@ -91,7 +91,7 @@ } } nav#manage { - .dropdown-nav; + .dropdown-nav() {}; ul ul li { min-width: 11em; img.ic-18dp { @@ -160,7 +160,7 @@ body#pad, body#pad-sub { } nav { - .dropdown-nav; + .dropdown-nav() {}; } #clip { From 4425804b5ceb50114dfa23cd4fed6a1d52043ea2 Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Fri, 22 Jan 2021 11:31:36 +0100 Subject: [PATCH 14/19] Add specific text for when invitations are enabled --- pages/landing.tmpl | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pages/landing.tmpl b/pages/landing.tmpl index 2131b400..a5b2fd91 100644 --- a/pages/landing.tmpl +++ b/pages/landing.tmpl @@ -107,10 +107,15 @@ form dd {
    {{end}} + {{ else }} + {{ if .UserInvites }} +

    Registration is by invitation.

    +

    Contact us, or an existing user, to get an invite link.

    {{ else }}

    Registration is currently closed.

    You can always sign up on another instance.

    {{ end }} + {{ end }} From 7858c280e483376cde4659b0dcd65a782d27e1e8 Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Sat, 30 Jan 2021 14:00:09 +0100 Subject: [PATCH 15/19] Revert "Use newer mixin syntax for less 4.x compatibility" This reverts commit 12514f50febb1fcb02e60ebe89752424c1086777. --- less/core.less | 10 +++++----- less/pad-theme.less | 10 +++++----- less/pad.less | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/less/core.less b/less/core.less index 82952608..b0852412 100644 --- a/less/core.less +++ b/less/core.less @@ -77,7 +77,7 @@ body { margin-bottom: -0.5rem; } h2#title { - .article-title() {}; + .article-title; } h1 { font-size: 1.5em; @@ -108,7 +108,7 @@ body { &#post, &#collection, &#subpage { code { - .article-code() {}; + .article-code; } img, video, audio { max-width: 100%; @@ -118,7 +118,7 @@ body { white-space: initial; } pre { - .code-block() {}; + .code-block; code { background: transparent; @@ -133,7 +133,7 @@ body { } } blockquote { - .article-blockquote() {}; + .article-blockquote; } article { hr { @@ -516,7 +516,7 @@ abbr { } body#collection article p, body#subpage article p { - .article-p() {}; + .article-p; } pre, body#post article, #post .alert, #subpage .alert, body#collection article, body#subpage article, body#subpage #wrapper h1 { max-width: 40rem; diff --git a/less/pad-theme.less b/less/pad-theme.less index eb46947f..a8f668e5 100644 --- a/less/pad-theme.less +++ b/less/pad-theme.less @@ -49,13 +49,13 @@ body#pad-sub #posts, .atoms { } body#pad, body#pad-sub { - .pad-theme-transition() {}; + .pad-theme-transition; &.light { background-color: @lightBG; color: @lightTextColor; #tools { - .pad-theme-transition() {}; + .pad-theme-transition; background-color: transparent; h1 { a { @@ -92,7 +92,7 @@ body#pad, body#pad-sub { background-color: @darkBG; color: @darkTextColor; #tools { - .pad-theme-transition() {}; + .pad-theme-transition; background-color: #262626; h1 { a { @@ -186,10 +186,10 @@ body#pad, body#pad-sub { } body#pad { - .pad-theme-transition() {}; + .pad-theme-transition; textarea { - .pad-theme-transition() {}; + .pad-theme-transition; } &.dark { diff --git a/less/pad.less b/less/pad.less index 57d50d4d..91c002d1 100644 --- a/less/pad.less +++ b/less/pad.less @@ -91,7 +91,7 @@ } } nav#manage { - .dropdown-nav() {}; + .dropdown-nav; ul ul li { min-width: 11em; img.ic-18dp { @@ -160,7 +160,7 @@ body#pad, body#pad-sub { } nav { - .dropdown-nav() {}; + .dropdown-nav; } #clip { From 6cb0e13a972c8681b9e9bf5c610d6d4ceffb696b Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Mon, 11 Oct 2021 10:57:26 +0200 Subject: [PATCH 16/19] Stray 'n' character, nobody noticed for quite a while Shows how little the stuff is used. --- templates/include/post-render.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/include/post-render.tmpl b/templates/include/post-render.tmpl index 2c93b1bc..5bd2905b 100644 --- a/templates/include/post-render.tmpl +++ b/templates/include/post-render.tmpl @@ -62,7 +62,7 @@ st.href = "/css/lib/atom-one-light.min.css"; document.head.appendChild(st); -n // Construct set of files to load, in order + // Construct set of files to load, in order var jss = [hlbaseUri + "highlight.min.js"]; // Check what we need to load for (i=0; i < lb.length; i++) { From eed278b28e79ae11bc5df4fc07bd9119c70140c9 Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Fri, 25 Oct 2019 12:25:57 +0200 Subject: [PATCH 17/19] Make sure aliased languages render For now, set the classname of the block to the native language. --- templates/include/post-render.tmpl | 2 ++ 1 file changed, 2 insertions(+) diff --git a/templates/include/post-render.tmpl b/templates/include/post-render.tmpl index 5bd2905b..c5a1b979 100644 --- a/templates/include/post-render.tmpl +++ b/templates/include/post-render.tmpl @@ -68,7 +68,9 @@ for (i=0; i < lb.length; i++) { lang = lb[i].className.replace('language-','').toLowerCase(); // Support the aliases specified above + // and make sure the block has the non-aliased name if (aliasmap[lang]) lang = aliasmap[lang]; + block.className = 'language-' + lang; lurl = hlbaseUri + "highlightjs/" + lang + ".min.js"; if (!jss.includes(lurl)) { jss.push(lurl); From bbce653e1f82b1de140bb54a0d6bffe1870985a2 Mon Sep 17 00:00:00 2001 From: Marcel van der Boom Date: Mon, 11 Oct 2021 11:45:04 +0200 Subject: [PATCH 18/19] Fix cherry, block is not the name anymore --- templates/include/post-render.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/include/post-render.tmpl b/templates/include/post-render.tmpl index c5a1b979..56f6cf28 100644 --- a/templates/include/post-render.tmpl +++ b/templates/include/post-render.tmpl @@ -70,7 +70,7 @@ // Support the aliases specified above // and make sure the block has the non-aliased name if (aliasmap[lang]) lang = aliasmap[lang]; - block.className = 'language-' + lang; + lb[i].className = 'language-' + lang; lurl = hlbaseUri + "highlightjs/" + lang + ".min.js"; if (!jss.includes(lurl)) { jss.push(lurl); From 986e1b3f1b94be27df2c2c6266a440759f988f4d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 16 Jan 2023 10:23:59 +0000 Subject: [PATCH 19/19] Bump docker/metadata-action from 4.1.1 to 4.3.0 Bumps [docker/metadata-action](https://github.com/docker/metadata-action) from 4.1.1 to 4.3.0. - [Release notes](https://github.com/docker/metadata-action/releases) - [Commits](https://github.com/docker/metadata-action/compare/v4.1.1...v4.3.0) --- updated-dependencies: - dependency-name: docker/metadata-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/docker-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index d3bc4325..88c738ca 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -44,7 +44,7 @@ jobs: # https://github.com/docker/metadata-action - name: Extract Docker metadata id: meta - uses: docker/metadata-action@v4.1.1 + uses: docker/metadata-action@v4.3.0 with: images: | ghcr.io/${{ github.repository }}