Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
c3f9b8db14 | |||
51699ca458 | |||
ea87940595 | |||
6726a7989c | |||
f59da2a76e | |||
4cc8b0c761 | |||
52e1117b7d | |||
4b1f7ea763 | |||
a5ccd81f28 |
17
Makefile
17
Makefile
@ -2,25 +2,28 @@ TARGET=dwelling-home
|
||||
|
||||
SYSDDIR_=${shell pkg-config systemd --variable=systemdsystemunitdir}
|
||||
SYSDDIR=${SYSDDIR_:/%=%}
|
||||
DESTDIR:=
|
||||
PREFIX:=/usr/local
|
||||
|
||||
VERSION?=24.27.1
|
||||
DESTDIR?=
|
||||
PREFIX?=/usr/local
|
||||
|
||||
FLAGS:=-buildmode=pie -modcacherw -mod=readonly -trimpath
|
||||
LDFLAGS=-ldflags "-s -w -X 'git.arav.su/Arav/dwelling-home/internal/version.ver=v${VERSION}'" -tags osusergo,netgo
|
||||
VERSION?=24.34.0
|
||||
|
||||
XVER:=git.arav.su/Arav/dwelling-home/internal/version.ver=v${VERSION}
|
||||
|
||||
GOFLAGS:=-buildmode=pie -trimpath -mod=readonly -modcacherw
|
||||
GOFLAGS+=-ldflags="-linkmode=external -s -w -X '${XVER}' -extldflags=${LDFLAGS}"
|
||||
GOFLAGS+=-tags osusergo,netgo
|
||||
|
||||
.PHONY: run install uninstall clean
|
||||
|
||||
${TARGET}: web/*_templ.go
|
||||
go build -o bin/$@ ${LDFLAGS} ${FLAGS} cmd/$@/main.go
|
||||
go build ${GOFLAGS} -o bin/$@ cmd/$@/main.go
|
||||
|
||||
web/*_templ.go: web/*.templ
|
||||
ifeq (,$(wildcard $(shell go env GOPATH)/bin/templ))
|
||||
go install github.com/a-h/templ/cmd/templ@latest
|
||||
endif
|
||||
TEMPL_EXPERIMENT=rawgo $(shell go env GOPATH)/bin/templ generate
|
||||
# sed -ri 's/a> "/a>"/g' web/*_templ.go
|
||||
|
||||
run: | ${TARGET}
|
||||
bin/${TARGET} -listen 127.0.0.1:18123 -database-path . -captcha-expiry 10m \
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Maintainer: Alexander "Arav" Andreev <me@arav.su>
|
||||
pkgname=dwelling-home
|
||||
pkgver=24.27.1
|
||||
pkgver=24.34.0
|
||||
pkgrel=1
|
||||
pkgdesc="Arav's dwelling / Home"
|
||||
arch=('i686' 'x86_64' 'arm' 'armv6h' 'armv7h' 'aarch64')
|
||||
|
@ -1,5 +1,6 @@
|
||||
server {
|
||||
listen 443 http2;
|
||||
listen [::]:443 http2;
|
||||
listen 8090; # Tor I2P
|
||||
listen [300:a98d:d6d0:8a08::f]:80; # Yggdrasil
|
||||
|
||||
@ -38,6 +39,7 @@ server {
|
||||
proxy_set_header Schema $scheme;
|
||||
|
||||
allow 192.168.144.0/25;
|
||||
allow 2a03:e2c0:4a0f::/48;
|
||||
deny all;
|
||||
}
|
||||
|
||||
@ -50,6 +52,7 @@ server {
|
||||
proxy_set_header Schema $scheme;
|
||||
|
||||
allow 192.168.144.0/25;
|
||||
allow 2a03:e2c0:4a0f::/48;
|
||||
deny all;
|
||||
}
|
||||
|
||||
@ -66,6 +69,7 @@ server {
|
||||
proxy_buffering off;
|
||||
|
||||
allow 192.168.144.0/25;
|
||||
allow 2a03:e2c0:4a0f::/48;
|
||||
deny all;
|
||||
}
|
||||
|
||||
@ -74,6 +78,7 @@ server {
|
||||
proxy_buffering off;
|
||||
|
||||
allow 192.168.144.0/25;
|
||||
allow 2a03:e2c0:4a0f::/48;
|
||||
deny all;
|
||||
}
|
||||
|
||||
|
6
go.mod
6
go.mod
@ -7,15 +7,15 @@ toolchain go1.22.4
|
||||
require (
|
||||
git.arav.su/Arav/justcaptcha/v2 v2.1.0
|
||||
git.arav.su/Arav/justguestbook v1.3.2
|
||||
github.com/a-h/templ v0.2.731
|
||||
github.com/gomarkdown/markdown v0.0.0-20240626202925-2eda941fd024
|
||||
github.com/a-h/templ v0.2.747
|
||||
github.com/gomarkdown/markdown v0.0.0-20240730141124-034f12af3bf6
|
||||
github.com/pkg/errors v0.9.1
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/fogleman/gg v1.3.0 // indirect
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect
|
||||
golang.org/x/image v0.18.0 // indirect
|
||||
golang.org/x/image v0.19.0 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
|
12
go.sum
12
go.sum
@ -4,14 +4,14 @@ git.arav.su/Arav/justcaptcha/v2 v2.1.0 h1:EFerW2mP60rDczu1mPbJb7DiDeAQOcw83/KiWc
|
||||
git.arav.su/Arav/justcaptcha/v2 v2.1.0/go.mod h1:Ntab6TUAqCo/H9LSWOd4IQ9ANnp8G1PEygXtORcdTOY=
|
||||
git.arav.su/Arav/justguestbook v1.3.2 h1:B1AzS14dW3bVlp0Qj6pu1PrJlWaPK1mplmx3UNBcxo4=
|
||||
git.arav.su/Arav/justguestbook v1.3.2/go.mod h1:Umo/AzSOKu+OU+03V7/QQ6m6N0nXyeRAGOZT4P5ol98=
|
||||
github.com/a-h/templ v0.2.731 h1:yiv4C7whSUsa36y65O06DPr/U/j3+WGB0RmvLOoVFXc=
|
||||
github.com/a-h/templ v0.2.731/go.mod h1:IejA/ecDD0ul0dCvgCwp9t7bUZXVpGClEAdsqZQigi8=
|
||||
github.com/a-h/templ v0.2.747 h1:D0dQ2lxC3W7Dxl6fxQ/1zZHBQslSkTSvl5FxP/CfdKg=
|
||||
github.com/a-h/templ v0.2.747/go.mod h1:69ObQIbrcuwPCU32ohNaWce3Cb7qM5GMiqN1K+2yop4=
|
||||
github.com/fogleman/gg v1.3.0 h1:/7zJX8F6AaYQc57WQCyN9cAIz+4bCJGO9B+dyW29am8=
|
||||
github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k=
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g=
|
||||
github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k=
|
||||
github.com/gomarkdown/markdown v0.0.0-20240626202925-2eda941fd024 h1:saBP362Qm7zDdDXqv61kI4rzhmLFq3Z1gx34xpl6cWE=
|
||||
github.com/gomarkdown/markdown v0.0.0-20240626202925-2eda941fd024/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA=
|
||||
github.com/gomarkdown/markdown v0.0.0-20240730141124-034f12af3bf6 h1:ZPy+2XJ8u0bB3sNFi+I72gMEMS7MTg7aZCCXPOjV8iw=
|
||||
github.com/gomarkdown/markdown v0.0.0-20240730141124-034f12af3bf6/go.mod h1:JDGcbDT52eL4fju3sZ4TeHGsQwhG9nbDV21aMyhwPoA=
|
||||
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
|
||||
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
|
||||
github.com/mattn/go-sqlite3 v1.14.16/go.mod h1:2eHXhiwb8IkHr+BDWZGa96P6+rkvnG63S2DGjv9HUNg=
|
||||
@ -23,8 +23,8 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/image v0.11.0/go.mod h1:bglhjqbqVuEb9e9+eNR45Jfu7D+T4Qan+NhQk8Ck2P8=
|
||||
golang.org/x/image v0.18.0 h1:jGzIakQa/ZXI1I0Fxvaa9W7yP25TqT6cHIHn+6CqvSQ=
|
||||
golang.org/x/image v0.18.0/go.mod h1:4yyo5vMFQjVjUcVk4jEQcU9MGy/rulF5WvUILseCM2E=
|
||||
golang.org/x/image v0.19.0 h1:D9FX4QWkLfkeqaC62SonffIIuYdOk/UE2XKUBgRIBIQ=
|
||||
golang.org/x/image v0.19.0/go.mod h1:y0zrRqlQRWQ5PXaYCOMLTW2fpsxZ8Qh9I/ohnInJEys=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
|
@ -28,6 +28,11 @@ templ Index(r *http.Request) {
|
||||
Welcome, Anon. I'm Alexander aka Arav, I self-host some services for myself, friends and you. Not much I have to offer, but maybe you'll find something useful for yourself. :)
|
||||
</p>
|
||||
</section>
|
||||
<section>
|
||||
<p>Привет, Анон. Я Александр, хожу по интернету под ником Arav и его всякими вариациями. С 2017 года завел у себя домашний сервер в виде третьей малины, а чуть позже добавил ещё один в виде старого ноута, и теперь размещаю различные сервисы на них, некоторые могут быть полезны и тебе, они по ссылкам выше. Но если кратко: файловая шара, радио, файловый хостинг с ограниченным временем хранения, ну и git сервер мой, можешь порыться в нем.</p>
|
||||
<p>Изначально завел небольшой сайт на neocities, но быстро стало нехватать всякого (например, шаблонов, чтобы везде одно и то же не менять), потому переехал полностью на свой сервер, а там, по сути, оставил только ссылки.</p>
|
||||
<p>Да, я веду сайт изначально на английском чисто для большего охвата аудитории и практики, ибо как ни крути, а английский не скоро перестанет быть доминирующим языком международного общения, да и тупо лень вести на двух языках сайт, да и технически так и не решил пока как локализовать. Однако, один посетитель справедливо пожурил меня, что надо хотя бы на главной, но чтобы русский был. :)</p>
|
||||
</section>
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3,7 +3,78 @@ package web
|
||||
import "net/http"
|
||||
|
||||
import "git.arav.su/Arav/dwelling-home/pkg/mindflow"
|
||||
import "git.arav.su/Arav/dwelling-home/pkg/util"
|
||||
import "strconv"
|
||||
import "time"
|
||||
|
||||
templ MindflowAdmin(posts []mindflow.Post, categories []mindflow.Category, r *http.Request) {
|
||||
@base("Mindflow Administration", "", "", "/mindflow/admin", r, nil)
|
||||
@base("Mindflow Administration", "", "", "/mindflow/admin", r, mindflowAdminHead()) {
|
||||
<section>
|
||||
<h2>Manage categories</h2>
|
||||
<form id="manage-categories">
|
||||
<select name="category" required>
|
||||
for _, c := range categories {
|
||||
<option value={ strconv.FormatInt(c.ID, 10) }>{ c.Name }</option>
|
||||
}
|
||||
<option value="0">-- New category --</option>
|
||||
</select>
|
||||
<input type="text" name="name" placeholder="New category name"/>
|
||||
<button type="submit" name="add">Add</button>
|
||||
<button type="submit" name="edit">Edit</button>
|
||||
<button type="submit" name="delete">Delete</button>
|
||||
</form>
|
||||
</section>
|
||||
<section>
|
||||
<h2>Create a new post</h2>
|
||||
<form id="add" action="/api/mindflow" method="POST">
|
||||
<select name="category" required>
|
||||
for _, c := range categories {
|
||||
<option value={ strconv.FormatInt(c.ID, 10) }>{ c.Name }</option>
|
||||
}
|
||||
</select>
|
||||
<input type="text" name="title" placeholder="Title" required/>
|
||||
<input type="text" name="url" placeholder="URL"/>
|
||||
<textarea name="body" placeholder="Body post" required></textarea>
|
||||
<button type="submit">Add</button>
|
||||
</form>
|
||||
</section>
|
||||
<section>
|
||||
for _, post := range posts {
|
||||
<article id={ post.PostID() }>
|
||||
<header>
|
||||
<a href="#{ templ.SafeURL(post.PostID()) }"><h3>{ post.Category.Name }: { post.Title }</h3></a>
|
||||
</header>
|
||||
<form class="edit">
|
||||
<select name="category" required>
|
||||
for _, c := range categories {
|
||||
if c.ID == post.Category.ID {
|
||||
<option value={ strconv.FormatInt(c.ID, 10) } selected>{ c.Name }</option>
|
||||
} else {
|
||||
<option value={ strconv.FormatInt(c.ID, 10) }>{ c.Name }</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
<input type="hidden" name="post-id" value={ strconv.FormatInt(post.ID, 10) }/>
|
||||
<input type="text" name="title" placeholder="Title" required/>
|
||||
<input type="text" name="url" placeholder="URL" value={ post.URL }>
|
||||
<textarea name="body" placeholder="Body post" required>@templ.Raw(post.Body)</textarea>
|
||||
<button name="edit-post">Edit</button>
|
||||
<button name="delete-post">Delete</button>
|
||||
</form>
|
||||
<footer>
|
||||
<time datetime={ util.ToClientTimezone(post.Date, r).Format(time.RFC3339) }>{ util.ToClientTimezone(post.Date, r).Format(time.RFC1123) }</time>
|
||||
</footer>
|
||||
</article>
|
||||
}
|
||||
if len(posts) == 0 {
|
||||
<p class="center">Nothing? There must be some... Looks like database went down.</p>
|
||||
}
|
||||
</section>
|
||||
}
|
||||
}
|
||||
|
||||
templ mindflowAdminHead() {
|
||||
<link rel="stylesheet" href="/assets/css/mindflow.css">
|
||||
<link rel="stylesheet" href="/assets/css/mindflow_admin.css">
|
||||
<script src="/assets/js/mindflow_admin.js" defer></script>
|
||||
}
|
@ -106,7 +106,7 @@ templ Stuff(r *http.Request) {
|
||||
</tr>
|
||||
<tr>
|
||||
<td><b>httpprocprobed</b></td>
|
||||
<td>3.1.1 (13 January 2024)</td>
|
||||
<td>3.2.0 (7 July 2024)</td>
|
||||
<td>Go</td>
|
||||
<td>MIT+NIGGER</td>
|
||||
<td>
|
||||
|
@ -1,66 +0,0 @@
|
||||
extends base.pug
|
||||
|
||||
block meta_description
|
||||
meta(name='description' content='Here I will post updates on my infrastructure, my very important opinions and thoughts.')
|
||||
|
||||
block append head
|
||||
link(href='/assets/css/mindflow.css' rel='stylesheet')
|
||||
link(href='/assets/css/mindflow_admin.css' rel='stylesheet')
|
||||
script(src='/assets/js/mindflow_admin.js' defer='')
|
||||
|
||||
block nav
|
||||
a(href='/') Home
|
||||
a(href='/stuff') Stuff
|
||||
a(href='/mindflow') Mindflow
|
||||
a(href='/about') About
|
||||
a(href='/guestbook') Guestbook
|
||||
h1 Mindflow Admin
|
||||
|
||||
block content
|
||||
:go:func MindflowAdmin(title string, posts []mindflow.Post, categories []mindflow.Category, r *http.Request)
|
||||
section
|
||||
h2 Manage categories
|
||||
form(id='manage-categories')
|
||||
select(name='category' required='')
|
||||
each category in categories
|
||||
option(value=category.ID) #{category.Name}
|
||||
option(value='0') -- New category --
|
||||
input(type='text', placeholder='New category name' name='name')
|
||||
button(type="submit" name="add") Add
|
||||
button(type="submit" name="edit") Edit
|
||||
button(type="submit" name="delete") Delete
|
||||
|
||||
section
|
||||
h2 Create a new post
|
||||
form(id='add' action='/api/mindflow', method='POST')
|
||||
select(name='category' required='')
|
||||
each category in categories
|
||||
option(value=category.ID) #{category.Name}
|
||||
input(type='text', placeholder='Title' name='title' required='')
|
||||
input(type='text', placeholder='URL' name='url')
|
||||
textarea(placeholder='Body post' name='body' required='')
|
||||
button(type="submit") Add
|
||||
section
|
||||
if (len(posts) > 0)
|
||||
each post in posts
|
||||
article(id=post.PostID())
|
||||
header
|
||||
a(href=`#${post.PostID()}`)
|
||||
h3= post.Category.Name + ": " + post.Title
|
||||
form.edit
|
||||
select(name='category' required='')
|
||||
each category in categories
|
||||
if (category.ID == post.Category.ID)
|
||||
option(value=category.ID selected='') #{category.Name}
|
||||
else
|
||||
option(value=category.ID) #{category.Name}
|
||||
input(type='hidden', name='post-id' value=post.ID)
|
||||
input(type='text', placeholder='Title' name='title' value=post.Title required='')
|
||||
input(type='text', placeholder='URL' name='url' value=post.URL)
|
||||
textarea(placeholder='Body post' name='body' required='')!= post.Body
|
||||
button(name='edit-post') Edit
|
||||
button(name='delete-post') Delete
|
||||
footer
|
||||
time(datetime=util.ToClientTimezone(post.Date, r))= util.ToClientTimezone(post.Date, r).Format(time.RFC1123)
|
||||
else
|
||||
p.center Nothing? There must be some... Looks like database went down.
|
Loading…
Reference in New Issue
Block a user