From 9b10e2670bb02be52e643414f0b2a76b4b26b569 Mon Sep 17 00:00:00 2001 From: Banana Date: Sun, 2 Jun 2024 10:00:57 +0200 Subject: [PATCH] removed tui client. cleaned up documentation and moved to markdown Signed-off-by: Banana --- CHANGELOG | 2 +- client/go-tui/Makefile | 17 ---- client/go-tui/README | 34 -------- client/go-tui/TODO | 1 - client/go-tui/create.go | 90 ------------------- client/go-tui/go.mod | 28 ------ client/go-tui/go.sum | 72 --------------- client/go-tui/list.go | 96 -------------------- client/go-tui/scientia-tui.go | 98 --------------------- client/go-tui/start.go | 136 ----------------------------- documentation/{api.txt => api.md} | 14 +-- documentation/clients.md | 7 ++ documentation/clients.txt | 4 - documentation/i18n.md | 8 ++ documentation/i18n.txt | 6 -- documentation/installation.md | 30 +++++++ documentation/installation.txt | 22 ----- documentation/requirements.md | 5 ++ documentation/requirements.txt | 3 - documentation/upgrade-from-1.0.txt | 2 +- 20 files changed, 61 insertions(+), 614 deletions(-) delete mode 100644 client/go-tui/Makefile delete mode 100644 client/go-tui/README delete mode 100644 client/go-tui/TODO delete mode 100644 client/go-tui/create.go delete mode 100644 client/go-tui/go.mod delete mode 100644 client/go-tui/go.sum delete mode 100644 client/go-tui/list.go delete mode 100644 client/go-tui/scientia-tui.go delete mode 100644 client/go-tui/start.go rename documentation/{api.txt => api.md} (82%) create mode 100644 documentation/clients.md delete mode 100644 documentation/clients.txt create mode 100644 documentation/i18n.md delete mode 100644 documentation/i18n.txt create mode 100644 documentation/installation.md delete mode 100644 documentation/installation.txt create mode 100644 documentation/requirements.md delete mode 100644 documentation/requirements.txt diff --git a/CHANGELOG b/CHANGELOG index d92bdd5..8ccc507 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -2,7 +2,7 @@ + i18n. See upgrade-from-1.0.txt for more details. + PHP 8.1 stuff + Search - + Updated clients. A cli and tui client written in Go. + + Updated clients. A cli client written in Go. + API fixes 1.0 Lykos - 2022-11-12 diff --git a/client/go-tui/Makefile b/client/go-tui/Makefile deleted file mode 100644 index ce72e53..0000000 --- a/client/go-tui/Makefile +++ /dev/null @@ -1,17 +0,0 @@ -all: - @echo "Options are: build and buildall" - -build: - @echo "Building for local os/arch..." - go build -o scientia-tui-`go env GOOS`-`go env GOARCH` - -buildall: - @echo "Building for linux/amd64 arch..." - GOOS=linux GOARCH=amd64 go build -o scientia-tui-linux-amd64 - @echo "Done: scientia-tui-linux-amd64" - @echo "Building for windows/amd64 arch..." - GOOS=windows GOARCH=amd64 go build -o scientia-tui-windows-amd64 - @echo "Done: scientia-tui-windows-amd64" - @echo "Building for macOS/amd64 arch..." - GOOS=darwin GOARCH=amd64 go build -o scientia-tui-darwin-amd64 - @echo "Done: scientia-tui-darwin-amd64" \ No newline at end of file diff --git a/client/go-tui/README b/client/go-tui/README deleted file mode 100644 index f05f429..0000000 --- a/client/go-tui/README +++ /dev/null @@ -1,34 +0,0 @@ -This is a terminal tui client written in go to be used with scientia -https://://www.bananas-playground.net/projekt/scientia - -!WARNING! -This is a very simple, with limited experience written, go program. -Use at own risk and feel free to improve. - -# Howto build: -Nothing special, just use the provide Makefile or directly "go build -o scientia-tui" to use your current os/arch settings. - -# Uses: -https://github.com/charmbracelet/bubbletea -https://github.com/charmbracelet/bubbles -https://github.com/charmbracelet/lipgloss - -# Usage -At first usage you need to create the config and the individual secret. -Run $scientia-tui -create-config-file to create the default config file. -The path to the config file is printed. -Change the host address and update your server it with the secret, which is randomly created. - -Read from a file -$ scientia-tui file.txt -or piped -$ cat file.txt | scientia-tui - -Commandline arguments (optional): - -create-config-file - Create default config file - -debug - Print debug infos - -verbose - Produce verbose output - diff --git a/client/go-tui/TODO b/client/go-tui/TODO deleted file mode 100644 index e9f8f34..0000000 --- a/client/go-tui/TODO +++ /dev/null @@ -1 +0,0 @@ -Reset the create input field. Not sure where yet. diff --git a/client/go-tui/create.go b/client/go-tui/create.go deleted file mode 100644 index fa758ae..0000000 --- a/client/go-tui/create.go +++ /dev/null @@ -1,90 +0,0 @@ -/** - * scientia - * - * A terminal client written in go. - * - * Copyright 2023 Johannes Keßler - * - * https://www.bananas-playground.net/projekt/scientia/ - * - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE - * - * You should have received a copy of the - * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - * along with this program. If not, see http://www.sun.com/cddl/cddl.html - * - * - * This is the create "screen". It displays a textarea to input text into. - * Does the save and creation - */ -package main - -import ( - "github.com/charmbracelet/bubbles/textarea" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" -) - -var ( - headline = lipgloss.NewStyle().Margin(1, 0, 1, 2) - infoText = lipgloss.NewStyle().Margin(1, 0, 1, 2).Foreground(lipgloss.AdaptiveColor{Light: "#969B86", Dark: "#696969"}) -) - -func initCreate() textarea.Model { - ta := textarea.New() - ta.Placeholder = "Once upon a time..." - ta.SetHeight(10) - ta.SetWidth(80) - ta.Focus() - - return ta -} - -func createView(m mainModel) string { - return lipgloss.JoinVertical(lipgloss.Left, - headline.Render("Create a new entry"), - m.create.View(), - infoText.Render("esc*2 to get back and discard. ctrl+s to save.")) -} - -func createUpdate(msg tea.Msg, m mainModel) (tea.Model, tea.Cmd) { - - var cmds []tea.Cmd - var cmd tea.Cmd - - switch msg := msg.(type) { - - case tea.WindowSizeMsg: - m.create.SetWidth(msg.Width) - return m, nil - - case tea.KeyMsg: - switch msg.Type { - case tea.KeyCtrlC: - m.quitting = true - return m, tea.Quit - case tea.KeyCtrlS: - m.choice = "" - return m, nil - - case tea.KeyEsc: - if m.create.Focused() { - m.create.Blur() - } else if !m.create.Focused() { - m.choice = "" - return m, nil - } - default: - if !m.create.Focused() { - cmd = m.create.Focus() - cmds = append(cmds, cmd) - } - } - } - - m.create, cmd = m.create.Update(msg) - cmds = append(cmds, cmd) - return m, tea.Batch(cmds...) -} diff --git a/client/go-tui/go.mod b/client/go-tui/go.mod deleted file mode 100644 index 479490f..0000000 --- a/client/go-tui/go.mod +++ /dev/null @@ -1,28 +0,0 @@ -module scientia/go-client - -go 1.19 - -require ( - github.com/charmbracelet/bubbles v0.14.0 - github.com/charmbracelet/bubbletea v0.23.1 - github.com/charmbracelet/lipgloss v0.6.0 -) - -require ( - github.com/atotto/clipboard v0.1.4 // indirect - github.com/aymanbagabas/go-osc52 v1.2.1 // indirect - github.com/containerd/console v1.0.3 // indirect - github.com/lucasb-eyer/go-colorful v1.2.0 // indirect - github.com/mattn/go-isatty v0.0.17 // indirect - github.com/mattn/go-localereader v0.0.1 // indirect - github.com/mattn/go-runewidth v0.0.14 // indirect - github.com/muesli/ansi v0.0.0-20221106050444-61f0cd9a192a // indirect - github.com/muesli/cancelreader v0.2.2 // indirect - github.com/muesli/reflow v0.3.0 // indirect - github.com/muesli/termenv v0.13.0 // indirect - github.com/rivo/uniseg v0.4.3 // indirect - github.com/sahilm/fuzzy v0.1.0 // indirect - golang.org/x/sys v0.4.0 // indirect - golang.org/x/term v0.4.0 // indirect - golang.org/x/text v0.6.0 // indirect -) diff --git a/client/go-tui/go.sum b/client/go-tui/go.sum deleted file mode 100644 index eb1c470..0000000 --- a/client/go-tui/go.sum +++ /dev/null @@ -1,72 +0,0 @@ -github.com/atotto/clipboard v0.1.4 h1:EH0zSVneZPSuFR11BlR9YppQTVDbh5+16AmcJi4g1z4= -github.com/atotto/clipboard v0.1.4/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= -github.com/aymanbagabas/go-osc52 v1.0.3 h1:DTwqENW7X9arYimJrPeGZcV0ln14sGMt3pHZspWD+Mg= -github.com/aymanbagabas/go-osc52 v1.0.3/go.mod h1:zT8H+Rk4VSabYN90pWyugflM3ZhpTZNC7cASDfUCdT4= -github.com/aymanbagabas/go-osc52 v1.2.1 h1:q2sWUyDcozPLcLabEMd+a+7Ea2DitxZVN9hTxab9L4E= -github.com/aymanbagabas/go-osc52 v1.2.1/go.mod h1:zT8H+Rk4VSabYN90pWyugflM3ZhpTZNC7cASDfUCdT4= -github.com/charmbracelet/bubbles v0.14.0 h1:DJfCwnARfWjZLvMglhSQzo76UZ2gucuHPy9jLWX45Og= -github.com/charmbracelet/bubbles v0.14.0/go.mod h1:bbeTiXwPww4M031aGi8UK2HT9RDWoiNibae+1yCMtcc= -github.com/charmbracelet/bubbletea v0.21.0/go.mod h1:GgmJMec61d08zXsOhqRC/AiOx4K4pmz+VIcRIm1FKr4= -github.com/charmbracelet/bubbletea v0.23.1 h1:CYdteX1wCiCzKNUlwm25ZHBIc1GXlYFyUIte8WPvhck= -github.com/charmbracelet/bubbletea v0.23.1/go.mod h1:JAfGK/3/pPKHTnAS8JIE2u9f61BjWTQY57RbT25aMXU= -github.com/charmbracelet/harmonica v0.2.0/go.mod h1:KSri/1RMQOZLbw7AHqgcBycp8pgJnQMYYT8QZRqZ1Ao= -github.com/charmbracelet/lipgloss v0.5.0/go.mod h1:EZLha/HbzEt7cYqdFPovlqy5FZPj0xFhg5SaqxScmgs= -github.com/charmbracelet/lipgloss v0.6.0 h1:1StyZB9vBSOyuZxQUcUwGr17JmojPNm87inij9N3wJY= -github.com/charmbracelet/lipgloss v0.6.0/go.mod h1:tHh2wr34xcHjC2HCXIlGSG1jaDF0S0atAUvBMP6Ppuk= -github.com/containerd/console v1.0.3 h1:lIr7SlA5PxZyMV30bDW0MGbiOPXwc63yRuCP0ARubLw= -github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= -github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= -github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= -github.com/mattn/go-isatty v0.0.16 h1:bq3VjFmv/sOjHtdEhmkEV4x1AJtvUvOJ2PFAZ5+peKQ= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.17 h1:BTarxUcIeDqL27Mc+vyvdWYSL28zpIhv3RoTdsLMPng= -github.com/mattn/go-isatty v0.0.17/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4= -github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88= -github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= -github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= -github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= -github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= -github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b h1:1XF24mVaiu7u+CFywTdcDo2ie1pzzhwjt6RHqzpMU34= -github.com/muesli/ansi v0.0.0-20211018074035-2e021307bc4b/go.mod h1:fQuZ0gauxyBcmsdE3ZT4NasjaRdxmbCS0jRHsrWu3Ho= -github.com/muesli/ansi v0.0.0-20221106050444-61f0cd9a192a h1:jlDOeO5TU0pYlbc/y6PFguab5IjANI0Knrpg3u/ton4= -github.com/muesli/ansi v0.0.0-20221106050444-61f0cd9a192a/go.mod h1:CJlz5H+gyd6CUWT45Oy4q24RdLyn7Md9Vj2/ldJBSIo= -github.com/muesli/cancelreader v0.2.0/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= -github.com/muesli/cancelreader v0.2.2 h1:3I4Kt4BQjOR54NavqnDogx/MIoWBFa0StPA8ELUXHmA= -github.com/muesli/cancelreader v0.2.2/go.mod h1:3XuTXfFS2VjM+HTLZY9Ak0l6eUKfijIfMUZ4EgX0QYo= -github.com/muesli/reflow v0.2.1-0.20210115123740-9e1d0d53df68/go.mod h1:Xk+z4oIWdQqJzsxyjgl3P22oYZnHdZ8FFTHAQQt5BMQ= -github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= -github.com/muesli/reflow v0.3.0/go.mod h1:pbwTDkVPibjO2kyvBQRBxTWEEGDGq0FlB1BIKtnHY/8= -github.com/muesli/termenv v0.11.1-0.20220204035834-5ac8409525e0/go.mod h1:Bd5NYQ7pd+SrtBSrSNoBBmXlcY8+Xj4BMJgh8qcZrvs= -github.com/muesli/termenv v0.11.1-0.20220212125758-44cd13922739/go.mod h1:Bd5NYQ7pd+SrtBSrSNoBBmXlcY8+Xj4BMJgh8qcZrvs= -github.com/muesli/termenv v0.13.0 h1:wK20DRpJdDX8b7Ek2QfhvqhRQFZ237RGRO0RQ/Iqdy0= -github.com/muesli/termenv v0.13.0/go.mod h1:sP1+uffeLaEYpyOTb8pLCUctGcGLnoFjSn4YJK5e2bc= -github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= -github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= -github.com/rivo/uniseg v0.4.3 h1:utMvzDsuh3suAEnhH0RdHmoPbU648o6CvXxTx4SBMOw= -github.com/rivo/uniseg v0.4.3/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/sahilm/fuzzy v0.1.0 h1:FzWGaw2Opqyu+794ZQ9SYifWv2EIXpwP4q8dY1kDAwI= -github.com/sahilm/fuzzy v0.1.0/go.mod h1:VFvziUEIMCrT6A6tw2RFIXPXXmzXbOsSHF0DOI8ZK9Y= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab h1:2QkjZIsXupsJbJIdSjjUOgWK3aEtzyuh2mPt3l/CkeU= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.4.0 h1:Zr2JFtRQNX3BCZ8YtxRE9hNJYC8J6I1MVbMg6owUp18= -golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= -golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.4.0 h1:O7UWfv5+A2qiuulQk30kVinPoMtoIPeVaKLEgLpVkvg= -golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= -golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= -golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.6.0 h1:3XmdazWV+ubf7QgHSTWeykHOci5oeekaGJBLkrkaw4k= -golang.org/x/text v0.6.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= diff --git a/client/go-tui/list.go b/client/go-tui/list.go deleted file mode 100644 index 6a77a99..0000000 --- a/client/go-tui/list.go +++ /dev/null @@ -1,96 +0,0 @@ -/** - * scientia - * - * A terminal client written in go. - * - * Copyright 2023 Johannes Keßler - * - * https://www.bananas-playground.net/projekt/scientia/ - * - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE - * - * You should have received a copy of the - * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - * along with this program. If not, see http://www.sun.com/cddl/cddl.html - * - * - * This is the create "screen". It displays a textarea to input text into. - * Does the save and creation - */ -package main - -import ( - "github.com/charmbracelet/bubbles/table" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" -) - -var ( - baseStyle = lipgloss.NewStyle().BorderStyle(lipgloss.NormalBorder()).BorderForeground(lipgloss.Color("240")) - headerStyle = lipgloss.NewStyle().BorderStyle(lipgloss.NormalBorder()).BorderForeground(lipgloss.Color("240")).BorderBottom(true).Bold(false) - selectedStyle = lipgloss.NewStyle().Foreground(lipgloss.Color("229")).Background(lipgloss.Color("57")).Bold(false) -) - -func initList() table.Model { - - columns := []table.Column{ - {Title: "ID", Width: 4}, - {Title: "Date", Width: 10}, - {Title: "Body", Width: 10}, - } - - rows := []table.Row{ - {"B0ug", "2023-02-17", "Determine this makefile"}, - {"k291", "2023-02-16", "This is a terminal cli client written in g"}, - {"A93a", "2023-02-15", "ava fallstricke https://www.fs-fmc.kit.edu/sites/default/fil"}, - } - - t := table.New( - table.WithColumns(columns), - table.WithRows(rows), - table.WithFocused(true), - table.WithHeight(10), - table.WithWidth(700), - ) - - s := table.DefaultStyles() - s.Header = headerStyle - s.Selected = selectedStyle - t.SetStyles(s) - - return t -} - -func listUpdate(msg tea.Msg, m mainModel) (tea.Model, tea.Cmd) { - - var cmds []tea.Cmd - var cmd tea.Cmd - - switch msg := msg.(type) { - - case tea.WindowSizeMsg: - m.list.SetWidth(msg.Width) - return m, nil - - case tea.KeyMsg: - switch msg.Type { - case tea.KeyCtrlC: - m.quitting = true - return m, tea.Quit - case tea.KeyEsc: - if m.list.Focused() { - m.list.Blur() - } - } - } - - m.list, cmd = m.list.Update(msg) - cmds = append(cmds, cmd) - return m, tea.Batch(cmds...) -} - -func listView(m mainModel) string { - return baseStyle.Render(m.list.View()) + "\n" -} diff --git a/client/go-tui/scientia-tui.go b/client/go-tui/scientia-tui.go deleted file mode 100644 index 1fe60ed..0000000 --- a/client/go-tui/scientia-tui.go +++ /dev/null @@ -1,98 +0,0 @@ -/** - * scientia - * - * A terminal client written in go. - * - * Copyright 2023 Johannes Keßler - * - * https://www.bananas-playground.net/projekt/scientia/ - * - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE - * - * You should have received a copy of the - * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - * along with this program. If not, see http://www.sun.com/cddl/cddl.html - */ -package main - -import ( - "fmt" - "github.com/charmbracelet/bubbles/table" - "github.com/charmbracelet/bubbles/textarea" - "github.com/charmbracelet/bubbles/viewport" - "github.com/charmbracelet/lipgloss" - "os" - - "github.com/charmbracelet/bubbles/list" - tea "github.com/charmbracelet/bubbletea" -) - -// the unique identifiers for each action of the initial list of actions -const ( - ITEM_CREATE_VALUE = "create" - ITEM_LIST_VALUE = "list" - ITEM_UPDATE_VALUE = "update" -) - -// some global vars -var ( - quitTextStyle = lipgloss.NewStyle().Margin(1, 0, 1, 2) -) - -// mainModel Holds all the important stuff -// Needs to be extended if a new action is added -type mainModel struct { - start list.Model - create textarea.Model - list table.Model - choice string - quitting bool - viewport viewport.Model -} - -func (m mainModel) Init() tea.Cmd { - return nil -} - -// Update The main Update method. Decides the correct action update method -func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) { - switch m.choice { - case ITEM_UPDATE_VALUE: - //return quitTextStyle.Render("Update it is") - case ITEM_LIST_VALUE: - return listUpdate(msg, m) - case ITEM_CREATE_VALUE: - return createUpdate(msg, m) - } - return startUpdate(msg, m) -} - -// View The main View method. Decides which action view is called -func (m mainModel) View() string { - if m.quitting { - return quitTextStyle.Render("Good day.") - } - - switch m.choice { - case ITEM_UPDATE_VALUE: - return quitTextStyle.Render("Update it is") - case ITEM_LIST_VALUE: - return listView(m) - case ITEM_CREATE_VALUE: - return createView(m) - } - - return startView(m) -} - -func main() { - m := mainModel{start: initStart(), create: initCreate(), list: initList()} - p := tea.NewProgram(m, tea.WithAltScreen()) - - if _, err := p.Run(); err != nil { - fmt.Println("Error running program:", err) - os.Exit(1) - } -} diff --git a/client/go-tui/start.go b/client/go-tui/start.go deleted file mode 100644 index a2fdb55..0000000 --- a/client/go-tui/start.go +++ /dev/null @@ -1,136 +0,0 @@ -/** - * scientia - * - * A terminal client written in go. - * - * Copyright 2023 Johannes Keßler - * - * https://www.bananas-playground.net/projekt/scientia/ - * - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the COMMON DEVELOPMENT AND DISTRIBUTION LICENSE - * - * You should have received a copy of the - * COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) Version 1.0 - * along with this program. If not, see http://www.sun.com/cddl/cddl.html - * - * - * This is the start "screen" which displays the available actions which can be selected. - * The values and identifiers are defined in the main file, since they are used there too - */ -package main - -import ( - "fmt" - "github.com/charmbracelet/bubbles/list" - tea "github.com/charmbracelet/bubbletea" - "github.com/charmbracelet/lipgloss" - "io" -) - -var ( - titleStyle = lipgloss.NewStyle().MarginLeft(0) - itemStyle = lipgloss.NewStyle().PaddingLeft(4) - selectedItemStyle = lipgloss.NewStyle().PaddingLeft(2).Foreground(lipgloss.Color("170")) - paginationStyle = list.DefaultStyles().PaginationStyle.PaddingLeft(4) - helpStyle = list.DefaultStyles().HelpStyle.PaddingLeft(4).PaddingBottom(1) -) - -// item stuff -type item struct { - title, desc string -} - -func (i item) Title() string { return i.title } -func (i item) Description() string { return i.desc } -func (i item) FilterValue() string { return i.title } - -type itemDelegate struct{} - -func (d itemDelegate) Height() int { - return 1 -} -func (d itemDelegate) Spacing() int { - return 0 -} -func (d itemDelegate) Update(msg tea.Msg, m *list.Model) tea.Cmd { - return nil -} -func (d itemDelegate) Render(w io.Writer, m list.Model, index int, listItem list.Item) { - i, ok := listItem.(item) - if !ok { - return - } - - str := fmt.Sprintf("%d. %s", index+1, i.Title()) - - fn := itemStyle.Render - if index == m.Index() { - fn = func(s string) string { - return selectedItemStyle.Render("> " + s) - } - } - - fmt.Fprint(w, fn(str)) -} - -func initStart() list.Model { - items := []list.Item{ - item{title: "Create", desc: ITEM_CREATE_VALUE}, - item{title: "List", desc: ITEM_LIST_VALUE}, - item{title: "Update", desc: ITEM_UPDATE_VALUE}, - } - - l := list.New(items, itemDelegate{}, 20, 14) - l.Title = "Please select an option" - l.SetShowStatusBar(false) - l.SetFilteringEnabled(false) - l.Styles.Title = titleStyle - l.Styles.PaginationStyle = paginationStyle - l.Styles.HelpStyle = helpStyle - - return l -} - -func startView(m mainModel) string { - return fmt.Sprintf("\n%s", m.start.View()) -} - -func startUpdate(msg tea.Msg, m mainModel) (tea.Model, tea.Cmd) { - switch msg := msg.(type) { - case tea.WindowSizeMsg: - m.start.SetWidth(msg.Width) - //m.viewport.Width = msg.Width - //m.viewport.Height = msg.Height - return m, nil - - case tea.KeyMsg: - switch msg.Type { - // esc does close? - case tea.KeyEsc: - return m, nil - case tea.KeyCtrlC: - m.quitting = true - return m, tea.Quit - - case tea.KeyEnter: - i, ok := m.start.SelectedItem().(item) - if ok { - m.choice = i.Description() - } - return m, nil - - case tea.KeyRunes: - switch string(msg.Runes) { - case "q": - m.quitting = true - return m, tea.Quit - } - } - } - - var cmd tea.Cmd - m.start, cmd = m.start.Update(msg) - return m, cmd -} diff --git a/documentation/api.txt b/documentation/api.md similarity index 82% rename from documentation/api.txt rename to documentation/api.md index 4675cfb..5cbd144 100644 --- a/documentation/api.txt +++ b/documentation/api.md @@ -1,5 +1,6 @@ -Example request: +# Request: +``` POST http://example.tld/api.php Content-Type: application/json; charset=utf-8 Accept: application/json @@ -8,21 +9,24 @@ Accept: application/json "asl": "YOUR-KEY", "data": "TEXT DATA TO BE SAVED" } +``` +# Response success: -Example response (success): - +``` Content-Type: application/json { "message": "http://example.tld/2022/03/26/DFzn", "status": 200 } +``` +# Response failure: -Example response (failure): - +``` Content-Type: application/json { "message": "Something went wrong. HASHCODE", "status": 500 } +``` diff --git a/documentation/clients.md b/documentation/clients.md new file mode 100644 index 0000000..ebc573a --- /dev/null +++ b/documentation/clients.md @@ -0,0 +1,7 @@ +# Clients + +Per default there is a cli client written in go. +Those interact over the api with the server edit the contents. + +A client needs to create its secret. +This needs to be added to the server. After that a client is allowed to add contents. diff --git a/documentation/clients.txt b/documentation/clients.txt deleted file mode 100644 index d1e0d18..0000000 --- a/documentation/clients.txt +++ /dev/null @@ -1,4 +0,0 @@ -Work in progress. - -A client needs to create its secret. This needs to be added to the server. After that a client is allowed -to add contents. diff --git a/documentation/i18n.md b/documentation/i18n.md new file mode 100644 index 0000000..fd3ebbf --- /dev/null +++ b/documentation/i18n.md @@ -0,0 +1,8 @@ +# i18n + +Other languages are supported by the i18n ini files in the `lib/i18n` folder. +It uses the two char lang code as a filename. + +To add a new translation copy the existing `en.ini` file and rename it to the new language. +Edit every value for each key in the file. +Get in touch or even make a PR via github to get the new language added. diff --git a/documentation/i18n.txt b/documentation/i18n.txt deleted file mode 100644 index 9ae216e..0000000 --- a/documentation/i18n.txt +++ /dev/null @@ -1,6 +0,0 @@ -Other languages are supported by the i18n ini files in the lib/i18n folder. -It uses the two char lang code as a filename. - -To add a new translation copy the existing en.ini file and rename it to the new language. -Edit every value for each key in the file. Get in touch or even make a PR via github to -get the new language added. \ No newline at end of file diff --git a/documentation/installation.md b/documentation/installation.md new file mode 100644 index 0000000..b1e568c --- /dev/null +++ b/documentation/installation.md @@ -0,0 +1,30 @@ +# Check the requirements + +Make sure to meet those requirement to avoid any bugs. + +# Unpack + +Unpack the release to a temporary folder. + +# MySQL + +Create a database or use an existing one (a table prefix will be used) and write down the credentials. + +# Create DB table + +Open `scientia.sql.txt` file and run the given SQL command in the database you are using. +This command creates the needed tables. A Database will not be created. + +# Config + +Copy `config.php.default` to `config.php` and open it. +Input your MySQL credentials and update the other settings there. + +# Upload + +Upload the contents of the webroot from your temp folder onto your webserver. +Make sure the path matches the setting from the config. + +# Directory permissions + +Make sure the `systemout` directory has write permission to the webserver user. diff --git a/documentation/installation.txt b/documentation/installation.txt deleted file mode 100644 index fbf0cf2..0000000 --- a/documentation/installation.txt +++ /dev/null @@ -1,22 +0,0 @@ -1. Check the requirements - -2. Unpack -Unpack the release to a temporary folder - -3. Create DB table -Open scientia.sql.txt file and run the SQL command. -This command creates the needed table. A Database will not be created. - -4. MySQL -After creating the default table note your hostname, username, password and table name. - -5. Config -Copy config.php.default to config.php and open it. -Input your MySQL stuff from step 3 and update the other settings there. - -6. Upload -Upload the contents of the webroot from your temp folder into your webserver. -Make sure the path matches the setting from the config. - -7. Directory permissions -Make sure the systemout directory has write permission to the webserver user. diff --git a/documentation/requirements.md b/documentation/requirements.md new file mode 100644 index 0000000..b39e342 --- /dev/null +++ b/documentation/requirements.md @@ -0,0 +1,5 @@ +# Requirements + ++ A Webserver (tested on Apache 2.4) ++ PHP 8+ with mysqli, mbstring, curl ++ MySQL 8+ / MariaDB 10.2 diff --git a/documentation/requirements.txt b/documentation/requirements.txt deleted file mode 100644 index fd3539f..0000000 --- a/documentation/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -A Webserver (tested on Apache 2.4) -PHP 8+ with mysqli, mbstring, curl -MySQL 8+ / MariaDB 10.2 diff --git a/documentation/upgrade-from-1.0.txt b/documentation/upgrade-from-1.0.txt index f9783b8..5b5b9d4 100644 --- a/documentation/upgrade-from-1.0.txt +++ b/documentation/upgrade-from-1.0.txt @@ -3,4 +3,4 @@ New config for i18n. Open config.php and add the following: # language settings const FRONTEND_LANGUAGE = 'en'; -currently only en (default) and de are available. \ No newline at end of file +currently only en (default) and de are available. -- 2.39.5