From 0b132d33fbdc3a088dfe43e8bc29e02c4c158e09 Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Mon, 10 Jun 2024 14:15:03 +0300 Subject: [PATCH 01/11] Keep the globe on the same line while still breaking link #230 --- static/default.css | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/static/default.css b/static/default.css index d4ce2d9..790149b 100644 --- a/static/default.css +++ b/static/default.css @@ -106,13 +106,11 @@ textarea {font-size:16px; font-family: inherit; line-height: 150%; } main h1:not(.navi-title) {font-size:1.7rem;} blockquote { margin: 0; padding-left: .75rem; } -.wikilink_external::before { display: inline-block; width: 18px; height: 16px; vertical-align: sub; } -/* .wikilink_external { padding-left: 16px; } */ -.wikilink_gopher::before { content: url("/static/icon/gopher-proto.svg"); } -.wikilink_http::before, .wikilink_https::before { content: url("/static/icon/http-proto.svg"); } -/* .wikilink_https { background: transparent url("/static/icon/http-proto.svg") center left no-repeat; } */ -.wikilink_gemini::before { content: url("/static/icon/gemini-proto.svg"); } -.wikilink_mailto::before { content: url("/static/icon/mailto-proto.svg"); } +.wikilink_external { padding-left: 17px; } +.wikilink_gopher { background: transparent left no-repeat url("/static/icon/gopher-proto.svg"); } +.wikilink_http, .wikilink_https { background: transparent left no-repeat url("/static/icon/http-proto.svg"); } +.wikilink_gemini { background: transparent left no-repeat url("/static/icon/gemini-proto.svg"); } +.wikilink_mailto { background: transparent left no-repeat url("/static/icon/mailto-proto.svg"); } article { overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; line-height: 150%; } main h1 { margin: .5rem 0 0 0; } From 9ef08fb42d838209ce65bd7663cde20c747fbceb Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Mon, 10 Jun 2024 14:25:01 +0300 Subject: [PATCH 02/11] Fix the size of globes with bigger default font size --- static/default.css | 2 +- static/icon/gemini-proto.svg | 2 +- static/icon/gopher-proto.svg | 2 +- static/icon/http-proto.svg | 3 ++- static/icon/mailto-proto.svg | 3 ++- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/static/default.css b/static/default.css index 790149b..c1b708e 100644 --- a/static/default.css +++ b/static/default.css @@ -106,7 +106,7 @@ textarea {font-size:16px; font-family: inherit; line-height: 150%; } main h1:not(.navi-title) {font-size:1.7rem;} blockquote { margin: 0; padding-left: .75rem; } -.wikilink_external { padding-left: 17px; } +.wikilink_external { padding-left: 1.2rem; } .wikilink_gopher { background: transparent left no-repeat url("/static/icon/gopher-proto.svg"); } .wikilink_http, .wikilink_https { background: transparent left no-repeat url("/static/icon/http-proto.svg"); } .wikilink_gemini { background: transparent left no-repeat url("/static/icon/gemini-proto.svg"); } diff --git a/static/icon/gemini-proto.svg b/static/icon/gemini-proto.svg index f2a6414..65c98b1 100644 --- a/static/icon/gemini-proto.svg +++ b/static/icon/gemini-proto.svg @@ -1 +1 @@ - + diff --git a/static/icon/gopher-proto.svg b/static/icon/gopher-proto.svg index 3ee0c59..a497c8c 100644 --- a/static/icon/gopher-proto.svg +++ b/static/icon/gopher-proto.svg @@ -1,4 +1,4 @@ - + + + diff --git a/static/icon/mailto-proto.svg b/static/icon/mailto-proto.svg index 863ccc1..4b78405 100644 --- a/static/icon/mailto-proto.svg +++ b/static/icon/mailto-proto.svg @@ -1 +1,2 @@ - + + From a0ec4f5fbf2879b84fa5f3736ca8086c836519e7 Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Tue, 11 Jun 2024 02:52:47 +0300 Subject: [PATCH 03/11] Hopefully fix some bugs on Windows --- hyphae/files.go | 20 ++++++++++---------- shroom/upload.go | 8 ++++++-- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/hyphae/files.go b/hyphae/files.go index f1bc400..43b8c67 100644 --- a/hyphae/files.go +++ b/hyphae/files.go @@ -2,6 +2,7 @@ package hyphae import ( "log" + "log/slog" "os" "path/filepath" @@ -27,11 +28,10 @@ func Index(path string) { switch foundHypha := foundHypha.(type) { case *TextualHypha: // conflict! overwrite storedHypha.mycoFilePath = foundHypha.mycoFilePath - log.Printf( - "File collision for hypha ‘%s’, using ‘%s’ rather than ‘%s’\n", - foundHypha.CanonicalName(), - foundHypha.TextFilePath(), - storedHypha.TextFilePath(), + slog.Info("File collision", + "hypha", foundHypha.CanonicalName(), + "usingFile", foundHypha.TextFilePath(), + "insteadOf", storedHypha.TextFilePath(), ) case *MediaHypha: // no conflict Insert(ExtendTextualToMedia(storedHypha, foundHypha.mediaFilePath)) @@ -43,11 +43,11 @@ func Index(path string) { storedHypha.mycoFilePath = foundHypha.mycoFilePath case *MediaHypha: // conflict! overwrite storedHypha.mediaFilePath = foundHypha.mediaFilePath - log.Printf( - "File collision for hypha ‘%s’, using ‘%s’ rather than ‘%s’\n", - foundHypha.CanonicalName(), - foundHypha.MediaFilePath(), - storedHypha.MediaFilePath(), + + slog.Info("File collision", + "hypha", foundHypha.CanonicalName(), + "usingFile", foundHypha.MediaFilePath(), + "insteadOf", storedHypha.MediaFilePath(), ) } } diff --git a/shroom/upload.go b/shroom/upload.go index 5599b01..8750ca9 100644 --- a/shroom/upload.go +++ b/shroom/upload.go @@ -15,6 +15,7 @@ import ( "mime/multipart" "os" "path/filepath" + "strings" ) func historyMessageForTextUpload(h hyphae.Hypha, userMessage string) string { @@ -78,7 +79,9 @@ func UploadText(h hyphae.Hypha, data []byte, userMessage string, u *user.User) e switch h := h.(type) { case *hyphae.EmptyHypha: - H := hyphae.ExtendEmptyToTextual(h, filepath.Join(files.HyphaeDir(), h.CanonicalName()+".myco")) + parts := []string{files.HyphaeDir()} + parts = append(parts, strings.Split(h.CanonicalName()+".myco", "\\")...) + H := hyphae.ExtendEmptyToTextual(h, filepath.Join(parts...)) err := writeTextToDisk(H, data, hop) if err != nil { @@ -139,7 +142,8 @@ func writeMediaToDisk(h hyphae.Hypha, mime string, data []byte) (string, error) var ( ext = mimetype.ToExtension(mime) // That's where the file will go - uploadedFilePath = filepath.Join(files.HyphaeDir(), h.CanonicalName()+ext) + + uploadedFilePath = filepath.Join(append([]string{files.HyphaeDir()}, strings.Split(h.CanonicalName()+ext, "\\")...)...) ) if err := os.MkdirAll(filepath.Dir(uploadedFilePath), 0777); err != nil { From 33a477cf364e0e15c20ade9b40c62b88b538e877 Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Tue, 11 Jun 2024 14:47:15 +0300 Subject: [PATCH 04/11] Add local time buttons Implements: #231 --- hypview/hypview.go | 6 ++++-- hypview/view_edit.html | 6 ++++-- static/shortcuts.js | 2 +- static/toolbar.js | 22 +++++++++++++++++++--- 4 files changed, 28 insertions(+), 8 deletions(-) diff --git a/hypview/hypview.go b/hypview/hypview.go index ea705db..337b054 100644 --- a/hypview/hypview.go +++ b/hypview/hypview.go @@ -45,8 +45,10 @@ var ( {{define "numbers"}}Нумер. список{{end}} {{define "mycomarkup help"}}Подробнее о Микоразметке{{end}} {{define "actions"}}Действия{{end}} -{{define "current date"}}Текущая дата{{end}} -{{define "current time"}}Текущее время{{end}} +{{define "current date utc"}}Дата UTC{{end}} +{{define "current time utc"}}Время UTC{{end}} +{{define "current date local"}}Местная дата{{end}} +{{define "current time local"}}Местное время{{end}} {{define "selflink"}}Ссылка на вас{{end}} {{define "empty heading"}}Эта гифа не существует{{end}} diff --git a/hypview/view_edit.html b/hypview/view_edit.html index 1bec2fe..e375363 100644 --- a/hypview/view_edit.html +++ b/hypview/view_edit.html @@ -32,8 +32,10 @@

{{block "actions" .}}Actions{{end}}

- - + + + + {{if .Meta.U.Group | ne "anon"}} {{end}} diff --git a/static/shortcuts.js b/static/shortcuts.js index e1ed6ad..b36dd19 100644 --- a/static/shortcuts.js +++ b/static/shortcuts.js @@ -329,7 +329,7 @@ if (document.body.dataset.rrhAddr.startsWith('/edit')) { new Shortcut(isMac ? 'Meta+Shift+x' : 'Ctrl+X', wrapStrikethrough, 'Strikethrough', { force: true }), new Shortcut(isMac ? 'Meta+k' : 'Ctrl+k', wrapLink, 'Inline link', { force: true }), // Apparently, ⌘; conflicts with a Safari's hotkey. Whatever. - new Shortcut(isMac ? 'Meta+;' : 'Ctrl+;', insertDate, 'Insert date UTC', { force: true }), + new Shortcut(isMac ? 'Meta+;' : 'Ctrl+;', insertDateUTC, 'Insert date UTC', { force: true }), ])) } } diff --git a/static/toolbar.js b/static/toolbar.js index 0fdd5c9..8b40967 100644 --- a/static/toolbar.js +++ b/static/toolbar.js @@ -87,7 +87,7 @@ const insertHorizontalBar = textInserter('\n----\n'), insertBulletedList = textInserter('\n* '), insertNumberedList = textInserter('\n*. ') -function insertDate() { +function insertDateUTC() { let date = new Date().toISOString().split('T')[0] textInserter(date)() } @@ -97,6 +97,20 @@ function insertTimeUTC() { textInserter(time)() } +function len2(n) { + return n < 10 ? `0${n}` : `${n}` +} + +function insertDateLocal() { + let d = new Date() + textInserter(`${d.getFullYear()}-${len2(d.getMonth() + 1)}-${len2(d.getDate())}`)() +} + +function insertTimeLocal() { + let d = new Date() + textInserter(`${len2(d.getHours())}:${len2(d.getMinutes())}:${len2(d.getSeconds())}`)() +} + function insertUserlink() { const userlink = document.querySelector('.auth-links__user-link') const userHypha = userlink.getAttribute('href').substring(7) // no /hypha/ @@ -124,8 +138,10 @@ const buttonsHandlers = { codeblock: insertCodeblock, bulletedlist: insertBulletedList, numberedlist: insertNumberedList, - date: insertDate, - time: insertTimeUTC, + 'date-utc': insertDateUTC, + 'time-utc': insertTimeUTC, + 'date-local': insertDateLocal, + 'time-local': insertTimeLocal, 'user-link': insertUserlink, } for (const key of Object.keys(buttonsHandlers)) { From f1d4310ec145cf0f2c28a0214c1b085f612b709c Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Tue, 11 Jun 2024 14:58:59 +0300 Subject: [PATCH 05/11] Change the mv-categories made-up microformat to mv-tags to match Betula MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit One day Bouncepaw will learn of “JSON API” --- categories/view_list.html | 4 ++-- static/view.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/categories/view_list.html b/categories/view_list.html index e4e3573..71321dc 100644 --- a/categories/view_list.html +++ b/categories/view_list.html @@ -1,12 +1,12 @@ {{define "category list"}}Category list{{end}} {{define "title"}}{{template "category list"}}{{end}} {{define "body"}} -
+

{{template "title"}}

{{if len .Categories}}
    {{range .Categories}} -
  1. +
  2. {{beautifulName .}}
  3. {{end}} diff --git a/static/view.js b/static/view.js index 06fc1ec..909a092 100644 --- a/static/view.js +++ b/static/view.js @@ -35,7 +35,7 @@ wrapper.appendChild(hamburgerSection); return Array .from(new DOMParser() .parseFromString(html, 'text/html') - .querySelectorAll('.mv-category .p-name')) + .querySelectorAll('.mv-tags .p-name')) .map(a => a.innerText); }); From 8f9c5d367726347996ff4cdbac32186b9cdd9773 Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Sat, 29 Jun 2024 18:04:58 +0300 Subject: [PATCH 06/11] Change tab size to 3 Implements: https://github.com/bouncepaw/mycorrhiza/issues/237 --- static/default.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/static/default.css b/static/default.css index c1b708e..10237df 100644 --- a/static/default.css +++ b/static/default.css @@ -122,7 +122,7 @@ article p { margin: .5rem 0; } article ul, ol { padding-left: 1.5rem; margin: .5rem 0; } article code { padding: .1rem .3rem; border-radius: .25rem; font-size: 90%; font-family: 'Menlo', 'PT Mono', monospace; } article pre.codeblock { padding:.5rem; white-space: pre-wrap; border-radius: .25rem;} -.codeblock code {padding:0; font-size:15px;} +.codeblock code {padding:0; font-size:15px; tab-size: 3; } .transclusion { border-radius: .25rem; margin-bottom: .25rem; clear: both; } .transclusion_failed { padding: 0 .5rem; } .transclusion__content > *:not(.binary-container) {margin: 0.5rem; } From 4bfbb6a2d76393ad475f6729b69ec739928e4d5b Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Sat, 29 Jun 2024 18:12:23 +0300 Subject: [PATCH 07/11] Update README.md --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1df37af..a282d28 100644 --- a/README.md +++ b/README.md @@ -7,12 +7,12 @@ ## Features -* **No database required.** Everything is stored in plain files. It makes installation super easy, and you can modify the content directly by yourself. +* **No database used.** Everything is stored in plain files. It makes installation super easy, and you can modify the content directly by yourself. * **Everything is hyphae.** A hypha is a unit of content such as a picture, video or a text article. Hyphae can [transclude] and link each other, forming a tight network of hypertext pages. -* **Hyphae are authored in [Mycomarkup],** a markup language that's designed to be unambigious yet easy to use. +* **Hyphae are authored in [Mycomarkup],** a markup language that's designed to be unambiguous yet easy to use. * **Categories** let you organize hyphae without any hierarchy restrictions, with all the benefits of a category system. * **Nesting of hyphae** is also supported if you like hierarchies. -* **History of changes** for textual parts of hyphae. Every change is safely stored in [Git]. Web feeds for recent changes included. +* **History of changes.** Every change is safely stored in [Git]. Web feeds (RSS, Atom, JSON Feed) for recent changes included. * **Keyboard-driven navigation.** Press `?` to see the list of shortcuts. * **Support for [authorization].** Both plain username-password pairs and [Telegram]'s login widget are supported. * **[Open Graph] support.** The most relevant info about a hypha is made available through OG meta tags for consumption by other software. @@ -30,14 +30,16 @@ Compare Mycorrhiza Wiki with other engines on [WikiMatrix](https://www.wikimatri ## Installing -See [the deployment guide](https://mycorrhiza.wiki/hypha/deployment) on the wiki. +See [the deployment guide](https://mycorrhiza.wiki/hypha/deployment) on the wiki. Also, Mycorrhiza might be available in your repositories. -## Contributing +## Contributing and community -* [SourceHut](https://sr.ht/~bouncepaw/mycorrhiza) * [GitHub](https://github.com/bouncepaw/mycorrhiza) -* [#mycorrhiza on irc.libera.chat](irc://irc.libera.chat/#mycorrhiza) +* [Fediverse @mycorrhiza@floss.social](https://floss.social/@mycorrhiza) +* Mirrors: + * [SourceHut](https://sr.ht/~bouncepaw/mycorrhiza) + * [Codeberg](https://codeberg.org/bouncepaw/mycorrhiza) * [@mycorrhizadev (Russian) in Telegram](https://t.me/mycorrhizadev) If you want to contribute with code, open a pull request on GitHub or send a patch to the [mailing list](https://lists.sr.ht/~bouncepaw/mycorrhiza-devel). From 522640f8df5248d7bcf571af2d30a2e25a0360c2 Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Sat, 29 Jun 2024 18:17:55 +0300 Subject: [PATCH 08/11] Mention that robots.txt can be redefined --- help/en/file_structure.myco | 1 + 1 file changed, 1 insertion(+) diff --git a/help/en/file_structure.myco b/help/en/file_structure.myco index 6798b21..2b0d8fd 100644 --- a/help/en/file_structure.myco +++ b/help/en/file_structure.myco @@ -11,6 +11,7 @@ You can edit all of the files manually, if you want, just do your best to not br ** `static/favicon.ico` is your wiki's favicon, accessed at [[/favicon.ico]] by browsers. ** `static/default.css` redefines the engine's default style, if exists. You probably don't need to use it. ** `static/custom.css` is loaded after the main style. If you want to make visual changes to your wiki, this is probably where you should do that. +** `static/robots.txt` redefines default `robots.txt` file. * `categories.json` contains the information about all categories in your wiki. * `users.json` stores users' information. The passwords are not stored, only their hashes are, this is safe. Their tokens are stored in `cache/tokens.json`. * `interwiki.json` holds the interwiki configuration. From 922181ee93acee7baabfb760275b7c0f84e43034 Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Sat, 29 Jun 2024 18:21:31 +0300 Subject: [PATCH 09/11] Add Cmd+' shortcut for local time and change the format of time --- static/shortcuts.js | 1 + static/toolbar.js | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/static/shortcuts.js b/static/shortcuts.js index b36dd19..9dcd577 100644 --- a/static/shortcuts.js +++ b/static/shortcuts.js @@ -330,6 +330,7 @@ if (document.body.dataset.rrhAddr.startsWith('/edit')) { new Shortcut(isMac ? 'Meta+k' : 'Ctrl+k', wrapLink, 'Inline link', { force: true }), // Apparently, ⌘; conflicts with a Safari's hotkey. Whatever. new Shortcut(isMac ? 'Meta+;' : 'Ctrl+;', insertDateUTC, 'Insert date UTC', { force: true }), + new Shortcut(isMac ? "Meta+'" : "Ctrl+'", insertTimeLocal, 'Insert local time', { force: true }) ])) } } diff --git a/static/toolbar.js b/static/toolbar.js index 8b40967..1785f63 100644 --- a/static/toolbar.js +++ b/static/toolbar.js @@ -93,7 +93,7 @@ function insertDateUTC() { } function insertTimeUTC() { - let time = new Date().toISOString().substring(11, 19) + " UTC" + let time = new Date().toISOString().substring(11, 16) + " UTC " textInserter(time)() } @@ -108,7 +108,7 @@ function insertDateLocal() { function insertTimeLocal() { let d = new Date() - textInserter(`${len2(d.getHours())}:${len2(d.getMinutes())}:${len2(d.getSeconds())}`)() + textInserter(`${len2(d.getHours())}:${len2(d.getMinutes())} `)() } function insertUserlink() { From 7d5636486d206a9cf83f650180ce2f2e3750633d Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Sat, 29 Jun 2024 18:32:42 +0300 Subject: [PATCH 10/11] Delete release.yaml It hadn't been working for a couple of years already anyway --- .github/workflows/release.yaml | 28 ---------------------------- 1 file changed, 28 deletions(-) delete mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 2da5de3..0000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,28 +0,0 @@ -on: - release: - types: [created] - -jobs: - releases-matrix: - name: Release Go Binary - runs-on: ubuntu-latest - strategy: - matrix: - # build and publish in parallel a lot of binaries - # https://golang.org/doc/install/source#environment See supported Go OS/Arch pairs here - goos: [linux, darwin, openbsd, windows] - goarch: ["386", amd64, arm64] - exclude: - - goarch: "386" - goos: darwin - - goarch: arm64 - goos: windows - steps: - - uses: actions/checkout@v2 - - uses: wangyoucao577/go-release-action@v1.17 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - goos: ${{ matrix.goos }} - goarch: ${{ matrix.goarch }} - binary_name: "mycorrhiza" - extra_files: LICENSE README.md help/mycorrhiza.1 From 719de9b5301f1a36b84e99aca11d6c1a17e99a1b Mon Sep 17 00:00:00 2001 From: Timur Ismagilov Date: Sat, 29 Jun 2024 18:37:15 +0300 Subject: [PATCH 11/11] Update version to 1.15 --- help/en.myco | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/help/en.myco b/help/en.myco index e24d118..f82a3b3 100644 --- a/help/en.myco +++ b/help/en.myco @@ -1,6 +1,6 @@ = Help -This is documentation for Mycorrhiza Wiki 1.14. Choose a topic from the list. +This is documentation for Mycorrhiza Wiki 1.15. Choose a topic from the list. The documentation is incomplete. If you want to contribute to the documentation, open a pull request or an issue on [[https://github.com/bouncepaw/mycorrhiza | GitHub]] or [[https://lists.sr.ht/~bouncepaw/mycorrhiza-devel | send a patch]].