226 Commits

Author SHA1 Message Date
ngn
c287ffa086 fix showing the active link in the navbar
All checks were successful
Build the docker image for the API / build (push) Successful in 2m16s
Build the docker image for the frontend application / build (push) Successful in 40s
Signed-off-by: ngn <ngn@ngn.tf>
2025-07-11 22:00:56 +03:00
ngn
26d656896e Merge pull request 'Update dependency @sveltejs/kit to v2.22.5' (#85) from renovate/sveltejs-kit-2.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 53s
Reviewed-on: #85
2025-07-11 19:00:38 +03:00
ngn
734bbdb998 Merge pull request 'Update dependency prettier to v3.6.2' (#82) from renovate/prettier-3.x-lockfile into main
Some checks failed
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #82
2025-07-11 19:00:24 +03:00
ngn
7e8a927bb3 Merge pull request 'Update dependency svelte to v5.35.6' (#84) from renovate/svelte-5.x-lockfile into main
Some checks failed
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #84
2025-07-11 19:00:13 +03:00
ngn
f08b04e710 Merge pull request 'Update dependency marked to v16' (#86) from renovate/marked-16.x into main
Some checks failed
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #86
2025-07-11 19:00:03 +03:00
ngn
fa6c1d8b2c Merge pull request 'Update golang Docker tag to v1.24.5' (#88) from renovate/golang-1.x into main
All checks were successful
Build the docker image for the API / build (push) Successful in 3m18s
Reviewed-on: #88
2025-07-11 18:59:50 +03:00
ngn
0c1e07b779 Merge pull request 'Update dependency @sveltejs/adapter-node to v5.2.13' (#87) from renovate/sveltejs-adapter-node-5.x-lockfile into main
Some checks failed
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #87
2025-07-11 18:59:40 +03:00
c615409a42 Update dependency svelte to v5.35.6 2025-07-11 02:05:09 +00:00
da50365380 Update dependency @sveltejs/kit to v2.22.5 2025-07-10 12:04:52 +00:00
68f5480ff1 Update golang Docker tag to v1.24.5 2025-07-09 21:04:42 +00:00
12216ca0f7 Update dependency @sveltejs/adapter-node to v5.2.13 2025-07-09 17:04:35 +00:00
7e407b181d Update dependency marked to v16 2025-06-27 07:05:17 +00:00
4f0e911407 Update dependency prettier to v3.6.2 2025-06-27 07:05:11 +00:00
ngn
b447c8cf13 Merge pull request 'Update dependency svelte to v5.34.7' (#80) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 41s
Reviewed-on: #80
2025-06-20 11:36:23 +03:00
ngn
e212d43bf2 Merge pull request 'Update dependency @sveltejs/kit to v2.22.0' (#81) from renovate/sveltejs-kit-2.x-lockfile into main
Some checks failed
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #81
2025-06-20 11:36:13 +03:00
2bf94c0f3c Update dependency @sveltejs/kit to v2.22.0 2025-06-20 07:05:19 +00:00
3f49d8294a Update dependency svelte to v5.34.7 2025-06-19 17:04:56 +00:00
ngn
323b76fe98 Merge pull request 'Update dependency svelte to v5.34.4' (#79) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 42s
Reviewed-on: #79
2025-06-18 02:24:41 +03:00
f714bc6eaa Update dependency svelte to v5.34.4 2025-06-17 21:04:15 +00:00
ngn
8ad2778dd0 Merge pull request 'Update dependency @sveltejs/kit to v2.21.5' (#77) from renovate/sveltejs-kit-2.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 38s
Reviewed-on: #77
2025-06-14 20:19:29 +03:00
ngn
0d99a7da69 Merge pull request 'Update dependency svelte to v5.34.3' (#78) from renovate/svelte-5.x-lockfile into main
Some checks failed
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #78
2025-06-14 20:19:17 +03:00
c049f6c44a Update dependency svelte to v5.34.3 2025-06-14 17:05:11 +00:00
9acbe212ad Update dependency @sveltejs/kit to v2.21.5 2025-06-13 07:04:12 +00:00
ngn
aa29cca4f4 Merge pull request 'Update dependency svelte to v5.34.1' (#76) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 48s
Reviewed-on: #76
2025-06-12 11:04:53 +03:00
afc0a30660 Update dependency svelte to v5.34.1 2025-06-12 02:03:58 +00:00
ngn
647634addc Merge pull request 'Update dependency @sveltejs/kit to v2.21.4' (#74) from renovate/sveltejs-kit-2.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 37s
Reviewed-on: #74
2025-06-10 20:37:43 +03:00
ngn
dba65911a6 Merge pull request 'Update dependency svelte to v5.33.19' (#75) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 39s
Reviewed-on: #75
2025-06-10 20:36:40 +03:00
1067d0a3fd Update dependency svelte to v5.33.19 2025-06-10 17:04:40 +00:00
1ffd51b641 Update dependency @sveltejs/kit to v2.21.4 2025-06-10 17:04:36 +00:00
ngn
cd97df5f21 Merge pull request 'Update dependency svelte to v5.33.18' (#71) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 43s
Reviewed-on: #71
2025-06-10 19:41:54 +03:00
ngn
12dedf3700 Merge pull request 'Update dependency @sveltejs/kit to v2.21.3' (#72) from renovate/sveltejs-kit-2.x-lockfile into main
Some checks failed
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #72
2025-06-10 19:41:42 +03:00
ngn
ade745cdc5 Merge pull request 'Update golang Docker tag to v1.24.4' (#73) from renovate/golang-1.x into main
All checks were successful
Build the docker image for the API / build (push) Successful in 2m54s
Reviewed-on: #73
2025-06-10 19:41:32 +03:00
ab5977eaae Update dependency @sveltejs/kit to v2.21.3 2025-06-09 02:03:38 +00:00
39813d246f Update dependency svelte to v5.33.18 2025-06-08 12:04:00 +00:00
975626fc5c Update golang Docker tag to v1.24.4 2025-06-05 21:04:27 +00:00
ngn
1f47d59760 Merge pull request 'Update dependency svelte to v5.33.13' (#70) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 47s
Reviewed-on: #70
2025-06-02 16:13:18 +03:00
38abe411a8 Update dependency svelte to v5.33.13 2025-06-02 02:04:01 +00:00
ngn
e7216d51e3 Merge pull request 'Update dependency svelte to v5.33.12' (#69) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 45s
Reviewed-on: #69
2025-06-02 00:56:30 +03:00
2b244645c6 Update dependency svelte to v5.33.12 2025-06-01 21:04:14 +00:00
ngn
43589f7ddc Merge pull request 'Update dependency svelte to v5.33.11' (#68) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 58s
Reviewed-on: #68
2025-06-01 14:10:29 +03:00
b43a219fb3 Update dependency svelte to v5.33.11 2025-05-31 21:09:20 +00:00
ngn
7bf92f9049 Merge pull request 'Update dependency svelte to v5.33.6' (#67) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 54s
Reviewed-on: #67
2025-05-29 10:40:39 +03:00
577195cb7f Update dependency svelte to v5.33.6 2025-05-29 07:04:18 +00:00
ngn
fc64b742bb Merge pull request 'Update dependency svelte to v5.33.1' (#66) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 1m7s
Reviewed-on: #66
2025-05-23 16:50:39 +03:00
922eaeb124 Update dependency svelte to v5.33.1 2025-05-23 02:05:57 +00:00
ngn
65ec5a51aa Merge pull request 'Update dependency svelte to v5.33.0' (#63) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 1m8s
Reviewed-on: #63
2025-05-22 23:34:57 +03:00
ngn
8036b0c1e1 Merge pull request 'Update module github.com/gofiber/fiber/v2 to v2.52.8' (#65) from renovate/github.com-gofiber-fiber-v2-2.x into main
All checks were successful
Build the docker image for the API / build (push) Successful in 2m53s
Reviewed-on: #65
2025-05-22 23:34:41 +03:00
ngn
c505698b0b fix the pages directory in doc server Dockerfile
All checks were successful
Build the docker image for the doc server / build (push) Successful in 1m1s
Signed-off-by: ngn <ngn@ngn.tf>
2025-05-22 20:15:03 +03:00
ngn
4e08375748 Merge branch 'main' of https://git.ngn.tf/ngn/website
Some checks failed
Build the docker image for the doc server / build (push) Failing after 15s
2025-05-22 20:12:41 +03:00
ngn
912bf616b6 update doc server to ctorm 1.8.1
Signed-off-by: ngn <ngn@ngn.tf>
2025-05-22 20:12:05 +03:00
d1ddbf2605 Update dependency svelte to v5.33.0 2025-05-22 17:07:27 +00:00
66b01bd58d Update module github.com/gofiber/fiber/v2 to v2.52.8 2025-05-22 07:06:48 +00:00
ngn
01468670e3 Merge pull request 'Update dependency marked to v15.0.12' (#62) from renovate/marked-15.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 1m11s
Reviewed-on: #62
2025-05-20 15:48:20 +03:00
ngn
1f09aae11e revert ce1ac7b09e
All checks were successful
Build the docker image for the doc server / build (push) Successful in 11s
revert Merge pull request 'Update ghcr.io/ngn13/ctorm Docker tag to v1.8' (#61) from renovate/ghcr.io-ngn13-ctorm-1.x into main

Reviewed-on: #61
2025-05-20 15:47:59 +03:00
ngn
ce1ac7b09e Merge pull request 'Update ghcr.io/ngn13/ctorm Docker tag to v1.8' (#61) from renovate/ghcr.io-ngn13-ctorm-1.x into main
Some checks failed
Build the docker image for the doc server / build (push) Has been cancelled
Reviewed-on: #61
2025-05-20 15:47:32 +03:00
f9faddf660 Update dependency marked to v15.0.12 2025-05-20 07:07:09 +00:00
945f1b84f2 Update ghcr.io/ngn13/ctorm Docker tag to v1.8 2025-05-20 02:07:44 +00:00
ngn
a9d2633107 Merge branch 'main' of https://git.ngn.tf/ngn/website 2025-05-20 01:17:34 +03:00
ngn
506d16e0c9 update the readme formatting, remove old assets
Signed-off-by: ngn <ngn@ngn.tf>
2025-05-20 01:17:04 +03:00
ngn
30c3b0c37b Merge pull request 'Update dependency dompurify to v3.2.6' (#59) from renovate/dompurify-3.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 1m8s
Reviewed-on: #59
2025-05-20 01:13:59 +03:00
ngn
2da4f81a6b Merge pull request 'Update dependency svelte to v5.31.1' (#60) from renovate/svelte-5.x-lockfile into main
Some checks failed
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #60
2025-05-20 01:13:49 +03:00
cc482fc0ad Update dependency svelte to v5.31.1 2025-05-19 21:21:28 +00:00
51ea22fbc5 Update dependency dompurify to v3.2.6 2025-05-19 17:05:37 +00:00
ngn
58595d5eb3 Merge pull request 'Update dependency @sveltejs/kit to v2.21.1' (#50) from renovate/sveltejs-kit-2.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 1m13s
Reviewed-on: #50
2025-05-19 16:26:10 +03:00
ngn
671d44017f Merge pull request 'Update github.com/ngn13/ortam digest to 8dea816' (#57) from renovate/github.com-ngn13-ortam-digest into main
All checks were successful
Build the docker image for the API / build (push) Successful in 2m40s
Reviewed-on: #57
2025-05-19 16:25:55 +03:00
ngn
95d24b734b Merge pull request 'Update dependency svelte to v5.30.2' (#49) from renovate/svelte-5.x-lockfile into main
Some checks failed
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #49
2025-05-19 16:25:33 +03:00
ngn
c2e31fb440 Merge pull request 'Update Node.js to v23.11.1' (#58) from renovate/node-23.x into main
Some checks failed
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #58
2025-05-19 16:25:22 +03:00
2d3dab5646 Update dependency @sveltejs/kit to v2.21.1 2025-05-18 21:09:17 +00:00
4b2e12b374 Update dependency svelte to v5.30.2 2025-05-18 12:09:46 +00:00
c6323cae38 Update Node.js to v23.11.1 2025-05-18 12:09:31 +00:00
e05d42a956 Update github.com/ngn13/ortam digest to 8dea816 2025-05-18 12:09:27 +00:00
ngn
426c474016 Merge pull request 'Update module github.com/mattn/go-sqlite3 to v1.14.28' (#51) from renovate/github.com-mattn-go-sqlite3-1.x into main
All checks were successful
Build the docker image for the API / build (push) Successful in 6m28s
Reviewed-on: #51
2025-05-18 14:18:43 +03:00
ngn
91ca908980 Merge pull request 'Update dependency marked to v15.0.11' (#52) from renovate/marked-15.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 3m31s
Reviewed-on: #52
2025-05-18 14:18:32 +03:00
ngn
5a61508359 Merge pull request 'Update dependency vite to v5.4.19' (#53) from renovate/vite-5.x-lockfile into main
Some checks failed
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #53
2025-05-18 14:18:22 +03:00
ngn
86c0e3cc97 Merge pull request 'Update golang Docker tag to v1.24.3' (#54) from renovate/golang-1.x into main
Some checks failed
Build the docker image for the API / build (push) Has been cancelled
Reviewed-on: #54
2025-05-18 14:18:10 +03:00
ngn
1afa33f28b Merge pull request 'Update dependency @sveltejs/adapter-auto to v6.0.1' (#55) from renovate/sveltejs-adapter-auto-6.x-lockfile into main
Some checks failed
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #55
2025-05-18 14:17:54 +03:00
ngn
a22b1e67c8 Merge pull request 'Update dependency prettier-plugin-svelte to v3.4.0' (#56) from renovate/prettier-plugin-svelte-3.x-lockfile into main
Some checks failed
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #56
2025-05-18 14:17:38 +03:00
f477b4525b Update dependency prettier-plugin-svelte to v3.4.0 2025-05-14 17:06:36 +00:00
462d35ea0d Update dependency @sveltejs/adapter-auto to v6.0.1 2025-05-12 21:03:05 +00:00
693c94274a Update golang Docker tag to v1.24.3 2025-05-06 21:03:55 +00:00
af2e5b49ae Update dependency vite to v5.4.19 2025-04-30 07:03:16 +00:00
33a31dac32 Update dependency marked to v15.0.11 2025-04-25 02:03:31 +00:00
00b7227d4d Update module github.com/mattn/go-sqlite3 to v1.14.28 2025-04-16 17:03:50 +00:00
ngn
2f9d38cd45 Merge pull request 'Update dependency @sveltejs/adapter-auto to v6' (#42) from renovate/sveltejs-adapter-auto-6.x into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 33s
Reviewed-on: #42
2025-04-13 01:12:44 +03:00
ngn
e68dd1d317 Merge pull request 'Update dependency svelte to v5.26.2' (#46) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 37s
Reviewed-on: #46
2025-04-13 01:12:02 +03:00
ngn
fe834d2778 Merge pull request 'Update dependency @sveltejs/kit to v2.20.5' (#47) from renovate/sveltejs-kit-2.x-lockfile into main
Some checks failed
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #47
2025-04-13 01:10:46 +03:00
ngn
686f51dcde Merge pull request 'Update dependency vite to v5.4.18' (#48) from renovate/vite-5.x-lockfile into main
Some checks are pending
Build the docker image for the frontend application / build (push) Waiting to run
Reviewed-on: #48
2025-04-13 01:10:35 +03:00
ngn
dc43bdb3af remove the old config library files from the API
All checks were successful
Build the docker image for the API / build (push) Successful in 2m36s
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-13 01:07:20 +03:00
ngn
05185cb82a use the ortam config library in the API
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-13 01:06:37 +03:00
ee3fa10096 Update dependency svelte to v5.26.2 2025-04-12 17:02:55 +00:00
0e4457d5fb Update dependency vite to v5.4.18 2025-04-10 07:03:05 +00:00
b95c51193e Update dependency @sveltejs/kit to v2.20.5 2025-04-09 21:03:23 +00:00
ngn
322d8d5c39 Merge pull request 'Update dependency svelte to v5.25.8' (#45) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 34s
Reviewed-on: #45
2025-04-08 05:04:24 +03:00
ngn
904e9f6d15 Merge pull request 'Update dependency marked to v15.0.8' (#44) from renovate/marked-15.x-lockfile into main
Some checks are pending
Build the docker image for the frontend application / build (push) Waiting to run
Reviewed-on: #44
2025-04-08 05:04:13 +03:00
cc4abc85fe Update dependency svelte to v5.25.8 2025-04-08 02:03:45 +00:00
73cfcea923 Update dependency marked to v15.0.8 2025-04-08 02:03:40 +00:00
ngn
90af3d0500 update the app_url config option
All checks were successful
Build the docker image for the API / build (push) Successful in 2m6s
Build the docker image for the frontend application / build (push) Successful in 37s
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-08 03:07:14 +03:00
ngn
8d16273540 add /api route to the API documentation
All checks were successful
Build the docker image for the doc server / build (push) Successful in 14s
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-08 03:00:02 +03:00
ngn
4fb78c0ab7 update frontend app version
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 35s
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-08 02:55:58 +03:00
ngn
a57a4955ba fix internal api url
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-08 02:54:23 +03:00
ngn
ccf0d8abf9 make stuff work without js
All checks were successful
Build the docker image for the API / build (push) Successful in 2m7s
Build the docker image for the frontend application / build (push) Successful in 42s
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-08 02:39:37 +03:00
ngn
b312e40204 use the correct package manager
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 36s
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-07 06:04:34 +03:00
ngn
a67bd74ced fix dockerfile by adding required build programs
Some checks failed
Build the docker image for the frontend application / build (push) Failing after 10s
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-07 06:03:00 +03:00
ngn
9a72d3f95d dump nerdfonts from the website to use locally
Some checks failed
Build the docker image for the frontend application / build (push) Failing after 20s
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-07 05:58:46 +03:00
ngn
66c96ae312 update the example compose file
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-07 05:16:56 +03:00
ngn
f779a03ae5 update app dockerfile to include new envs
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 35s
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-07 05:12:08 +03:00
ngn
bcb48d789b update the app URL env var name in API config
All checks were successful
Build the docker image for the API / build (push) Successful in 2m18s
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-07 04:57:29 +03:00
ngn
aa69525912 Merge branch 'main' of https://git.ngn.tf/ngn/website
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 44s
2025-04-07 04:49:00 +03:00
ngn
0134bd2ab1 add env vars for configuring onion and I2P urls
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-07 04:46:47 +03:00
ngn
84e477b23e Merge pull request 'Update dependency dompurify to v3.2.5' (#43) from renovate/dompurify-3.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 35s
Reviewed-on: #43
2025-04-06 00:05:18 +03:00
515dcf6a09 Update dependency dompurify to v3.2.5 2025-04-05 21:03:17 +00:00
ngn
a50cc1ff7f Merge pull request 'Update dependency @sveltejs/kit to v2.20.4' (#41) from renovate/sveltejs-kit-2.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 40s
Reviewed-on: #41
2025-04-05 23:50:09 +03:00
ngn
f2ec9479b1 Merge pull request 'Update module github.com/mattn/go-sqlite3 to v1.14.27' (#40) from renovate/github.com-mattn-go-sqlite3-1.x into main
All checks were successful
Build the docker image for the API / build (push) Successful in 2m18s
Reviewed-on: #40
2025-04-05 23:43:34 +03:00
ngn
e1eae3c05b Merge pull request 'Update dependency vite to v5.4.17' (#39) from renovate/vite-5.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 38s
Reviewed-on: #39
2025-04-05 23:38:39 +03:00
ngn
53ab201ab3 Merge pull request 'Update golang Docker tag to v1.24.2' (#36) from renovate/golang-1.x into main
All checks were successful
Build the docker image for the API / build (push) Successful in 3m4s
Reviewed-on: #36
2025-04-05 23:38:18 +03:00
ngn
c9792fb6be Merge pull request 'Update Node.js to v23.11.0' (#35) from renovate/node-23.x into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 40s
Reviewed-on: #35
2025-04-05 23:24:26 +03:00
ngn
68808a14f9 Merge pull request 'Update dependency prettier to v3.5.3' (#34) from renovate/prettier-3.x-lockfile into main
Some checks failed
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #34
2025-04-05 23:24:16 +03:00
ngn
4343192a2c Merge pull request 'Update dependency svelte to v5.25.7' (#28) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 36s
Reviewed-on: #28
2025-04-05 23:22:31 +03:00
20fb3cd685 Update dependency svelte to v5.25.7 2025-04-05 17:03:22 +00:00
906ace188b Update dependency vite to v5.4.17 2025-04-05 17:03:16 +00:00
f2a1a21a8c Update dependency prettier to v3.5.3 2025-04-05 17:03:12 +00:00
9353631931 Update dependency @sveltejs/kit to v2.20.4 2025-04-05 17:03:08 +00:00
ngn
4eb5ad6ef3 add _version to easily access app/api version
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 57s
Build the docker image for the doc server / build (push) Successful in 10s
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-05 19:52:51 +03:00
ngn
bac570615e bump frontend version
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-05 19:40:29 +03:00
ngn
037a4405b9 fix service info, update images, add meta tags
Signed-off-by: ngn <ngn@ngn.tf>
2025-04-05 19:39:10 +03:00
389a9d3df4 Update module github.com/mattn/go-sqlite3 to v1.14.27 2025-04-02 17:04:40 +00:00
921fe4255d Update dependency @sveltejs/adapter-auto to v6 2025-04-02 07:03:12 +00:00
f7e4442de5 Update Node.js to v23.11.0 2025-04-01 21:03:03 +00:00
e4d1fc21fb Update golang Docker tag to v1.24.2 2025-04-01 21:03:00 +00:00
ngn
fe6b3512fd Merge pull request 'Update dependency @sveltejs/kit to v2.20.2' (#32) from renovate/sveltejs-kit-2.x-lockfile into main
All checks were successful
Build the docker image for the frontend application / build (push) Successful in 26s
Reviewed-on: #32
2025-03-25 00:11:28 +03:00
ngn
3dbc2e0510 Merge branch 'main' of https://git.ngn.tf/ngn/website 2025-03-25 00:09:30 +03:00
ngn
26362cf89d [skip ci] add path filters to workflows
Signed-off-by: ngn <ngn@ngn.tf>
2025-03-25 00:08:09 +03:00
ngn
16288c2bcb Merge pull request 'Update dependency vite to v5.4.15' (#38) from renovate/vite-5.x-lockfile into main
All checks were successful
Build the docker image for the API / build (push) Successful in 2m26s
Build the docker image for the frontend application / build (push) Successful in 51s
Build the docker image for the doc server / build (push) Successful in 8s
Reviewed-on: #38
2025-03-25 00:06:41 +03:00
177b546fb9 Update dependency vite to v5.4.15 2025-03-24 12:03:27 +00:00
311a37ae5c Update dependency @sveltejs/kit to v2.20.2 2025-03-21 12:02:44 +00:00
ngn
4380638982 Merge pull request 'Update golang Docker tag to v1.24.0' (#29) from renovate/golang-1.x into main
All checks were successful
Build the docker image for the API / build (push) Successful in 3m6s
Build the docker image for the frontend application / build (push) Successful in 1m12s
Build the docker image for the doc server / build (push) Successful in 11s
Reviewed-on: #29
2025-02-15 01:22:48 +03:00
ngn
32e0ddaa36 Merge branch 'main' into renovate/golang-1.x 2025-02-15 01:22:38 +03:00
ngn
27c58b1174 Merge pull request 'Update dependency prettier to v3.5.1' (#30) from renovate/prettier-3.x-lockfile into main
Some checks failed
Build the docker image for the doc server / build (push) Waiting to run
Build the docker image for the API / build (push) Successful in 14s
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #30
2025-02-15 01:22:28 +03:00
d5f1325b79 Update dependency prettier to v3.5.1 2025-02-13 17:03:53 +00:00
9e27aabdb9 Update golang Docker tag to v1.24.0 2025-02-12 21:03:55 +00:00
ngn
a1967141ae Merge pull request 'Update dependency marked to v15.0.7' (#26) from renovate/marked-15.x-lockfile into main
All checks were successful
Build the docker image for the API / build (push) Successful in 8s
Build the docker image for the frontend application / build (push) Successful in 56s
Build the docker image for the doc server / build (push) Successful in 9s
Reviewed-on: #26
2025-02-12 19:49:05 +03:00
ngn
a172262dbd Merge branch 'main' into renovate/marked-15.x-lockfile 2025-02-12 19:48:58 +03:00
ngn
caee8c2a90 Merge pull request 'Update dependency svelte to v5.19.10' (#27) from renovate/svelte-5.x-lockfile into main
Some checks failed
Build the docker image for the frontend application / build (push) Waiting to run
Build the docker image for the doc server / build (push) Waiting to run
Build the docker image for the API / build (push) Has been cancelled
Reviewed-on: #27
2025-02-12 19:48:53 +03:00
060c5f0c73 Update dependency svelte to v5.19.10 2025-02-11 17:04:42 +00:00
e2796b39b8 Update dependency marked to v15.0.7 2025-02-10 02:03:06 +00:00
ngn
191c54cc9a Merge pull request 'Update dependency svelte to v5.19.9' (#24) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the API / build (push) Successful in 8s
Build the docker image for the frontend application / build (push) Successful in 47s
Build the docker image for the doc server / build (push) Successful in 7s
Reviewed-on: #24
2025-02-09 19:14:43 +03:00
ngn
87095a8c35 Merge branch 'main' into renovate/svelte-5.x-lockfile 2025-02-09 19:14:35 +03:00
ngn
a28a678693 Merge pull request 'Update dependency prettier to v3.5.0' (#25) from renovate/prettier-3.x-lockfile into main
Some checks failed
Build the docker image for the doc server / build (push) Waiting to run
Build the docker image for the API / build (push) Successful in 10s
Build the docker image for the frontend application / build (push) Has been cancelled
Reviewed-on: #25
2025-02-09 19:14:27 +03:00
d3fd1e479c Update dependency prettier to v3.5.0 2025-02-09 12:03:11 +00:00
7f97f5330e Update dependency svelte to v5.19.9 2025-02-07 02:03:20 +00:00
ngn
30286710d1 Merge pull request 'Update dependency @sveltejs/kit to v2.17.1' (#22) from renovate/sveltejs-kit-2.x-lockfile into main
All checks were successful
Build the docker image for the API / build (push) Successful in 2m43s
Build the docker image for the frontend application / build (push) Successful in 55s
Build the docker image for the doc server / build (push) Successful in 9s
Reviewed-on: #22
2025-02-05 19:09:56 +03:00
ngn
8de018bf5c Merge branch 'main' into renovate/sveltejs-kit-2.x-lockfile 2025-02-05 19:09:47 +03:00
ngn
5a73910331 Merge pull request 'Update golang Docker tag to v1.23.6' (#23) from renovate/golang-1.x into main
Some checks are pending
Build the docker image for the API / build (push) Waiting to run
Build the docker image for the frontend application / build (push) Waiting to run
Build the docker image for the doc server / build (push) Waiting to run
Reviewed-on: #23
2025-02-05 19:09:37 +03:00
53236fab61 Update golang Docker tag to v1.23.6 2025-02-04 22:03:52 +00:00
d5dfaaad96 Update dependency @sveltejs/kit to v2.17.1 2025-02-04 21:06:20 +00:00
ngn
c1e2974f1b Merge pull request 'Update dependency svelte to v5.19.7' (#20) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the API / build (push) Successful in 3m40s
Build the docker image for the frontend application / build (push) Successful in 59s
Build the docker image for the doc server / build (push) Successful in 12s
Reviewed-on: #20
2025-02-04 23:24:47 +03:00
ngn
40cdbfba36 Merge branch 'main' into renovate/svelte-5.x-lockfile 2025-02-04 23:24:39 +03:00
ngn
be8777eb67 Merge pull request 'Update dependency dompurify to v3.2.4' (#21) from renovate/dompurify-3.x-lockfile into main
Some checks failed
Build the docker image for the frontend application / build (push) Waiting to run
Build the docker image for the doc server / build (push) Waiting to run
Build the docker image for the API / build (push) Has been cancelled
Reviewed-on: #21
2025-02-04 23:24:27 +03:00
ngn
b75bd4f3b2 Merge branch 'main' into renovate/dompurify-3.x-lockfile 2025-02-04 23:24:10 +03:00
ngn
c127c62492 Merge pull request 'Update Node.js to v23.7.0' (#18) from renovate/node-23.x into main
Some checks failed
Build the docker image for the frontend application / build (push) Waiting to run
Build the docker image for the doc server / build (push) Waiting to run
Build the docker image for the API / build (push) Has been cancelled
Reviewed-on: #18
2025-02-04 23:24:01 +03:00
6a01631d22 Update dependency svelte to v5.19.7 2025-02-03 18:03:46 +00:00
1389233108 Update Node.js to v23.7.0 2025-01-31 20:04:10 +00:00
e2a4df8602 Update dependency dompurify to v3.2.4 2025-01-30 10:04:17 +00:00
ngn
b4d8ab7606 Merge pull request 'Update dependency svelte to v5.19.3' (#19) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the API / build (push) Successful in 10s
Build the docker image for the frontend application / build (push) Successful in 36s
Build the docker image for the doc server / build (push) Successful in 8s
Reviewed-on: #19
2025-01-28 07:32:31 +03:00
478834fe2f Update dependency svelte to v5.19.3 2025-01-27 11:06:42 +00:00
ngn
ba441d5192 Merge branch 'main' of https://git.ngn.tf/ngn/website
All checks were successful
Build the docker image for the API / build (push) Successful in 10s
Build the docker image for the frontend application / build (push) Successful in 9s
Build the docker image for the doc server / build (push) Successful in 8s
2025-01-22 11:22:47 +03:00
ngn
4556452f69 Merge pull request 'Update dependency @sveltejs/kit to v2.16.1' (#15) from renovate/sveltejs-kit-2.x-lockfile into main
All checks were successful
Build the docker image for the API / build (push) Successful in 9s
Build the docker image for the frontend application / build (push) Successful in 29s
Build the docker image for the doc server / build (push) Successful in 8s
Reviewed-on: #15
2025-01-22 11:18:26 +03:00
ngn
6217103c5a Merge branch 'main' into renovate/sveltejs-kit-2.x-lockfile 2025-01-22 11:18:17 +03:00
ngn
eee6c2c2d2 Merge pull request 'Update dependency vite to v5.4.14' (#16) from renovate/vite-5.x-lockfile into main
All checks were successful
Build the docker image for the API / build (push) Successful in 9s
Build the docker image for the frontend application / build (push) Successful in 29s
Build the docker image for the doc server / build (push) Successful in 8s
Reviewed-on: #16
2025-01-22 11:17:19 +03:00
ngn
db7d062662 Merge branch 'main' into renovate/vite-5.x-lockfile 2025-01-22 11:17:13 +03:00
ngn
c8a4067596 fix the admin script return value
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-22 11:12:37 +03:00
ngn
437404dfca Merge pull request 'Update dependency svelte to v5.19.1' (#17) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the API / build (push) Successful in 1m51s
Build the docker image for the frontend application / build (push) Successful in 27s
Build the docker image for the doc server / build (push) Successful in 8s
Reviewed-on: #17
2025-01-22 07:21:46 +03:00
1b24596abf Update dependency svelte to v5.19.1 2025-01-21 12:03:26 +00:00
1759261332 Update dependency vite to v5.4.14 2025-01-21 11:04:04 +00:00
3a9685511b Update dependency @sveltejs/kit to v2.16.1 2025-01-21 10:03:36 +00:00
ngn
7eac5d8bb3 Merge pull request 'Update dependency vite to v5.4.13' (#14) from renovate/vite-5.x-lockfile into main
All checks were successful
Build the docker image for the API / build (push) Successful in 10s
Build the docker image for the frontend application / build (push) Successful in 29s
Build the docker image for the doc server / build (push) Successful in 9s
Reviewed-on: #14
2025-01-21 09:10:00 +03:00
68bc30d98b Update dependency vite to v5.4.13 2025-01-20 20:02:12 +00:00
ngn
bc9b92cdd2 Merge pull request 'Update dependency vite to v5.4.12' (#12) from renovate/vite-5.x-lockfile into main
All checks were successful
Build the docker image for the API / build (push) Successful in 8s
Build the docker image for the frontend application / build (push) Successful in 27s
Build the docker image for the doc server / build (push) Successful in 8s
Reviewed-on: #12
2025-01-20 20:29:09 +03:00
ngn
e49b30b2fb Merge branch 'main' into renovate/vite-5.x-lockfile 2025-01-20 20:28:59 +03:00
ngn
01a6cf34bc Merge pull request 'Update dependency @sveltejs/adapter-auto to v4' (#9) from renovate/sveltejs-adapter-auto-4.x into main
All checks were successful
Build the docker image for the API / build (push) Successful in 9s
Build the docker image for the frontend application / build (push) Successful in 30s
Build the docker image for the doc server / build (push) Successful in 8s
Reviewed-on: #9
2025-01-20 20:27:31 +03:00
ngn
3ab85605c6 Merge branch 'main' into renovate/sveltejs-adapter-auto-4.x 2025-01-20 20:27:23 +03:00
ngn
2bfc4886c8 Merge pull request 'Update dependency svelte to v5.19.0' (#8) from renovate/svelte-5.x-lockfile into main
All checks were successful
Build the docker image for the API / build (push) Successful in 9s
Build the docker image for the frontend application / build (push) Successful in 29s
Build the docker image for the doc server / build (push) Successful in 8s
Reviewed-on: #8
2025-01-20 20:07:37 +03:00
ngn
e861bb4030 Merge branch 'main' into renovate/svelte-5.x-lockfile 2025-01-20 20:07:28 +03:00
ngn
002044232f Merge pull request 'Update dependency @sveltejs/kit to v2.16.0' (#7) from renovate/sveltejs-kit-2.x-lockfile into main
All checks were successful
Build the docker image for the API / build (push) Successful in 9s
Build the docker image for the frontend application / build (push) Successful in 31s
Build the docker image for the doc server / build (push) Successful in 8s
Reviewed-on: #7
2025-01-20 20:06:26 +03:00
7facbbdeb2 Update dependency svelte to v5.19.0 2025-01-20 17:02:04 +00:00
55038a9745 Update dependency @sveltejs/kit to v2.16.0 2025-01-20 17:02:00 +00:00
665fb2e34c Update dependency vite to v5.4.12 2025-01-20 17:01:55 +00:00
ngn
f0e168c684 Merge pull request 'Update golang Docker tag to v1.23.5' (#4) from renovate/golang-1.x into main
All checks were successful
Build the docker image for the API / build (push) Successful in 2m5s
Build the docker image for the frontend application / build (push) Successful in 8s
Build the docker image for the doc server / build (push) Successful in 8s
Reviewed-on: #4
2025-01-20 19:45:41 +03:00
ngn
e13ccd2e3e Merge branch 'main' into renovate/golang-1.x 2025-01-20 19:45:32 +03:00
ngn
6e07adb59d Merge pull request 'Update module github.com/gofiber/fiber/v2 to v2.52.6' (#5) from renovate/github.com-gofiber-fiber-v2-2.x into main
All checks were successful
Build the docker image for the API / build (push) Successful in 1m55s
Build the docker image for the frontend application / build (push) Successful in 10s
Build the docker image for the doc server / build (push) Successful in 7s
Reviewed-on: #5
2025-01-20 19:41:56 +03:00
ngn
7239df94dd Merge branch 'main' into renovate/github.com-gofiber-fiber-v2-2.x 2025-01-20 19:41:47 +03:00
ngn
ec7afca33d Merge branch 'main' into renovate/golang-1.x 2025-01-20 19:40:46 +03:00
ngn
565ed66f70 Merge pull request 'Update Node.js to v23.6.0' (#6) from renovate/node-23.x into main
All checks were successful
Build the docker image for the API / build (push) Successful in 8s
Build the docker image for the frontend application / build (push) Successful in 50s
Build the docker image for the doc server / build (push) Successful in 8s
Reviewed-on: #6
2025-01-20 19:40:28 +03:00
ngn
12da87479c Merge branch 'main' into renovate/node-23.x 2025-01-20 19:40:15 +03:00
ngn
db3f0ed29a Merge pull request 'Update dependency prettier-plugin-svelte to v3.3.3' (#3) from renovate/prettier-plugin-svelte-3.x-lockfile into main
All checks were successful
Build the docker image for the API / build (push) Successful in 9s
Build the docker image for the frontend application / build (push) Successful in 30s
Build the docker image for the doc server / build (push) Successful in 8s
Reviewed-on: #3
2025-01-20 19:37:24 +03:00
ngn
2b13b2e1ca Merge branch 'main' into renovate/prettier-plugin-svelte-3.x-lockfile 2025-01-20 19:37:17 +03:00
ngn
914d1abf64 Merge pull request 'Update dependency @sveltejs/vite-plugin-svelte to v4.0.4' (#2) from renovate/sveltejs-vite-plugin-svelte-4.x-lockfile into main
All checks were successful
Build the docker image for the API / build (push) Successful in 9s
Build the docker image for the frontend application / build (push) Successful in 29s
Build the docker image for the doc server / build (push) Successful in 8s
Reviewed-on: #2
2025-01-20 19:31:26 +03:00
ngn
03564197a2 Merge branch 'main' into renovate/sveltejs-vite-plugin-svelte-4.x-lockfile 2025-01-20 19:31:13 +03:00
ngn
8e49322395 update repo name in the badge urls
All checks were successful
Build the docker image for the API / build (push) Successful in 9s
Build the docker image for the frontend application / build (push) Successful in 8s
Build the docker image for the doc server / build (push) Successful in 9s
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-20 19:25:56 +03:00
ngn
af8c26511a add gitea workflow badges
All checks were successful
Build the docker image for the API / build (push) Successful in 8s
Build the docker image for the frontend application / build (push) Successful in 8s
Build the docker image for the doc server / build (push) Successful in 9s
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-20 19:24:47 +03:00
ngn
5813338232 get rid of the readme badges
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-20 19:23:01 +03:00
ngn
29b8caab34 get rid of dependabot
All checks were successful
Build the docker image for the API / build (push) Successful in 8s
Build the docker image for the frontend application / build (push) Successful in 9s
Build the docker image for the doc server / build (push) Successful in 8s
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-20 19:20:31 +03:00
ngn
3a78818e8d Merge pull request 'Update dependency @sveltejs/adapter-node to v5.2.12' (#1) from renovate/sveltejs-adapter-node-5.x-lockfile into main
All checks were successful
Build the docker image for the API / build (push) Successful in 10s
Build the docker image for the frontend application / build (push) Successful in 29s
Build the docker image for the doc server / build (push) Successful in 7s
Reviewed-on: #1
2025-01-20 19:15:01 +03:00
c53103352e Update dependency prettier-plugin-svelte to v3.3.3 2025-01-20 08:02:26 +00:00
442c1d2ca7 Update dependency @sveltejs/vite-plugin-svelte to v4.0.4 2025-01-20 08:02:22 +00:00
803506153f Update dependency @sveltejs/adapter-node to v5.2.12 2025-01-20 08:02:16 +00:00
ngn
01205d6a1f add API_PASSWORD env and update screenshots
All checks were successful
Build the docker image for the API / build (push) Successful in 9s
Build the docker image for the frontend application / build (push) Successful in 9s
Build the docker image for the doc server / build (push) Successful in 8s
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-20 10:14:57 +03:00
ce40a002b7 Update dependency @sveltejs/adapter-auto to v4 2025-01-20 07:02:26 +00:00
7d5b649bd7 Update Node.js to v23.6.0 2025-01-20 07:02:13 +00:00
29937d3af2 Update module github.com/gofiber/fiber/v2 to v2.52.6 2025-01-20 07:02:11 +00:00
b2cdd937b6 Update golang Docker tag to v1.23.5 2025-01-20 07:02:04 +00:00
ngn
21c5a2ee53 [skip ci] add renovate config
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-20 09:44:07 +03:00
ngn
392b554eb9 fix add_news command in admin.py
All checks were successful
Build the docker image for the API / build (push) Successful in 10s
Build the docker image for the frontend application / build (push) Successful in 27s
Build the docker image for the doc server / build (push) Successful in 7s
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-20 09:38:31 +03:00
ngn
1c99aee43d forgor to change dir in the workflows
All checks were successful
Build the docker image for the API / build (push) Successful in 2m8s
Build the docker image for the frontend application / build (push) Successful in 1m0s
Build the docker image for the doc server / build (push) Successful in 31s
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-20 08:07:43 +03:00
ngn
d38c4d71a4 fix the workflow branch
Some checks failed
Build the docker image for the API / build (push) Failing after 8s
Build the docker image for the frontend application / build (push) Failing after 7s
Build the docker image for the doc server / build (push) Failing after 8s
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-20 08:05:17 +03:00
ngn
bd34b874ca add gitea docker workflows
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-20 08:04:04 +03:00
ngn
95986d170d Merge pull request #243 from ngn13/rework
Yet another rework
2025-01-19 20:54:41 +00:00
ngn
fb58722216 add the new version to README
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-18 04:51:53 +03:00
ngn
fa2f3acb35 cleanup for the docker setup
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-18 03:31:37 +03:00
ngn
ecaa6fb68f some little fixes
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-17 04:41:57 +03:00
ngn
3398324664 add privacy documentation
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-17 04:23:34 +03:00
ngn
6f7263dd84 finish up the documentation page
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-17 02:42:32 +03:00
ngn
e87764a4c2 documentation server and /doc route
Signed-off-by: ngn <ngn@ngn.tf>
2025-01-16 07:46:27 +03:00
ngn
5fb3c03e40 finish up translations and setup doc server stuff 2025-01-10 00:16:06 +03:00
ngn
ac307de76c add projects and metrics routes 2025-01-09 00:30:59 +03:00
ngn
dee3ef4d85 add the visitor API endpoint 2025-01-08 00:20:11 +03:00
121 changed files with 4495 additions and 1225 deletions

View File

@ -0,0 +1,30 @@
name: Build the docker image for the API
on:
push:
branches: ["main"]
paths: ["api/**"]
env:
REGISTRY: git.ngn.tf
IMAGE: ${{gitea.repository}}/api
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: "https://github.com/actions/checkout@v4"
- name: Login to container repo
uses: "https://github.com/docker/login-action@v1"
with:
registry: ${{env.REGISTRY}}
username: ${{gitea.actor}}
password: ${{secrets.PACKAGES_TOKEN}}
- name: Build image
run: |
cd api
docker build --tag ${{env.REGISTRY}}/${{env.IMAGE}}:latest .
docker push ${{env.REGISTRY}}/${{env.IMAGE}}:latest

View File

@ -0,0 +1,35 @@
name: Build the docker image for the frontend application
on:
push:
branches: ["main"]
paths: ["app/**"]
env:
REGISTRY: git.ngn.tf
IMAGE: ${{gitea.repository}}/app
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: "https://github.com/actions/checkout@v4"
- name: Login to container repo
uses: "https://github.com/docker/login-action@v1"
with:
registry: ${{env.REGISTRY}}
username: ${{gitea.actor}}
password: ${{secrets.PACKAGES_TOKEN}}
- name: Build image
run: |
cd app
docker build --build-arg WEBSITE_REPORT_URL=https://git.ngn.tf/ngn/website/issues/new \
--build-arg WEBSITE_SOURCE_URL=https://git.ngn.tf/ngn/website \
--build-arg WEBSITE_DOC_URL=http://doc:7003 \
--build-arg WEBSITE_API_URL=http://api:7002 \
--build-arg WEBSITE_API_PATH=/api \
--tag ${{env.REGISTRY}}/${{env.IMAGE}}:latest .
docker push ${{env.REGISTRY}}/${{env.IMAGE}}:latest

View File

@ -0,0 +1,30 @@
name: Build the docker image for the doc server
on:
push:
branches: ["main"]
paths: ["doc/**"]
env:
REGISTRY: git.ngn.tf
IMAGE: ${{gitea.repository}}/doc
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: "https://github.com/actions/checkout@v4"
- name: Login to container repo
uses: "https://github.com/docker/login-action@v1"
with:
registry: ${{env.REGISTRY}}
username: ${{gitea.actor}}
password: ${{secrets.PACKAGES_TOKEN}}
- name: Build image
run: |
cd doc
docker build --tag ${{env.REGISTRY}}/${{env.IMAGE}}:latest .
docker push ${{env.REGISTRY}}/${{env.IMAGE}}:latest

View File

@ -1,21 +0,0 @@
version: 2
updates:
- package-ecosystem: "npm"
directory: "/app"
schedule:
interval: "daily"
- package-ecosystem: "gomod"
directory: "/api"
schedule:
interval: "daily"
- package-ecosystem: "docker"
directory: "/app"
schedule:
interval: "weekly"
- package-ecosystem: "docker"
directory: "/api"
schedule:
interval: "weekly"

9
.gitignore vendored
View File

@ -1,2 +1,11 @@
data.db
*.yaml *.yaml
*.yml
*.env *.env
# don't ignore example deployment stuff
!deploy/*
!.github/*
!.gitea/*
!.github/*/*
!.gitea/*/*

13
Makefile Normal file
View File

@ -0,0 +1,13 @@
SERVERS = app api doc
all: $(SERVERS)
for server in $^ ; do \
make -C $$server ; \
done
format:
for server in $(SERVERS) ; do \
make -C $$server format ; \
done
.PHONY: format

157
README.md
View File

@ -1,94 +1,115 @@
# website | my personal website # website | my personal website
![Version](https://img.shields.io/github/package-json/v/ngn13/ngn13.fun?filename=app%2Fpackage.json&color=blue)
![Website Status](https://img.shields.io/website?up_color=green&down_color=red&url=https%3A%2F%2Fngn.tf&label=Website%20Status)
![API Status](https://img.shields.io/website?up_color=green&down_color=red&url=https%3A%2F%2Fapi.ngn.tf&label=API%20Status)
This repo contains all the source code for my personal website, [ngn.tf](https://ngn.tf) ![](https://git.ngn.tf/ngn/website/actions/workflows/build-app.yml/badge.svg)
All code is licensed under AGPL version 3 (see [LICENSE.txt](LICENSE.txt)) ![](https://git.ngn.tf/ngn/website/actions/workflows/build-api.yml/badge.svg)
![](https://git.ngn.tf/ngn/website/actions/workflows/build-doc.yml/badge.svg)
This repo contains all the source code for my personal website,
[ngn.tf](https://ngn.tf) All code is licensed under AGPL version 3 (see
[LICENSE.txt](LICENSE.txt))
## Directory structure ## Directory structure
### `app` ### `app`
Contains frontend application, written with SvelteKit. It supports full SSR. Contains frontend application, written with SvelteKit. It supports full SSR.
Contains modified CSS from [github-markdown-css](https://github.com/sindresorhus/github-markdown-css) Contains modified CSS from
and fonts from [NerdFonts](https://www.nerdfonts.com/) [github-markdown-css](https://github.com/sindresorhus/github-markdown-css) and
fonts from [NerdFonts](https://www.nerdfonts.com/)
### `api` ### `api`
Contains the API server, written in Go. It uses the [Fiber](https://github.com/gofiber/fiber) web
framework which offers an [Express](https://expressjs.com/) like experience. I choose Fiber since I've used worked with express a lot in the past. However previously the I was using Contains the API server, written in Go. It uses the
[Fiber](https://github.com/gofiber/fiber) web framework which offers an
[Express](https://expressjs.com/) like experience. I choose Fiber since I've
used worked with express a lot in the past. However previously the I was using
[Gin](https://github.com/gin-gonic/gin) (see history section). [Gin](https://github.com/gin-gonic/gin) (see history section).
API stores all the data in a local sqlite(3) database. Go doesn't support sqlite3 out of the box so API stores all the data in a local SQLite(3) database. Go doesn't support
I'm using [mattn's sqlite3 driver](https://github.com/mattn/go-sqlite3). SQLite3 out of the box so I'm using
[mattn's sqlite3 driver](https://github.com/mattn/go-sqlite3).
### `doc`
Contains the documentation server, written in C. It uses the
[ctorm](https://github.com/ngn13/ctorm) web framework, which is a framework that
I myself wrote. Unlike the frontend application or the API server, it's not
accessable by public, the frontend application gets the documentation content
from this server and renders it using SSR. The reason I don't use the API for
hosting the documentation content is that I want a separate server for hosting
static content, API is only for hosting dynamic stuff.
### `admin` ### `admin`
The frontend application does not contain an admin interface, I do the administration stuff (such as
adding posts, adding services etc.) using the python script in this directory. This script can be The frontend application does not contain an admin interface, I do the
installed on to the PATH by running the `install.sh` script. After installation it can be used administration stuff (such as adding news posts, adding services etc.) using the
by running `admin_script`. python script in this directory. This script can be installed on to the PATH by
running the Makefile install script. After installation it can be used by
running `admin_script`.
## Deployment ## Deployment
Easiest way to deploy is to use docker. I have created a `compose.yml` file so the API and the
frontend application can be deployed easily with just the `docker-compose up` command:
```yaml
version: "3"
services:
app:
build:
context: ./app
args:
API_URL: https://api.ngn.tf
ports:
- "127.0.0.1:7002:3000"
depends_on:
- api
api: Easiest way to deploy is to use docker. There is `compose.yml` and a `run.sh`
build: script in the [deploy](deploy/) directory that can be used to startup all the
context: ./api docker containers. Configuration options are passed during build time for the
environment: frontend application, and for others it's passed with environment variables.
- API_PASSWORD="securepassword"
- API_FRONTEND_URL="https://ngn.tf"
ports:
- "127.0.0.1:7001:7001"
volumes:
- ./api/data.db:/app/data.db
```
## History ## History
Some nostalgic history/changelog stuff (just for the major version numbers): Some nostalgic history/changelog stuff (just for the major version numbers):
- **v0.1 (late 2020 - early 2021)**: First ever version of my website, it was just a simple HTML/CSS page, - **v0.1 (late 2020 - early 2021)**: First ever version of my website, it was
I never published any of the source code and I wiped the local copy on my USB drive in early 2022 just a simple HTML/CSS page, I never published any of the source code and I
wiped the local copy on my USB drive in early 2022, I still remember what it
looked like though, it looked like I made entire website in microsoft paint...
while blindfoled, so yeah it was shit.
- **v1.0 (early 2021 - late 2022)**: This version was actualy hosted on my github.io page, and all the source code - **v1.0 (early 2021 - late 2022)**: This version was actualy hosted on my
was (and still is) avaliable, it was just a simple static site, [here is a screenshot](assets/githubio.png) github.io page, and all the source code was (and still is) avaliable, it was
just a simple static site, [here is a screenshot](assets/githubio.png).
- **vLOST (late 2022 - early 2023)**: As I learned more JS, I decided to rewrite (and rework) - **vLOST (late 2022 - early 2023)**: As I learned more JS, I decided to rewrite
my website with one of the fancy JS frameworks. I decided to go with Svelte. Not the kit version, (and rework) my website with one of the fancy JS frameworks. I decided to go
at the time svelte did not support SSR. I do not remember writting an API for it so I guess I just with Svelte. Not the kit version, at the time svelte did not support SSR. I do
updated it everytime I wanted to add content? It was pretty much like a static website and was hosted not remember writting an API for it so I guess I just updated it everytime I
on `ngn13.fun` as at this point I had my own hosting. The source code for this website was in a wanted to add content? It was pretty much like a static website and was hosted
deleted github repository of mine, I looked for a local copy on my old hard drive but I wasn't able on `ngn13.fun` as at this point I had my own hosting. The source code for this
to find it. I also do not remember how it looked like, sooo this version is pretty much lost :( website was in a deleted github repository of mine, I looked for a local copy
on my old hard drive but I wasn't able to find it. I also do not remember how
it looked like, sooo this version is pretty much lost :(
- **v2.0 (early 2023 - late 2023)**: After I discovered what SSR is, I decided to rewrite and rework - **v2.0 (early 2023 - late 2023)**: After I discovered what SSR is, I decided
my website one more time in NuxtJS. I had really "fun time" using vue stuff. As NuxtJS supported to rewrite and rework my website one more time in NuxtJS. I had really "fun"
server-side code, this website had its own built in API. This website was also hosted on `ngn13.fun` time using vue stuff. As NuxtJS supported server-side code, this website had
its own built in API. This website was also hosted on `ngn13.fun`. This also
the first version that lives on this git repository.
- **v3.0 (2023 august - 2023 november)**: In agust of 2023, I decided to rewrite and rework my website - **v3.0 (2023 august - 2023 november)**: In agust of 2023, I decided to rewrite
again, this time I was going with SvelteKit as I haven't had the greatest experience with NuxtJS. and rework my website again, this time I was going with SvelteKit as I haven't
SvelteKit was really fun to work with and I got my new website done pretty quickly. (I don't wanna had the greatest experience with NuxtJS. SvelteKit was really fun to work with
brag or something but I really imporeved the CSS/styling stuff ya know). I also wrote a new API and I got my new website done pretty quickly. (I don't wanna brag or something
with Go and Gin. I did not publish the source code for the API, its still on my local gitea but I really imporeved the CSS/styling stuff ya know). I also wrote a new API
server tho. This website was hosted on `ngn13.fun` as well with Go and Gin. I did not publish the source code for the API, the code lived
on my local git server until I deleted it when I was done with 6.0. This
website was hosted on `ngn13.fun` as well.
- **v4.0 (2023 november - 2024 october)**: In this version the frontend was still similar to 3.0, - **v4.0 (2023 november - 2024 october)**: In this version the frontend was
the big changes are in the API. I rewrote the API with Fiber. This version was the first version which is hosted on still similar to 3.0, the big changes are in the API. I rewrote the API with
`ngn.tf` which is my new domain name btw Fiber. This version was the first version hosted on `ngn.tf` which is my new
domain name. Here is a [picture of the index](assets/4.0_index.png) and the
[blog page](assets/4.0_blog.png).
- **v5.0 (2024 october - ...)**: The current major version of my website, has small UI and API tweaks when - **v5.0 (2024 october - 2025 january)**: This version just had simple frontend
compared to 4.0 UI changes compared to 4.0, at this point I was thinking about doing a massive
rework (which I did with 6.0), however I was working on some other shit at the
time, so I just did some small changes with the limited time I had for this
project.
## Screenshots (from v4.0) - **v6.0 (2025 january - ...)**: The current major version of my website,
![](assets/4.0_index.png) frontend had a massive rework, API has been cleaned up and extended to do
![](assets/4.0_blog.png) status checking for the services I host. The `doc` server has been added to
the mix so I can host static documentation. The most important thing about
this version is that it adds multi-language support, so literally everything
on the website (including the API and documentation content) is localized for
both English and Turkish, which was something I wanted to do for the longest
time ever.

View File

@ -30,8 +30,6 @@ import requests as req
from os import getenv from os import getenv
from sys import argv from sys import argv
API_URL_ENV = "API_URL"
# logger used by the script # logger used by the script
class Log: class Log:
@ -138,11 +136,32 @@ class AdminAPI:
self.PUT("/v1/admin/service/add", service) self.PUT("/v1/admin/service/add", service)
def del_service(self, service: str) -> None: def del_service(self, name: str) -> None:
if service == "": if name == "":
raise Exception("Service name cannot be empty") raise Exception("Service name cannot be empty")
self.DELETE("/v1/admin/service/del?name=%s" % quote_plus(service)) self.DELETE("/v1/admin/service/del?name=%s" % quote_plus(name))
def add_project(self, project: Dict[str, str]):
if "name" not in project or project["name"] == "":
raise Exception('Project structure is missing required "name" field')
if "desc" not in project:
raise Exception('Project structure is missing required "desc" field')
if not self._check_multilang_field(project["desc"]):
raise Exception(
'Project structure field "desc" needs at least '
+ "one supported language entry"
)
self.PUT("/v1/admin/project/add", project)
def del_project(self, name: str) -> None:
if name == "":
raise Exception("Project name cannot be empty")
self.DELETE("/v1/admin/project/del?name=%s" % quote_plus(name))
def check_services(self) -> None: def check_services(self) -> None:
self.GET("/v1/admin/service/check") self.GET("/v1/admin/service/check")
@ -174,184 +193,216 @@ class AdminAPI:
self.PUT("/v1/admin/news/add", news) self.PUT("/v1/admin/news/add", news)
def del_news(self, news: str) -> None: def del_news(self, id: str) -> None:
if news == "": if id == "":
raise Exception("News ID cannot be empty") raise Exception("News ID cannot be empty")
self.DELETE("/v1/admin/news/del?id=%s" % quote_plus(news)) self.DELETE("/v1/admin/news/del?id=%s" % quote_plus(id))
def logs(self) -> List[Dict[str, Any]]: def logs(self) -> List[Dict[str, Any]]:
return self.GET("/v1/admin/logs") return self.GET("/v1/admin/logs")
# local helper functions used by the script class AdminScript:
def __format_time(ts: int) -> str: def __init__(self):
return datetime.fromtimestamp(ts, UTC).strftime("%H:%M:%S %d/%m/%Y") self.log: Log = Log()
self.api: AdminAPI = None
self.commands = {
"add_service": self.add_service,
"del_service": self.del_service,
"add_project": self.add_project,
"del_project": self.del_project,
"add_news": self.add_news,
"del_news": self.del_news,
"check_services": self.check_services,
"logs": self.get_logs,
}
self.api_url_env = "API_URL"
self.password_env = "API_PASSWORD"
def __format_time(self, ts: int) -> str:
return datetime.fromtimestamp(ts, UTC).strftime("%H:%M:%S %d/%m/%Y")
def __load_json_file(file: str) -> Dict[str, Any]: def __load_json_file(self, file: str) -> Dict[str, Any]:
with open(file, "r") as f: with open(file, "r") as f:
data = loads(f.read()) data = loads(f.read())
return data return data
def __dump_json_file(self, data: Dict[str, Any], file: str) -> None:
with open(file, "w") as f:
data = dumps(data, indent=2)
f.write(data)
def __dump_json_file(data: Dict[str, Any], file: str) -> None: def run(self) -> bool:
with open(file, "w") as f: if len(argv) < 2 or len(argv) > 3:
data = dumps(data, indent=2) self.log.error("Usage: %s [command] <file>" % argv[0])
f.write(data) self.log.info("Here is a list of available commands:")
for command in self.commands.keys():
print("\t%s" % command)
# command handlers return False
def __handle_command(log: Log, api: AdminAPI, cmd: str) -> None:
match cmd: url = getenv(self.api_url_env)
case "add_service": valid_cmd = False
if url is None:
self.log.error(
"Please specify the API URL using %s environment variable"
% self.api_url_env
)
return False
for cmd in self.commands:
if argv[1] == cmd:
valid_cmd = True
break
if not valid_cmd:
self.log.error(
"Invalid command, run the script with no commands to list the available commands"
)
return False
try:
password = getenv(self.password_env)
if password is None:
password = self.log.password("Please enter the admin password")
self.api = AdminAPI(url, password)
if len(argv) == 2:
self.handle_command(argv[1])
elif len(argv) == 3:
self.handle_command(argv[1], argv[2])
except KeyboardInterrupt:
self.log.error("Command cancelled")
return False
except Exception as e:
self.log.error("Command failed: %s" % e)
return False
# service commands
def add_service(self, data: Dict[str, Any] = None) -> None:
if data is None:
data: Dict[str, str] = {} data: Dict[str, str] = {}
data["desc"] = {} data["desc"] = {}
data["name"] = log.input("Serivce name") data["name"] = self.log.input("Serivce name")
for lang in api.languages:
data["desc"][lang] = log.input("Serivce desc (%s)" % lang)
data["check_url"] = log.input("Serivce status check URL")
data["clear"] = log.input("Serivce clearnet URL")
data["onion"] = log.input("Serivce onion URL")
data["i2p"] = log.input("Serivce I2P URL")
api.add_service(data) for lang in self.api.languages:
log.info("Service has been added") data["desc"][lang] = self.log.input("Serivce desc (%s)" % lang)
case "del_service": data["check_url"] = self.log.input("Serivce status check URL")
api.del_service(log.input("Serivce name")) data["clear"] = self.log.input("Serivce clearnet URL")
log.info("Service has been deleted") data["onion"] = self.log.input("Serivce onion URL")
data["i2p"] = self.log.input("Serivce I2P URL")
case "check_services": self.api.add_service(data)
api.check_services() self.log.info("Service has been added")
log.info("Requested status check for all the services")
case "add_news": def del_service(self, data: Dict[str, Any] = None) -> None:
news: Dict[str, str] = {} if data is None:
news["title"] = {} data: Dict[str, str] = {}
news["content"] = {} data["name"] = self.log.input("Service name")
data["id"] = log.input("News ID") self.api.del_service(data["name"])
for lang in api.languages: self.log.info("Service has been deleted")
data["title"][lang] = log.input("News title (%s)" % lang)
data["author"] = log.input("News author")
for lang in api.languages:
data["content"][lang] = log.input("News content (%s)" % lang)
api.add_news(data) # project commands
log.info("News has been added") def add_project(self, data: Dict[str, Any] = None) -> None:
if data is None:
data: Dict[str, str] = {}
data["desc"] = {}
case "del_news": data["name"] = self.log.input("Project name")
api.del_news(log.input("News ID"))
log.info("News has been deleted")
case "logs": for lang in self.api.languages:
logs = api.logs() data["desc"][lang] = self.log.input("Project desc (%s)" % lang)
if logs["result"] is None or len(logs["result"]) == 0: data["url"] = self.log.input("Project URL")
return log.info("No available logs") data["license"] = self.log.input("Project license")
for log in logs["result"]: self.api.add_project(data)
log.info( self.log.info("Project has been added")
"Time: %s | Action: %s"
% (__format_time(log["time"]), log["action"])
)
def del_project(self, data: Dict[str, Any] = None) -> None:
if data is None:
data: Dict[str, str] = {}
data["name"] = self.log.input("Project name")
def __handle_command_with_file(log: Log, api: AdminAPI, cmd: str, file: str) -> None: self.api.del_project(data["name"])
match cmd: self.log.info("Project has been deleted")
case "add_service":
data = __load_json_file(file)
api.add_service(data)
log.info("Service has been added")
case "del_service": # news command
data = __load_json_file(file) def add_news(self, data: Dict[str, Any] = None) -> None:
api.del_service(data["name"]) if data is None:
log.info("Service has been deleted") data: Dict[str, str] = {}
data["title"] = {}
data["content"] = {}
case "check_services": data["id"] = self.log.input("News ID")
api.check_services()
log.info("Requested status check for all the services")
case "add_news": for lang in self.api.languages:
data = __load_json_file(file) data["title"][lang] = self.log.input("News title (%s)" % lang)
api.add_news(data)
log.info("News has been added")
case "del_news": data["author"] = self.log.input("News author")
data = __load_json_file(file)
api.del_news(data["id"])
log.info("News has been deleted")
case "logs": for lang in self.api.languages:
logs = api.logs() data["content"][lang] = self.log.input("News content (%s)" % lang)
if logs["result"] is None or len(logs["result"]) == 0: self.api.add_news(data)
return log.info("No available logs") self.log.info("News has been added")
__dump_json_file(logs["result"], file) def del_news(self, data: Dict[str, Any] = None) -> None:
log.info("Logs has been saved") if data is None:
data: Dict[str, str] = {}
data["id"] = self.log.input("News ID")
self.api.del_project(data["id"])
self.log.info("News has been deleted")
def check_services(self, data: Dict[str, Any] = None) -> None:
self.api.check_services()
self.log.info("Requested status check for all the services")
def get_logs(self, data: Dict[str, Any] = None) -> None:
logs = self.api.logs()
if logs["result"] is None or len(logs["result"]) == 0:
return self.log.info("No available logs")
for log in logs["result"]:
self.log.info(
"Time: %s | Action: %s"
% (self.__format_time(log["time"]), log["action"])
)
def handle_command(self, cmd: str, file: str = None) -> bool:
for command in self.commands.keys():
if command != cmd:
continue
data = None
try:
if file != "" and file is not None:
data = self.__load_json_file(file)
self.commands[cmd](data)
return True
except Exception as e:
self.log.error("Command failed: %s" % e)
return False
self.log.error("Invalid command: %s", cmd)
return False
commands = [
"add_service",
"del_service",
"check_services",
"add_news",
"del_news",
"logs"
]
if __name__ == "__main__": if __name__ == "__main__":
log = Log() script = AdminScript()
exit(0 if script.run() else 1)
if len(argv) < 2 or len(argv) > 3:
log.error("Usage: %s [command] <file>" % argv[0])
log.info("Here is a list of available commands:")
print("\tadd_service")
print("\tdel_service")
print("\tcheck_services")
print("\tadd_news")
print("\tdel_news")
print("\tlogs")
exit(1)
url = getenv(API_URL_ENV)
valid_cmd = False
for cmd in commands:
if argv[1] == cmd:
valid_cmd = True
break
if not valid_cmd:
log.error(
"Invalid command, run the script with no commands to list the available commands"
)
exit(1)
if url is None:
log.error(
"Please specify the API URL using %s environment variable" % API_URL_ENV
)
exit(1)
try:
password = log.password("Please enter the admin password")
api = AdminAPI(url, password)
if len(argv) == 2:
__handle_command(log, api, argv[1])
elif len(argv) == 3:
__handle_command_with_file(log, api, argv[1], argv[2])
except KeyboardInterrupt:
print()
log.error("Command cancelled")
exit(1)
except Exception as e:
log.error("Command failed: %s" % e)
exit(1)

View File

@ -0,0 +1,9 @@
{
"name": "test",
"desc": {
"en": "A non-existent project used to test the API",
"tr": "API'ı test etmek için kullanılan varolmayan bir proje"
},
"url": "https://github.com/ngn13/test",
"license": "GPL-3.0"
}

View File

@ -1,19 +1,26 @@
FROM golang:1.23.4 FROM golang:1.24.5
WORKDIR /api WORKDIR /api
COPY *.go ./ RUN useradd runner -r -u 1001 -d /api
RUN chown -R runner:runner /api
USER runner
COPY *.mod ./ COPY *.mod ./
COPY *.sum ./ COPY *.sum ./
RUN go mod download
COPY *.go ./
COPY Makefile ./ COPY Makefile ./
COPY config ./config
COPY database ./database
COPY routes ./routes
COPY sql ./sql
COPY status ./status
COPY util ./util COPY util ./util
COPY views ./views COPY views ./views
COPY routes ./routes
COPY config ./config
COPY status ./status
COPY database ./database
EXPOSE 7001
RUN make RUN make
ENTRYPOINT ["/api/api.elf"] ENTRYPOINT ["/api/api.elf"]

View File

@ -6,9 +6,12 @@ api.elf: $(GOSRCS)
go build -o $@ go build -o $@
run: run:
API_DEBUG=true API_FRONTEND_URL=http://localhost:5173/ API_PASSWORD=test ./api.elf WEBSITE_DEBUG=true WEBSITE_PASSWORD=test ./api.elf
format: format:
gofmt -s -w . gofmt -s -w .
.PHONY: test format clean:
rm -f *.elf
.PHONY: test format clean

View File

@ -3,111 +3,47 @@ package config
import ( import (
"fmt" "fmt"
"net/url" "net/url"
"os"
"github.com/ngn13/ortam"
) )
type Type struct { type Type struct {
Options []Option Debug bool // should display debug messgaes?
Count int AppUrl *url.URL // frontend application URL for the website
Password string // admin password
Host string // host the server should listen on
IPHeader string // header that should be checked for obtaining the client IP
Interval string // service status check interval
Timeout string // timeout for the service status check
Limit string // if the service responds slower than this limit, it will be marked as "slow"
} }
func (c *Type) Find(name string, typ uint8) (*Option, error) { func Load() (*Type, error) {
for i := 0; i < c.Count; i++ { var conf = Type{
if c.Options[i].Name != name { Debug: false,
continue Password: "",
} Host: "0.0.0.0:7002",
IPHeader: "X-Real-IP",
if c.Options[i].Type != typ { Interval: "1h",
return nil, fmt.Errorf("bad option type") Timeout: "15s",
} Limit: "5s",
return &c.Options[i], nil
} }
return nil, fmt.Errorf("option not found") if err := ortam.Load(&conf, "WEBSITE"); err != nil {
} return nil, err
}
func (c *Type) Load() (err error) {
var ( if conf.AppUrl == nil {
env_val string conf.AppUrl, _ = url.Parse("http://localhost:7001/")
env_name string }
opt *Option
exists bool if conf.Password == "" {
) return nil, fmt.Errorf("password is not specified")
}
// default options
c.Options = []Option{ if conf.Host == "" {
{Name: "debug", Value: "false", Type: OPTION_TYPE_BOOL, Required: true}, // should display debug messgaes? return nil, fmt.Errorf("host address is not specified")
{Name: "index", Value: "true", Type: OPTION_TYPE_BOOL, Required: false}, // should display the index page (view/index.md)? }
{Name: "api_url", Value: "http://localhost:7001/", Type: OPTION_TYPE_URL, Required: true}, // API URL for the website return &conf, nil
{Name: "frontend_url", Value: "http://localhost:5173/", Type: OPTION_TYPE_URL, Required: true}, // frontend application URL for the website
{Name: "password", Value: "", Type: OPTION_TYPE_STR, Required: true}, // admin password
{Name: "host", Value: "0.0.0.0:7001", Type: OPTION_TYPE_STR, Required: true}, // host the server should listen on
{Name: "ip_header", Value: "X-Real-IP", Type: OPTION_TYPE_STR, Required: false}, // header that should be checked for obtaining the client IP
{Name: "interval", Value: "1h", Type: OPTION_TYPE_STR, Required: false}, // service status check interval
{Name: "timeout", Value: "15s", Type: OPTION_TYPE_STR, Required: false}, // timeout for the service status check
{Name: "limit", Value: "5s", Type: OPTION_TYPE_STR, Required: false}, // if the service responds slower than this limit, it will be marked as "slow"
}
c.Count = len(c.Options)
for i := 0; i < c.Count; i++ {
opt = &c.Options[i]
env_name = opt.Env()
if env_val, exists = os.LookupEnv(env_name); exists {
opt.Value = env_val
}
if opt.Value == "" && opt.Required {
return fmt.Errorf("please specify a value for the config option \"%s\" (\"%s\")", opt.Name, env_name)
}
if err = opt.Load(); err != nil {
return fmt.Errorf("failed to load option \"%s\" (\"%s\"): %s", opt.Name, env_name, err.Error())
}
}
return nil
}
func (c *Type) GetStr(name string) string {
var (
opt *Option
err error
)
if opt, err = c.Find(name, OPTION_TYPE_STR); err != nil {
return ""
}
return opt.TypeValue.Str
}
func (c *Type) GetBool(name string) bool {
var (
opt *Option
err error
)
if opt, err = c.Find(name, OPTION_TYPE_BOOL); err != nil {
return false
}
return opt.TypeValue.Bool
}
func (c *Type) GetURL(name string) *url.URL {
var (
opt *Option
err error
)
if opt, err = c.Find(name, OPTION_TYPE_URL); err != nil {
return nil
}
return opt.TypeValue.URL
} }

View File

@ -1,49 +0,0 @@
package config
import (
"fmt"
"net/url"
"strings"
)
const (
OPTION_TYPE_STR = 0
OPTION_TYPE_BOOL = 1
OPTION_TYPE_URL = 2
)
type Option struct {
Name string
Value string
Required bool
Type uint8
TypeValue struct {
URL *url.URL
Str string
Bool bool
}
}
func (o *Option) Env() string {
return strings.ToUpper(fmt.Sprintf("API_%s", o.Name))
}
func (o *Option) Load() (err error) {
err = nil
switch o.Type {
case OPTION_TYPE_STR:
o.TypeValue.Str = o.Value
case OPTION_TYPE_BOOL:
o.TypeValue.Bool = "1" == o.Value || "true" == strings.ToLower(o.Value)
case OPTION_TYPE_URL:
o.TypeValue.URL, err = url.Parse(o.Value)
default:
return fmt.Errorf("invalid option type")
}
return err
}

View File

@ -24,8 +24,8 @@ func (db *Type) AdminLogNext(l *AdminLog) bool {
var err error var err error
if nil == db.rows { if nil == db.rows {
if db.rows, err = db.sql.Query("SELECT * FROM admin_log"); err != nil { if db.rows, err = db.sql.Query("SELECT * FROM " + TABLE_ADMIN_LOG); err != nil {
util.Fail("failed to query admin_log table: %s", err.Error()) util.Fail("failed to query table: %s", err.Error())
goto fail goto fail
} }
} }
@ -35,7 +35,7 @@ func (db *Type) AdminLogNext(l *AdminLog) bool {
} }
if err = l.Scan(db.rows); err != nil { if err = l.Scan(db.rows); err != nil {
util.Fail("failed to scan the admin_log table: %s", err.Error()) util.Fail("failed to scan the table: %s", err.Error())
goto fail goto fail
} }
@ -52,7 +52,7 @@ fail:
func (db *Type) AdminLogAdd(l *AdminLog) error { func (db *Type) AdminLogAdd(l *AdminLog) error {
_, err := db.sql.Exec( _, err := db.sql.Exec(
`INSERT INTO admin_log( "INSERT INTO "+TABLE_ADMIN_LOG+`(
action, time action, time
) values(?, ?)`, ) values(?, ?)`,
&l.Action, &l.Time, &l.Action, &l.Time,

View File

@ -2,64 +2,62 @@ package database
import ( import (
"fmt" "fmt"
"os"
"path"
"database/sql" "database/sql"
_ "github.com/mattn/go-sqlite3" _ "github.com/mattn/go-sqlite3"
) )
const (
SQL_PATH = "sql"
TABLE_ADMIN_LOG = "admin_log" // stores administrator logs
TABLE_METRICS = "metrics" // stores API usage metrcis
TABLE_NEWS = "news" // stores news posts
TABLE_SERVICES = "services" // stores services
TABLE_PROJECTS = "projects" // stores projects
)
var tables []string = []string{
TABLE_ADMIN_LOG, TABLE_METRICS, TABLE_NEWS,
TABLE_SERVICES, TABLE_PROJECTS,
}
type Type struct { type Type struct {
sql *sql.DB sql *sql.DB
rows *sql.Rows rows *sql.Rows
} }
func (db *Type) Load() (err error) { func (db *Type) create_table(table string) error {
if db.sql, err = sql.Open("sqlite3", "data.db"); err != nil { var (
return fmt.Errorf("cannot access the database: %s", err.Error()) err error
query []byte
)
query_path := path.Join(SQL_PATH, table+".sql")
if query, err = os.ReadFile(query_path); err != nil {
return fmt.Errorf("failed to read %s for table %s: %", query_path, table, err.Error())
} }
// see database/service.go if _, err = db.sql.Exec(string(query)); err != nil {
_, err = db.sql.Exec(` return fmt.Errorf("failed to create the %s table: %s", table, err.Error())
CREATE TABLE IF NOT EXISTS services( }
name TEXT NOT NULL UNIQUE,
desc TEXT NOT NULL, return nil
check_time INTEGER NOT NULL, }
check_res INTEGER NOT NULL,
check_url TEXT NOT NULL, func (db *Type) Load() (err error) {
clear TEXT, if db.sql, err = sql.Open("sqlite3", "data.db"); err != nil {
onion TEXT, return fmt.Errorf("failed access the database: %s", err.Error())
i2p TEXT }
);
`) for _, table := range tables {
if err = db.create_table(table); err != nil {
if err != nil { return err
return fmt.Errorf("failed to create the services table: %s", err.Error()) }
}
// see database/news.go
_, err = db.sql.Exec(`
CREATE TABLE IF NOT EXISTS news(
id TEXT NOT NULL UNIQUE,
title TEXT NOT NULL,
author TEXT NOT NULL,
time INTEGER NOT NULL,
content TEXT NOT NULL
);
`)
if err != nil {
return fmt.Errorf("failed to create the news table: %s", err.Error())
}
// see database/admin.go
_, err = db.sql.Exec(`
CREATE TABLE IF NOT EXISTS admin_log(
action TEXT NOT NULL,
time INTEGER NOT NULL
);
`)
if err != nil {
return fmt.Errorf("failed to create the admin_log table: %s", err.Error())
} }
return nil return nil

57
api/database/metrics.go Normal file
View File

@ -0,0 +1,57 @@
package database
import (
"database/sql"
"github.com/ngn13/website/api/util"
)
func (db *Type) MetricsGet(key string) (uint64, error) {
var (
row *sql.Row
count uint64
err error
)
if row = db.sql.QueryRow("SELECT value FROM "+TABLE_METRICS+" WHERE key = ?", key); row == nil {
return 0, nil
}
if err = row.Scan(&count); err != nil && err != sql.ErrNoRows {
util.Fail("failed to scan the table: %s", err.Error())
return 0, err
}
if err == sql.ErrNoRows {
return 0, nil
}
return count, nil
}
func (db *Type) MetricsSet(key string, value uint64) error {
var (
err error
res sql.Result
)
if res, err = db.sql.Exec("UPDATE "+TABLE_METRICS+" SET value = ? WHERE key = ?", value, key); err != nil && err != sql.ErrNoRows {
util.Fail("failed to query table: %s", err.Error())
return err
}
if effected, err := res.RowsAffected(); err != nil {
return err
} else if effected < 1 {
_, err = db.sql.Exec(
"INSERT INTO "+TABLE_METRICS+`(
key, value
) values(?, ?)`,
key, value,
)
return err
}
return nil
}

View File

@ -64,8 +64,8 @@ func (db *Type) NewsNext(n *News) bool {
var err error var err error
if nil == db.rows { if nil == db.rows {
if db.rows, err = db.sql.Query("SELECT * FROM news"); err != nil { if db.rows, err = db.sql.Query("SELECT * FROM " + TABLE_NEWS); err != nil {
util.Fail("failed to query news table: %s", err.Error()) util.Fail("failed to query table: %s", err.Error())
goto fail goto fail
} }
} }
@ -75,7 +75,7 @@ func (db *Type) NewsNext(n *News) bool {
} }
if err = n.Scan(db.rows); err != nil { if err = n.Scan(db.rows); err != nil {
util.Fail("failed to scan the news table: %s", err.Error()) util.Fail("failed to scan the table: %s", err.Error())
goto fail goto fail
} }
@ -92,7 +92,7 @@ fail:
func (db *Type) NewsRemove(id string) error { func (db *Type) NewsRemove(id string) error {
_, err := db.sql.Exec( _, err := db.sql.Exec(
"DELETE FROM news WHERE id = ?", "DELETE FROM "+TABLE_NEWS+" WHERE id = ?",
id, id,
) )
@ -105,7 +105,7 @@ func (db *Type) NewsAdd(n *News) (err error) {
} }
_, err = db.sql.Exec( _, err = db.sql.Exec(
`INSERT OR REPLACE INTO news( "INSERT OR REPLACE INTO "+TABLE_NEWS+`(
id, title, author, time, content id, title, author, time, content
) values(?, ?, ?, ?, ?)`, ) values(?, ?, ?, ?, ?)`,
n.ID, n.title, n.ID, n.title,

92
api/database/project.go Normal file
View File

@ -0,0 +1,92 @@
package database
import (
"database/sql"
"github.com/ngn13/website/api/util"
)
type Project struct {
Name string `json:"name"` // name of the project
desc string `json:"-"` // description of the project (string)
Desc Multilang `json:"desc"` // description of the project
URL string `json:"url"` // URL of the project's homepage/source
License string `json:"license"` // name of project's license
}
func (p *Project) Load() error {
return p.Desc.Load(p.desc)
}
func (p *Project) Dump() (err error) {
p.desc, err = p.Desc.Dump()
return
}
func (p *Project) Scan(rows *sql.Rows) (err error) {
if err = rows.Scan(
&p.Name, &p.desc,
&p.URL, &p.License); err != nil {
return err
}
return p.Load()
}
func (p *Project) IsValid() bool {
return p.Name != "" && p.URL != "" && !p.Desc.Empty()
}
func (db *Type) ProjectNext(p *Project) bool {
var err error
if nil == db.rows {
if db.rows, err = db.sql.Query("SELECT * FROM " + TABLE_PROJECTS); err != nil {
util.Fail("failed to query table: %s", err.Error())
goto fail
}
}
if !db.rows.Next() {
goto fail
}
if err = p.Scan(db.rows); err != nil {
util.Fail("failed to scan the table: %s", err.Error())
goto fail
}
return true
fail:
if db.rows != nil {
db.rows.Close()
}
db.rows = nil
return false
}
func (db *Type) ProjectRemove(name string) error {
_, err := db.sql.Exec(
"DELETE FROM "+TABLE_PROJECTS+" WHERE name = ?",
name,
)
return err
}
func (db *Type) ProjectAdd(p *Project) (err error) {
if err = p.Dump(); err != nil {
return err
}
_, err = db.sql.Exec(
"INSERT OR REPLACE INTO "+TABLE_PROJECTS+`(
name, desc, url, license
) values(?, ?, ?, ?)`,
p.Name, p.desc, p.URL, p.License,
)
return err
}

View File

@ -58,8 +58,8 @@ func (db *Type) ServiceNext(s *Service) bool {
var err error var err error
if nil == db.rows { if nil == db.rows {
if db.rows, err = db.sql.Query("SELECT * FROM services"); err != nil { if db.rows, err = db.sql.Query("SELECT * FROM " + TABLE_SERVICES); err != nil {
util.Fail("failed to query services table: %s", err.Error()) util.Fail("failed to query table: %s", err.Error())
goto fail goto fail
} }
} }
@ -69,7 +69,7 @@ func (db *Type) ServiceNext(s *Service) bool {
} }
if err = s.Scan(db.rows, nil); err != nil { if err = s.Scan(db.rows, nil); err != nil {
util.Fail("failed to scan the services table: %s", err.Error()) util.Fail("failed to scan the table: %s", err.Error())
goto fail goto fail
} }
@ -91,7 +91,7 @@ func (db *Type) ServiceFind(name string) (*Service, error) {
err error err error
) )
if row = db.sql.QueryRow("SELECT * FROM services WHERE name = ?", name); row == nil || row.Err() == sql.ErrNoRows { if row = db.sql.QueryRow("SELECT * FROM "+TABLE_SERVICES+" WHERE name = ?", name); row == nil || row.Err() == sql.ErrNoRows {
return nil, nil return nil, nil
} }
@ -104,7 +104,7 @@ func (db *Type) ServiceFind(name string) (*Service, error) {
func (db *Type) ServiceRemove(name string) error { func (db *Type) ServiceRemove(name string) error {
_, err := db.sql.Exec( _, err := db.sql.Exec(
"DELETE FROM services WHERE name = ?", "DELETE FROM "+TABLE_SERVICES+" WHERE name = ?",
name, name,
) )
@ -117,7 +117,7 @@ func (db *Type) ServiceUpdate(s *Service) (err error) {
} }
_, err = db.sql.Exec( _, err = db.sql.Exec(
`INSERT OR REPLACE INTO services( "INSERT OR REPLACE INTO "+TABLE_SERVICES+`(
name, desc, check_time, check_res, check_url, clear, onion, i2p name, desc, check_time, check_res, check_url, clear, onion, i2p
) values(?, ?, ?, ?, ?, ?, ?, ?)`, ) values(?, ?, ?, ?, ?, ?, ?, ?)`,
s.Name, s.desc, s.Name, s.desc,

View File

@ -1,23 +1,23 @@
module github.com/ngn13/website/api module github.com/ngn13/website/api
go 1.21.3 go 1.24.5
require ( require (
github.com/gofiber/fiber/v2 v2.52.5 github.com/gofiber/fiber/v2 v2.52.8
github.com/mattn/go-sqlite3 v1.14.24 github.com/mattn/go-sqlite3 v1.14.28
github.com/russross/blackfriday/v2 v2.1.0 github.com/ngn13/ortam v0.0.0-20250421004351-8dea81680817
) )
require ( require (
github.com/andybalholm/brotli v1.0.5 // indirect github.com/andybalholm/brotli v1.1.0 // indirect
github.com/google/uuid v1.5.0 // indirect github.com/google/uuid v1.6.0 // indirect
github.com/klauspost/compress v1.17.0 // indirect github.com/klauspost/compress v1.17.9 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-isatty v0.0.20 // indirect
github.com/mattn/go-runewidth v0.0.15 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect
github.com/rivo/uniseg v0.2.0 // indirect github.com/rivo/uniseg v0.2.0 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasthttp v1.51.0 // indirect github.com/valyala/fasthttp v1.51.0 // indirect
github.com/valyala/tcplisten v1.0.0 // indirect github.com/valyala/tcplisten v1.0.0 // indirect
golang.org/x/sys v0.15.0 // indirect golang.org/x/sys v0.28.0 // indirect
) )

View File

@ -1,24 +1,24 @@
github.com/andybalholm/brotli v1.0.5 h1:8uQZIdzKmjc/iuPu7O2ioW48L81FgatrcpfFmiq/cCs= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M=
github.com/andybalholm/brotli v1.0.5/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY=
github.com/gofiber/fiber/v2 v2.52.5 h1:tWoP1MJQjGEe4GB5TUGOi7P2E0ZMMRx5ZTG4rT+yGMo= github.com/gofiber/fiber/v2 v2.52.8 h1:xl4jJQ0BV5EJTA2aWiKw/VddRpHrKeZLF0QPUxqn0x4=
github.com/gofiber/fiber/v2 v2.52.5/go.mod h1:KEOE+cXMhXG0zHc9d8+E38hoX+ZN7bhOtgeF2oT6jrQ= github.com/gofiber/fiber/v2 v2.52.8/go.mod h1:YEcBbO/FB+5M1IZNBP9FO3J9281zgPAreiI1oqg8nDw=
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA=
github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw=
github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA=
github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg=
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/mattn/go-runewidth v0.0.15 h1:UNAjwbU9l54TA3KzvqLGxwWjHmMgBUVhBiTjelZgg3U= github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
github.com/mattn/go-runewidth v0.0.15/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
github.com/mattn/go-sqlite3 v1.14.24 h1:tpSp2G2KyMnnQu99ngJ47EIkWVmliIizyZBfPrBWDRM= github.com/mattn/go-sqlite3 v1.14.28 h1:ThEiQrnbtumT+QMknw63Befp/ce/nUPgBPMlRFEum7A=
github.com/mattn/go-sqlite3 v1.14.24/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= github.com/mattn/go-sqlite3 v1.14.28/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y=
github.com/ngn13/ortam v0.0.0-20250421004351-8dea81680817 h1:WkHM4w51N5jCsWcDVcPsXz3zhi/kCfNp/VGh2uPjwsk=
github.com/ngn13/ortam v0.0.0-20250421004351-8dea81680817/go.mod h1:MSJZ4ZstrLvVEvivbp9hhup+iL8rvtpgKcYaF3DSOKk=
github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= 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.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk=
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA= github.com/valyala/fasthttp v1.51.0 h1:8b30A5JlZ6C7AS81RsWjYMQmrZG6feChmgAolCl1SqA=
@ -27,5 +27,5 @@ github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVS
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc= golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=

View File

@ -36,18 +36,18 @@ func main() {
app *fiber.App app *fiber.App
stat status.Type stat status.Type
conf config.Type conf *config.Type
db database.Type db database.Type
err error err error
) )
if err = conf.Load(); err != nil { if conf, err = config.Load(); err != nil {
util.Fail("failed to load the configuration: %s", err.Error()) util.Fail("failed to load the configuration: %s", err.Error())
return return
} }
if !conf.GetBool("debug") { if !conf.Debug {
util.Debg = func(m string, v ...any) {} util.Debg = func(m string, v ...any) {}
} }
@ -56,7 +56,7 @@ func main() {
return return
} }
if err = stat.Setup(&conf, &db); err != nil { if err = stat.Setup(conf, &db); err != nil {
util.Fail("failed to setup the status checker: %s", err.Error()) util.Fail("failed to setup the status checker: %s", err.Error())
return return
} }
@ -75,7 +75,7 @@ func main() {
c.Set("Access-Control-Allow-Methods", "PUT, DELETE, GET") // POST can be sent from HTML forms, so I prefer PUT for API endpoints c.Set("Access-Control-Allow-Methods", "PUT, DELETE, GET") // POST can be sent from HTML forms, so I prefer PUT for API endpoints
c.Locals("status", &stat) c.Locals("status", &stat)
c.Locals("config", &conf) c.Locals("config", conf)
c.Locals("database", &db) c.Locals("database", &db)
return c.Next() return c.Next()
@ -89,14 +89,21 @@ func main() {
// v1 user routes // v1 user routes
v1.Get("/services", routes.GET_Services) v1.Get("/services", routes.GET_Services)
v1.Get("/projects", routes.GET_Projects)
v1.Get("/metrics", routes.GET_Metrics)
v1.Get("/news/:lang", routes.GET_News) v1.Get("/news/:lang", routes.GET_News)
// v1 admin routes // v1 admin routes
v1.Use("/admin", routes.AuthMiddleware) v1.Use("/admin", routes.AuthMiddleware)
v1.Get("/admin/logs", routes.GET_AdminLogs) v1.Get("/admin/logs", routes.GET_AdminLogs)
v1.Get("/admin/service/check", routes.GET_CheckService) v1.Get("/admin/service/check", routes.GET_CheckService)
v1.Put("/admin/service/add", routes.PUT_AddService) v1.Put("/admin/service/add", routes.PUT_AddService)
v1.Delete("/admin/service/del", routes.DEL_DelService) v1.Delete("/admin/service/del", routes.DEL_DelService)
v1.Put("/admin/project/add", routes.PUT_AddProject)
v1.Delete("/admin/project/del", routes.DEL_DelProject)
v1.Put("/admin/news/add", routes.PUT_AddNews) v1.Put("/admin/news/add", routes.PUT_AddNews)
v1.Delete("/admin/news/del", routes.DEL_DelNews) v1.Delete("/admin/news/del", routes.DEL_DelNews)
@ -114,9 +121,9 @@ func main() {
} }
// start the app // start the app
util.Info("starting web server on %s", conf.GetStr("host")) util.Info("starting web server on %s", conf.Host)
if err = app.Listen(conf.GetStr("host")); err != nil { if err = app.Listen(conf.Host); err != nil {
util.Fail("failed to start the web server: %s", err.Error()) util.Fail("failed to start the web server: %s", err.Error())
} }

View File

@ -21,7 +21,7 @@ func admin_log(c *fiber.Ctx, m string) error {
func AuthMiddleware(c *fiber.Ctx) error { func AuthMiddleware(c *fiber.Ctx) error {
conf := c.Locals("config").(*config.Type) conf := c.Locals("config").(*config.Type)
if c.Get("Authorization") != conf.GetStr("password") { if c.Get("Authorization") != conf.Password {
return util.ErrAuth(c) return util.ErrAuth(c)
} }
@ -103,6 +103,56 @@ func GET_CheckService(c *fiber.Ctx) error {
return util.JSON(c, 200, nil) return util.JSON(c, 200, nil)
} }
func PUT_AddProject(c *fiber.Ctx) error {
var (
project database.Project
err error
)
db := c.Locals("database").(*database.Type)
if c.BodyParser(&project) != nil {
return util.ErrBadJSON(c)
}
if !project.IsValid() {
return util.ErrBadReq(c)
}
if err = admin_log(c, fmt.Sprintf("Added project \"%s\"", project.Name)); err != nil {
return util.ErrInternal(c, err)
}
if err = db.ProjectAdd(&project); err != nil {
return util.ErrInternal(c, err)
}
return util.JSON(c, 200, nil)
}
func DEL_DelProject(c *fiber.Ctx) error {
var (
name string
err error
)
db := c.Locals("database").(*database.Type)
if name = c.Query("name"); name == "" {
util.ErrBadReq(c)
}
if err = admin_log(c, fmt.Sprintf("Removed project \"%s\"", name)); err != nil {
return util.ErrInternal(c, err)
}
if err = db.ProjectRemove(name); err != nil {
return util.ErrInternal(c, err)
}
return util.JSON(c, 200, nil)
}
func DEL_DelNews(c *fiber.Ctx) error { func DEL_DelNews(c *fiber.Ctx) error {
var ( var (
id string id string

View File

@ -3,30 +3,11 @@ package routes
import ( import (
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/ngn13/website/api/config" "github.com/ngn13/website/api/config"
"github.com/ngn13/website/api/util"
) )
func GET_Index(c *fiber.Ctx) error { func GET_Index(c *fiber.Ctx) error {
var (
md []byte
err error
)
conf := c.Locals("config").(*config.Type) conf := c.Locals("config").(*config.Type)
if !conf.GetBool("index") { // redirect to the API documentation
return util.ErrNotFound(c) return c.Redirect(conf.AppUrl.JoinPath("/doc/api").String())
}
frontend := conf.GetURL("frontend_url")
api := conf.GetURL("api_url")
if md, err = util.Render("views/index.md", fiber.Map{
"frontend": frontend,
"api": api,
}); err != nil {
return util.ErrInternal(c, err)
}
return util.Markdown(c, md)
} }

67
api/routes/metrics.go Normal file
View File

@ -0,0 +1,67 @@
package routes
import (
"time"
"github.com/gofiber/fiber/v2"
"github.com/ngn13/website/api/database"
"github.com/ngn13/website/api/util"
)
const VISITOR_CACHE_MAX = 30 // store 30 visitor data at most
var visitor_cache []string // in memory cache for the visitor addresses
func GET_Metrics(c *fiber.Ctx) error {
var (
err error
result map[string]uint64 = map[string]uint64{
"total": 0, // total number of visitors
"since": 0, // metric collection start date (UNIX timestamp)
}
)
db := c.Locals("database").(*database.Type)
new_addr := util.GetSHA1(util.IP(c))
is_in_cache := false
for _, cache := range visitor_cache {
if new_addr == cache {
is_in_cache = true
break
}
}
if result["total"], err = db.MetricsGet("visitor_count"); err != nil {
return util.ErrInternal(c, err)
}
if !is_in_cache {
if len(visitor_cache) > VISITOR_CACHE_MAX {
util.Debg("visitor cache is full, removing the oldest entry")
visitor_cache = visitor_cache[1:]
}
visitor_cache = append(visitor_cache, new_addr)
result["total"]++
if err = db.MetricsSet("visitor_count", result["total"]); err != nil {
return util.ErrInternal(c, err)
}
}
if result["since"], err = db.MetricsGet("start_date"); err != nil {
return util.ErrInternal(c, err)
}
if result["since"] == 0 {
result["since"] = uint64(time.Now().Truncate(24 * time.Hour).Unix())
if err = db.MetricsSet("start_date", result["since"]); err != nil {
return util.ErrInternal(c, err)
}
}
return util.JSON(c, 200, fiber.Map{
"result": result,
})
}

View File

@ -40,7 +40,6 @@ func GET_News(c *fiber.Ctx) error {
db := c.Locals("database").(*database.Type) db := c.Locals("database").(*database.Type)
conf := c.Locals("config").(*config.Type) conf := c.Locals("config").(*config.Type)
frontend := conf.GetURL("frontend_url")
lang := c.Params("lang") lang := c.Params("lang")
if lang == "" || len(lang) != 2 { if lang == "" || len(lang) != 2 {
@ -63,14 +62,16 @@ func GET_News(c *fiber.Ctx) error {
}) })
if feed, err = util.Render("views/news.xml", fiber.Map{ if feed, err = util.Render("views/news.xml", fiber.Map{
"frontend": frontend, "app_url": conf.AppUrl,
"updated": time.Now().Format(time.RFC3339), "updated": time.Now().Format(time.RFC3339),
"entries": entries, "entries": entries,
"lang": lang, "lang": lang,
}); err != nil { }); err != nil {
return util.ErrInternal(c, err) return util.ErrInternal(c, err)
} }
c.Set("Content-Disposition", "attachment; filename=\"news.atom\"")
c.Set("Content-Type", "application/atom+xml; charset=utf-8") c.Set("Content-Type", "application/atom+xml; charset=utf-8")
return c.Send(feed) return c.Send(feed)
} }

24
api/routes/projects.go Normal file
View File

@ -0,0 +1,24 @@
package routes
import (
"github.com/gofiber/fiber/v2"
"github.com/ngn13/website/api/database"
"github.com/ngn13/website/api/util"
)
func GET_Projects(c *fiber.Ctx) error {
var (
projects []database.Project
project database.Project
)
db := c.Locals("database").(*database.Type)
for db.ProjectNext(&project) {
projects = append(projects, project)
}
return util.JSON(c, 200, fiber.Map{
"result": projects,
})
}

4
api/sql/admin_log.sql Normal file
View File

@ -0,0 +1,4 @@
CREATE TABLE IF NOT EXISTS admin_log(
action TEXT NOT NULL,
time INTEGER NOT NULL
);

4
api/sql/metrics.sql Normal file
View File

@ -0,0 +1,4 @@
CREATE TABLE IF NOT EXISTS metrics(
key TEXT NOT NULL UNIQUE,
value INTEGER NOT NULL
);

7
api/sql/news.sql Normal file
View File

@ -0,0 +1,7 @@
CREATE TABLE IF NOT EXISTS news(
id TEXT NOT NULL UNIQUE,
title TEXT NOT NULL,
author TEXT NOT NULL,
time INTEGER NOT NULL,
content TEXT NOT NULL
);

6
api/sql/projects.sql Normal file
View File

@ -0,0 +1,6 @@
CREATE TABLE IF NOT EXISTS projects(
name TEXT NOT NULL UNIQUE,
desc TEXT NOT NULL,
url TEXT NOT NULL,
license TEXT
);

10
api/sql/services.sql Normal file
View File

@ -0,0 +1,10 @@
CREATE TABLE IF NOT EXISTS services(
name TEXT NOT NULL UNIQUE,
desc TEXT NOT NULL,
check_time INTEGER NOT NULL,
check_res INTEGER NOT NULL,
check_url TEXT NOT NULL,
clear TEXT,
onion TEXT,
i2p TEXT
);

View File

@ -66,29 +66,24 @@ func (s *Type) loop() {
func (s *Type) Setup(conf *config.Type, db *database.Type) error { func (s *Type) Setup(conf *config.Type, db *database.Type) error {
var ( var (
dur time.Duration dur time.Duration
iv, to, lm string err error
err error
) )
iv = conf.GetStr("interval") if conf.Interval == "" || conf.Timeout == "" || conf.Limit == "" {
to = conf.GetStr("timeout")
lm = conf.GetStr("limit")
if iv == "" || to == "" || lm == "" {
s.disabled = true s.disabled = true
return nil return nil
} }
if dur, err = util.GetDuration(iv); err != nil { if dur, err = util.GetDuration(conf.Interval); err != nil {
return err return err
} }
if s.timeout, err = util.GetDuration(iv); err != nil { if s.timeout, err = util.GetDuration(conf.Timeout); err != nil {
return err return err
} }
if s.limit, err = util.GetDuration(iv); err != nil { if s.limit, err = util.GetDuration(conf.Limit); err != nil {
return err return err
} }

View File

@ -6,29 +6,18 @@ import (
"github.com/gofiber/fiber/v2" "github.com/gofiber/fiber/v2"
"github.com/ngn13/website/api/config" "github.com/ngn13/website/api/config"
"github.com/russross/blackfriday/v2"
) )
func IP(c *fiber.Ctx) string { func IP(c *fiber.Ctx) string {
conf := c.Locals("config").(*config.Type) conf := c.Locals("config").(*config.Type)
ip_header := conf.GetStr("ip_header")
if ip_header != "" && c.Get(ip_header) != "" { if conf.IPHeader != "" && c.Get(conf.IPHeader) != "" {
return strings.Clone(c.Get(ip_header)) return strings.Clone(c.Get(conf.IPHeader))
} }
return c.IP() return c.IP()
} }
func Markdown(c *fiber.Ctx, raw []byte) error {
exts := blackfriday.FencedCode
exts |= blackfriday.NoEmptyLineBeforeBlock
exts |= blackfriday.HardLineBreak
c.Set("Content-Type", "text/html; charset=utf-8")
return c.Send(blackfriday.Run(raw, blackfriday.WithExtensions(exts)))
}
func JSON(c *fiber.Ctx, code int, data fiber.Map) error { func JSON(c *fiber.Ctx, code int, data fiber.Map) error {
if data == nil { if data == nil {
data = fiber.Map{} data = fiber.Map{}

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?><feed xmlns="http://www.w3.org/2005/Atom"> <?xml version="1.0" encoding="UTF-8"?><feed xmlns="http://www.w3.org/2005/Atom">
<title>{{.frontend.Host}} news</title> <title>{{.app_url.Host}} news</title>
<updated>{{.updated}}</updated> <updated>{{.updated}}</updated>
<subtitle>News and updates about my projects and self-hosted services</subtitle> <subtitle>News and updates about my projects and self-hosted services</subtitle>
<link href="{{.frontend.JoinPath "/news"}}"></link> <link href="{{.app_url.JoinPath "/news"}}"></link>
{{ range .entries }} {{ range .entries }}
<entry> <entry>
<title>{{.Title}}</title> <title>{{.Title}}</title>

View File

@ -1,4 +1,4 @@
node_modules node_modules
.svelte-kit .svelte-kit
build
public public
build

1
app/.gitignore vendored
View File

@ -8,3 +8,4 @@ node_modules
!.env.example !.env.example
vite.config.js.timestamp-* vite.config.js.timestamp-*
vite.config.ts.timestamp-* vite.config.ts.timestamp-*
nerdfonts.*

View File

@ -1,2 +1 @@
engine-strict=true engine-strict=true
resolution-mode=highest

View File

@ -3,7 +3,7 @@
"tabWidth": 2, "tabWidth": 2,
"singleQuote": false, "singleQuote": false,
"trailingComma": "es5", "trailingComma": "es5",
"printWidth": 100, "printWidth": 80,
"plugins": ["prettier-plugin-svelte"], "plugins": ["prettier-plugin-svelte"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }]
} }

View File

@ -1,23 +1,41 @@
FROM node:23.5.0 as build # build the application with node
FROM node:23.11.1 AS build
ARG WEBSITE_REPORT_URL
ARG WEBSITE_SOURCE_URL
ARG WEBSITE_DOC_URL
ARG WEBSITE_API_URL
ARG WEBSITE_API_PATH
ENV WEBSITE_REPORT_URL=$WEBSITE_REPORT_URL
ENV WEBSITE_SOURCE_URL=$WEBSITE_SOURCE_URL
ENV WEBSITE_DOC_URL=$WEBSITE_DOC_URL
ENV WEBSITE_API_URL=$WEBSITE_API_URL
ENV WEBSITE_API_PATH=$WEBSITE_API_PATH
WORKDIR /app WORKDIR /app
COPY . /app COPY . /app
ARG API_URL RUN apt install -y make sed wget
ENV VITE_API_URL_DEV $API_URL RUN npm install
RUN make
RUN npm install && npm run build # run it with bun (a lot faster)
FROM oven/bun:latest AS main
FROM oven/bun:1.1.20 as main
WORKDIR /app WORKDIR /app
COPY --from=build /app/build ./build COPY --from=build /app/build ./build
COPY --from=build /app/package.json ./package.json COPY --from=build /app/package.json ./package.json
COPY --from=build /app/package-lock.json ./package-lock.json COPY --from=build /app/package-lock.json ./package-lock.json
EXPOSE 4173 RUN useradd runner -r -u 1001 -d /app
RUN chown -R runner:runner /app
USER runner
RUN bun install RUN bun install
EXPOSE 7001
ENV PORT=7001
CMD ["bun", "build/index.js"] CMD ["bun", "build/index.js"]

25
app/Makefile Normal file
View File

@ -0,0 +1,25 @@
NF_CSS = static/css/nerdfonts.css
NF_WOFF = static/assets/nerdfonts.woff2
all: $(NF_CSS)
npm run build
$(NF_CSS): $(NF_WOFF)
wget "https://www.nerdfonts.com/assets/css/webfont.css" -O $@
sed 's/\.\.\/fonts\/Symbols-2048-em Nerd Font Complete\.woff2/\/assets\/nerdfonts\.woff2/g' -i $@
$(NF_WOFF):
wget "https://www.nerdfonts.com/assets/fonts/Symbols-2048-em%20Nerd%20Font%20Complete.woff2" -O $@
run: $(NF_CSS)
npm run dev
format:
npm run format
clean:
rm -rf build
rm $(NF_CSS)
rm $(NF_WOFF)
.PHONY: format run clean

179
app/package-lock.json generated
View File

@ -1,20 +1,19 @@
{ {
"name": "website", "name": "website",
"version": "5.0.0", "version": "6.3",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "website", "name": "website",
"version": "5.0.0", "version": "6.3",
"dependencies": { "dependencies": {
"@types/dompurify": "^3.2.0",
"dompurify": "^3.2.3", "dompurify": "^3.2.3",
"marked": "^15.0.4", "marked": "^16.0.0",
"svelte-i18n": "^4.0.1" "svelte-i18n": "^4.0.1"
}, },
"devDependencies": { "devDependencies": {
"@sveltejs/adapter-auto": "^3.3.1", "@sveltejs/adapter-auto": "^6.0.0",
"@sveltejs/adapter-node": "^5.2.11", "@sveltejs/adapter-node": "^5.2.11",
"@sveltejs/kit": "^2.15.1", "@sveltejs/kit": "^2.15.1",
"@sveltejs/vite-plugin-svelte": "^4.0.3", "@sveltejs/vite-plugin-svelte": "^4.0.3",
@ -832,23 +831,31 @@
"win32" "win32"
] ]
}, },
"node_modules/@sveltejs/acorn-typescript": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/@sveltejs/acorn-typescript/-/acorn-typescript-1.0.5.tgz",
"integrity": "sha512-IwQk4yfwLdibDlrXVE04jTZYlLnwsTT2PIOQQGNLWfjavGifnk1JD1LcZjZaBTRcxZu2FfPfNLOE04DSu9lqtQ==",
"license": "MIT",
"peerDependencies": {
"acorn": "^8.9.0"
}
},
"node_modules/@sveltejs/adapter-auto": { "node_modules/@sveltejs/adapter-auto": {
"version": "3.3.1", "version": "6.0.1",
"resolved": "https://registry.npmjs.org/@sveltejs/adapter-auto/-/adapter-auto-3.3.1.tgz", "resolved": "https://registry.npmjs.org/@sveltejs/adapter-auto/-/adapter-auto-6.0.1.tgz",
"integrity": "sha512-5Sc7WAxYdL6q9j/+D0jJKjGREGlfIevDyHSQ2eNETHcB1TKlQWHcAo8AS8H1QdjNvSXpvOwNjykDUHPEAyGgdQ==", "integrity": "sha512-mcWud3pYGPWM2Pphdj8G9Qiq24nZ8L4LB7coCUckUEy5Y7wOWGJ/enaZ4AtJTcSm5dNK1rIkBRoqt+ae4zlxcQ==",
"dev": true, "dev": true,
"dependencies": { "license": "MIT",
"import-meta-resolve": "^4.1.0"
},
"peerDependencies": { "peerDependencies": {
"@sveltejs/kit": "^2.0.0" "@sveltejs/kit": "^2.0.0"
} }
}, },
"node_modules/@sveltejs/adapter-node": { "node_modules/@sveltejs/adapter-node": {
"version": "5.2.11", "version": "5.2.13",
"resolved": "https://registry.npmjs.org/@sveltejs/adapter-node/-/adapter-node-5.2.11.tgz", "resolved": "https://registry.npmjs.org/@sveltejs/adapter-node/-/adapter-node-5.2.13.tgz",
"integrity": "sha512-lR7/dfUaKFf3aI408KRDy/BVDYoqUws7zNOJz2Hl4JoshlTnMgdha3brXBRFXB+cWtYvJjjPhvmq3xqpbioi4w==", "integrity": "sha512-yS2TVFmIrxjGhYaV5/iIUrJ3mJl6zjaYn0lBD70vTLnYvJeqf3cjvLXeXCUCuYinhSBoyF4DpfGla49BnIy7sQ==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"@rollup/plugin-commonjs": "^28.0.1", "@rollup/plugin-commonjs": "^28.0.1",
"@rollup/plugin-json": "^6.1.0", "@rollup/plugin-json": "^6.1.0",
@ -860,24 +867,24 @@
} }
}, },
"node_modules/@sveltejs/kit": { "node_modules/@sveltejs/kit": {
"version": "2.15.1", "version": "2.22.5",
"resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-2.15.1.tgz", "resolved": "https://registry.npmjs.org/@sveltejs/kit/-/kit-2.22.5.tgz",
"integrity": "sha512-8t7D3hQHbUDMiaQ2RVnjJJ/+Ur4Fn/tkeySJCsHtX346Q9cp3LAnav8xXdfuqYNJwpUGX0x3BqF1uvbmXQw93A==", "integrity": "sha512-l5i+LcDaoymD2mg5ziptnHmzzF79+c9twJiDoLWAPKq7afMEe4mvGesJ+LVtm33A92mLzd2KUHgtGSqTrvfkvg==",
"dev": true, "dev": true,
"hasInstallScript": true, "license": "MIT",
"dependencies": { "dependencies": {
"@sveltejs/acorn-typescript": "^1.0.5",
"@types/cookie": "^0.6.0", "@types/cookie": "^0.6.0",
"acorn": "^8.14.1",
"cookie": "^0.6.0", "cookie": "^0.6.0",
"devalue": "^5.1.0", "devalue": "^5.1.0",
"esm-env": "^1.2.1", "esm-env": "^1.2.2",
"import-meta-resolve": "^4.1.0",
"kleur": "^4.1.5", "kleur": "^4.1.5",
"magic-string": "^0.30.5", "magic-string": "^0.30.5",
"mrmime": "^2.0.0", "mrmime": "^2.0.0",
"sade": "^1.8.1", "sade": "^1.8.1",
"set-cookie-parser": "^2.6.0", "set-cookie-parser": "^2.6.0",
"sirv": "^3.0.0", "sirv": "^3.0.0"
"tiny-glob": "^0.2.9"
}, },
"bin": { "bin": {
"svelte-kit": "svelte-kit.js" "svelte-kit": "svelte-kit.js"
@ -886,16 +893,17 @@
"node": ">=18.13" "node": ">=18.13"
}, },
"peerDependencies": { "peerDependencies": {
"@sveltejs/vite-plugin-svelte": "^3.0.0 || ^4.0.0-next.1 || ^5.0.0", "@sveltejs/vite-plugin-svelte": "^3.0.0 || ^4.0.0-next.1 || ^5.0.0 || ^6.0.0-next.0",
"svelte": "^4.0.0 || ^5.0.0-next.0", "svelte": "^4.0.0 || ^5.0.0-next.0",
"vite": "^5.0.3 || ^6.0.0" "vite": "^5.0.3 || ^6.0.0 || ^7.0.0-beta.0"
} }
}, },
"node_modules/@sveltejs/vite-plugin-svelte": { "node_modules/@sveltejs/vite-plugin-svelte": {
"version": "4.0.3", "version": "4.0.4",
"resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-4.0.3.tgz", "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte/-/vite-plugin-svelte-4.0.4.tgz",
"integrity": "sha512-J7nC5gT5qpmvyD2pmzPUntLUgoinyEaNy9sTpGGE6N7pblggO0A1NyneJJvR2ELlzK6ti28aF2SLXG1yJdnJeA==", "integrity": "sha512-0ba1RQ/PHen5FGpdSrW7Y3fAMQjrXantECALeOiOdBdzR5+5vPP6HVZRLmZaQL+W8m++o+haIAKq5qT+MiZ7VA==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"@sveltejs/vite-plugin-svelte-inspector": "^3.0.0-next.0||^3.0.0", "@sveltejs/vite-plugin-svelte-inspector": "^3.0.0-next.0||^3.0.0",
"debug": "^4.3.7", "debug": "^4.3.7",
@ -912,11 +920,12 @@
"vite": "^5.0.0" "vite": "^5.0.0"
} }
}, },
"node_modules/@sveltejs/vite-plugin-svelte/node_modules/@sveltejs/vite-plugin-svelte-inspector": { "node_modules/@sveltejs/vite-plugin-svelte-inspector": {
"version": "3.0.0", "version": "3.0.1",
"resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte-inspector/-/vite-plugin-svelte-inspector-3.0.0.tgz", "resolved": "https://registry.npmjs.org/@sveltejs/vite-plugin-svelte-inspector/-/vite-plugin-svelte-inspector-3.0.1.tgz",
"integrity": "sha512-hBxSYW/66989cq9dN248omD/ziskSdIV1NqfuueuAI1z6jGcg14k9Zd98pDIEnoA6wC9kWUGuQ6adzBbWwQyRg==", "integrity": "sha512-2CKypmj1sM4GE7HjllT7UKmo4Q6L5xFRd7VMGEWhYnZ+wc6AUVU01IBd7yUi6WnFndEwWoMNOd6e8UjoN0nbvQ==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"debug": "^4.3.7" "debug": "^4.3.7"
}, },
@ -936,15 +945,6 @@
"dev": true, "dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/@types/dompurify": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/@types/dompurify/-/dompurify-3.2.0.tgz",
"integrity": "sha512-Fgg31wv9QbLDA0SpTOXO3MaxySc4DKGLi8sna4/Utjo4r3ZRPdCt4UQee8BWr+Q5z21yifghREPJGYaEOEIACg==",
"deprecated": "This is a stub types definition. dompurify provides its own type definitions, so you do not need this installed.",
"dependencies": {
"dompurify": "*"
}
},
"node_modules/@types/estree": { "node_modules/@types/estree": {
"version": "1.0.5", "version": "1.0.5",
"resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz", "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.5.tgz",
@ -964,9 +964,10 @@
"optional": true "optional": true
}, },
"node_modules/acorn": { "node_modules/acorn": {
"version": "8.14.0", "version": "8.14.1",
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.0.tgz", "resolved": "https://registry.npmjs.org/acorn/-/acorn-8.14.1.tgz",
"integrity": "sha512-cl669nCJTZBsL97OF4kUQm5g5hC2uihk0NxY3WENAC0TYdILVkAyHymAntgxGkl7K+t0cXIrH5siy5S4XkFycA==", "integrity": "sha512-OvQ/2pUDKmgfCg++xsTX1wGxfTaszcHVcTctW4UJB4hibJx2HXxxO5UmVgyjMa+ZDsiaf5wWLXYpRWMmBI0QHg==",
"license": "MIT",
"bin": { "bin": {
"acorn": "bin/acorn" "acorn": "bin/acorn"
}, },
@ -974,14 +975,6 @@
"node": ">=0.4.0" "node": ">=0.4.0"
} }
}, },
"node_modules/acorn-typescript": {
"version": "1.4.13",
"resolved": "https://registry.npmjs.org/acorn-typescript/-/acorn-typescript-1.4.13.tgz",
"integrity": "sha512-xsc9Xv0xlVfwp2o7sQ+GCQ1PgbkdcpWdTzrwXxO3xDMTAywVS3oXVOcOHuRjAPkS4P9b+yc/qNF15460v+jp4Q==",
"peerDependencies": {
"acorn": ">=8.9.0"
}
},
"node_modules/aria-query": { "node_modules/aria-query": {
"version": "5.3.2", "version": "5.3.2",
"resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.2.tgz", "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.2.tgz",
@ -1090,9 +1083,10 @@
"dev": true "dev": true
}, },
"node_modules/dompurify": { "node_modules/dompurify": {
"version": "3.2.3", "version": "3.2.6",
"resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.3.tgz", "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.2.6.tgz",
"integrity": "sha512-U1U5Hzc2MO0oW3DF+G9qYN0aT7atAou4AgI0XjWz061nyBPbdxkfdhfy5uMgGn6+oLFCfn44ZGbdDqCzVmlOWA==", "integrity": "sha512-/2GogDQlohXPZe6D6NOgQvXLPSYBqIWMnZ8zzOhn09REE4eyAzb+Hed3jhoM9OkuaJ8P6ZGTTVWQKAi8ieIzfQ==",
"license": "(MPL-2.0 OR Apache-2.0)",
"optionalDependencies": { "optionalDependencies": {
"@types/trusted-types": "^2.0.7" "@types/trusted-types": "^2.0.7"
} }
@ -1188,9 +1182,10 @@
} }
}, },
"node_modules/esm-env": { "node_modules/esm-env": {
"version": "1.2.1", "version": "1.2.2",
"resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.2.1.tgz", "resolved": "https://registry.npmjs.org/esm-env/-/esm-env-1.2.2.tgz",
"integrity": "sha512-U9JedYYjCnadUlXk7e1Kr+aENQhtUaoaV9+gZm1T8LC/YBAPJx3NSPIAurFOC0U5vrdSevnUJS2/wUVxGwPhng==" "integrity": "sha512-Epxrv+Nr/CaL4ZcFGPJIYLWFom+YeV1DqMLHJoEd9SYRxNbaFruBwfEX/kkHUJf55j2+TUbmDcmuilbP1TmXHA==",
"license": "MIT"
}, },
"node_modules/esniff": { "node_modules/esniff": {
"version": "2.0.1", "version": "2.0.1",
@ -1208,9 +1203,10 @@
} }
}, },
"node_modules/esrap": { "node_modules/esrap": {
"version": "1.3.2", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/esrap/-/esrap-1.3.2.tgz", "resolved": "https://registry.npmjs.org/esrap/-/esrap-2.1.0.tgz",
"integrity": "sha512-C4PXusxYhFT98GjLSmb20k9PREuUdporer50dhzGuJu9IJXktbMddVCMLAERl5dAHyAi73GWWCE4FVHGP1794g==", "integrity": "sha512-yzmPNpl7TBbMRC5Lj2JlJZNPml0tzqoqP5B1JXycNUwtqma9AKCO0M2wHrdgsHcy1WRW7S9rJknAMtByg3usgA==",
"license": "MIT",
"dependencies": { "dependencies": {
"@jridgewell/sourcemap-codec": "^1.4.15" "@jridgewell/sourcemap-codec": "^1.4.15"
} }
@ -1302,17 +1298,6 @@
"node": ">= 0.4" "node": ">= 0.4"
} }
}, },
"node_modules/import-meta-resolve": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/import-meta-resolve/-/import-meta-resolve-4.1.0.tgz",
"integrity": "sha512-I6fiaX09Xivtk+THaMfAwnA3MVA5Big1WHF1Dfx9hFuvNIWpXnorlkzhcQf6ehrqQiiZECRt1poOAkPmer3ruw==",
"dev": true,
"license": "MIT",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/wooorm"
}
},
"node_modules/intl-messageformat": { "node_modules/intl-messageformat": {
"version": "10.7.11", "version": "10.7.11",
"resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-10.7.11.tgz", "resolved": "https://registry.npmjs.org/intl-messageformat/-/intl-messageformat-10.7.11.tgz",
@ -1399,14 +1384,15 @@
} }
}, },
"node_modules/marked": { "node_modules/marked": {
"version": "15.0.4", "version": "16.0.0",
"resolved": "https://registry.npmjs.org/marked/-/marked-15.0.4.tgz", "resolved": "https://registry.npmjs.org/marked/-/marked-16.0.0.tgz",
"integrity": "sha512-TCHvDqmb3ZJ4PWG7VEGVgtefA5/euFmsIhxtD0XsBxI39gUSKL81mIRFdt0AiNQozUahd4ke98ZdirExd/vSEw==", "integrity": "sha512-MUKMXDjsD/eptB7GPzxo4xcnLS6oo7/RHimUMHEDRhUooPwmN9BEpMl7AEOJv3bmso169wHI2wUF9VQgL7zfmA==",
"license": "MIT",
"bin": { "bin": {
"marked": "bin/marked.js" "marked": "bin/marked.js"
}, },
"engines": { "engines": {
"node": ">= 18" "node": ">= 20"
} }
}, },
"node_modules/memoizee": { "node_modules/memoizee": {
@ -1529,9 +1515,9 @@
} }
}, },
"node_modules/prettier": { "node_modules/prettier": {
"version": "3.4.2", "version": "3.6.2",
"resolved": "https://registry.npmjs.org/prettier/-/prettier-3.4.2.tgz", "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.6.2.tgz",
"integrity": "sha512-e9MewbtFo+Fevyuxn/4rrcDAaq0IYxPGLvObpQjiZBMAzB9IGmzlnG9RZy3FFas+eBMu2vA0CszMeduow5dIuQ==", "integrity": "sha512-I7AIg5boAr5R0FFtJ6rCfD+LFsWHp81dolrFD8S79U9tb8Az2nGrJncnMSnys+bpQJfRUzqs9hnA81OAA3hCuQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"bin": { "bin": {
@ -1545,9 +1531,9 @@
} }
}, },
"node_modules/prettier-plugin-svelte": { "node_modules/prettier-plugin-svelte": {
"version": "3.3.2", "version": "3.4.0",
"resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-3.3.2.tgz", "resolved": "https://registry.npmjs.org/prettier-plugin-svelte/-/prettier-plugin-svelte-3.4.0.tgz",
"integrity": "sha512-kRPjH8wSj2iu+dO+XaUv4vD8qr5mdDmlak3IT/7AOgGIMRG86z/EHOLauFcClKEnOUf4A4nOA7sre5KrJD4Raw==", "integrity": "sha512-pn1ra/0mPObzqoIQn/vUTR3ZZI6UuZ0sHqMK5x2jMLGrs53h0sXhkVuDcrlssHwIMk7FYrMjHBPoUSyyEEDlBQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"peerDependencies": { "peerDependencies": {
@ -1663,20 +1649,21 @@
} }
}, },
"node_modules/svelte": { "node_modules/svelte": {
"version": "5.16.0", "version": "5.35.6",
"resolved": "https://registry.npmjs.org/svelte/-/svelte-5.16.0.tgz", "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.35.6.tgz",
"integrity": "sha512-Ygqsiac6UogVED2ruKclU+pOeMThxWtp9LG+li7BXeDKC2paVIsRTMkNmcON4Zejerd1s5sZHWx6ZtU85xklVg==", "integrity": "sha512-p7PVLQYrvCxJuxzGfOv/l71hVuHC6EZk5UDjbt/bndMYaBcUV5sFjDsj+PSIYvz1vcfbG6inX83/xIUeik1xGA==",
"license": "MIT",
"dependencies": { "dependencies": {
"@ampproject/remapping": "^2.3.0", "@ampproject/remapping": "^2.3.0",
"@jridgewell/sourcemap-codec": "^1.5.0", "@jridgewell/sourcemap-codec": "^1.5.0",
"@sveltejs/acorn-typescript": "^1.0.5",
"@types/estree": "^1.0.5", "@types/estree": "^1.0.5",
"acorn": "^8.12.1", "acorn": "^8.12.1",
"acorn-typescript": "^1.4.13",
"aria-query": "^5.3.1", "aria-query": "^5.3.1",
"axobject-query": "^4.1.0", "axobject-query": "^4.1.0",
"clsx": "^2.1.1", "clsx": "^2.1.1",
"esm-env": "^1.2.1", "esm-env": "^1.2.1",
"esrap": "^1.3.2", "esrap": "^2.1.0",
"is-reference": "^3.0.3", "is-reference": "^3.0.3",
"locate-character": "^3.0.0", "locate-character": "^3.0.0",
"magic-string": "^0.30.11", "magic-string": "^0.30.11",
@ -2161,10 +2148,11 @@
"license": "ISC" "license": "ISC"
}, },
"node_modules/vite": { "node_modules/vite": {
"version": "5.4.11", "version": "5.4.19",
"resolved": "https://registry.npmjs.org/vite/-/vite-5.4.11.tgz", "resolved": "https://registry.npmjs.org/vite/-/vite-5.4.19.tgz",
"integrity": "sha512-c7jFQRklXua0mTzneGW9QVyxFjUgwcihC4bXEtujIo2ouWCe1Ajt/amn2PCxYnhYfd5k09JX3SB7OYWFKYqj8Q==", "integrity": "sha512-qO3aKv3HoQC8QKiNSTuUM1l9o/XX3+c+VTgLHbJWHZGeTPVAg2XwazI9UWzoxjIJCGCV2zU60uqMzjeLZuULqA==",
"dev": true, "dev": true,
"license": "MIT",
"dependencies": { "dependencies": {
"esbuild": "^0.21.3", "esbuild": "^0.21.3",
"postcss": "^8.4.43", "postcss": "^8.4.43",
@ -2220,12 +2208,17 @@
} }
}, },
"node_modules/vitefu": { "node_modules/vitefu": {
"version": "1.0.3", "version": "1.0.6",
"resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.0.3.tgz", "resolved": "https://registry.npmjs.org/vitefu/-/vitefu-1.0.6.tgz",
"integrity": "sha512-iKKfOMBHob2WxEJbqbJjHAkmYgvFDPhuqrO82om83S8RLk+17FtyMBfcyeH8GqD0ihShtkMW/zzJgiA51hCNCQ==", "integrity": "sha512-+Rex1GlappUyNN6UfwbVZne/9cYC4+R2XDk9xkNXBKMw6HQagdX9PgZ8V2v1WUSK1wfBLp7qbI1+XSNIlB1xmA==",
"dev": true, "dev": true,
"license": "MIT",
"workspaces": [
"tests/deps/*",
"tests/projects/*"
],
"peerDependencies": { "peerDependencies": {
"vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0-beta.0" "vite": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0"
}, },
"peerDependenciesMeta": { "peerDependenciesMeta": {
"vite": { "vite": {

View File

@ -1,16 +1,16 @@
{ {
"name": "website", "name": "website",
"version": "6.0", "version": "6.3",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "VITE_API_URL=http://127.0.0.1:7001 VITE_FRONTEND_URL=http://localhost:5173 vite dev", "dev": "vite dev",
"build": "vite build", "build": "vite build",
"preview": "vite preview --host", "preview": "vite preview",
"lint": "prettier --check .", "lint": "prettier --check .",
"format": "prettier --write ." "format": "prettier --write ."
}, },
"devDependencies": { "devDependencies": {
"@sveltejs/adapter-auto": "^3.3.1", "@sveltejs/adapter-auto": "^6.0.0",
"@sveltejs/adapter-node": "^5.2.11", "@sveltejs/adapter-node": "^5.2.11",
"@sveltejs/kit": "^2.15.1", "@sveltejs/kit": "^2.15.1",
"@sveltejs/vite-plugin-svelte": "^4.0.3", "@sveltejs/vite-plugin-svelte": "^4.0.3",
@ -21,9 +21,8 @@
}, },
"type": "module", "type": "module",
"dependencies": { "dependencies": {
"@types/dompurify": "^3.2.0",
"dompurify": "^3.2.3", "dompurify": "^3.2.3",
"marked": "^15.0.4", "marked": "^16.0.0",
"svelte-i18n": "^4.0.1" "svelte-i18n": "^4.0.1"
} }
} }

View File

@ -1,7 +0,0 @@
import { locale } from "svelte-i18n";
export const handle = async ({ event, resolve }) => {
const lang = event.request.headers.get("accept-language")?.split(",")[0];
if (lang) locale.set(lang);
return resolve(event);
};

View File

@ -1,21 +1,51 @@
const version = "v1"; import { browser } from "$app/environment";
const url = new URL(version + "/", import.meta.env.VITE_API_URL).href; import { urljoin } from "$lib/util.js";
function join(path) { const api_version = "v1";
if (null === path || path === "") return url;
if (path[0] === "/") path = path.slice(1); function api_urljoin(path = null, query = {}) {
let api_url = "";
return new URL(path, url).href; if (browser) api_url = urljoin(import.meta.env.WEBSITE_API_PATH, api_version);
else api_url = urljoin(import.meta.env.WEBSITE_API_URL, api_version);
return urljoin(api_url, path, query);
} }
async function services(fetch) { function api_check_err(json) {
const res = await fetch(join("/services")); if (!("error" in json))
throw new Error('API response is missing the "error" key');
if (json["error"] != "")
throw new Error(`API returned an error: ${json["error"]}`);
if (!("result" in json))
throw new Error('API response is missing the "result" key');
}
async function api_http_get(fetch, url) {
const res = await fetch(url);
const json = await res.json(); const json = await res.json();
api_check_err(json);
if (!("result" in json)) return []; return json["result"];
return json.result;
} }
export { version, join, services }; async function api_get_metrics(fetch) {
return await api_http_get(fetch, api_urljoin("/metrics"));
}
async function api_get_services(fetch) {
return await api_http_get(fetch, api_urljoin("/services"));
}
async function api_get_projects(fetch) {
return await api_http_get(fetch, api_urljoin("/projects"));
}
export {
api_version,
api_urljoin,
api_get_metrics,
api_get_services,
api_get_projects,
};

View File

@ -1,74 +0,0 @@
<script>
import { click } from "$lib/util.js";
export let title;
export let url;
let current = "";
let i = 0;
while (title.length > i) {
let c = title[i];
setTimeout(
() => {
current += c;
},
100 * (i + 1)
);
i += 1;
}
</script>
<a on:click={click} data-sveltekit-preload-data href={url}>
<div class="title">
{current}
</div>
<div class="content">
<slot></slot>
</div>
</a>
<style>
a {
display: flex;
flex-direction: column;
width: 100%;
background: var(--dark-three);
box-shadow: var(--box-shadow);
border-radius: var(--radius);
cursor: pointer;
transition: 0.4s;
text-decoration: none;
border: solid 1px var(--border-color);
}
a:hover > .title {
text-shadow: var(--text-shadow);
}
.title {
border: solid 1px var(--dark-two);
background: var(--dark-two);
padding: 25px;
border-radius: 7px 7px 0px 0px;
font-size: 20px;
font-family:
Consolas,
Monaco,
Lucida Console,
Liberation Mono,
DejaVu Sans Mono,
Bitstream Vera Sans Mono,
Courier New,
monospace;
color: white;
}
.content {
background: var(--dark-three);
padding: 30px;
padding-top: 30px;
color: white;
border-radius: 5px;
font-size: 25px;
}
</style>

View File

@ -1,25 +0,0 @@
<script>
export let class_name;
</script>
<main class={class_name}>
<slot></slot>
</main>
<style>
main {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: stretch;
padding: 50px;
gap: 28px;
}
@media only screen and (max-width: 900px) {
main {
flex-direction: column;
}
}
</style>

29
app/src/lib/doc.js Normal file
View File

@ -0,0 +1,29 @@
import { urljoin } from "$lib/util.js";
function doc_urljoin(path = null, query = {}) {
return urljoin(import.meta.env.WEBSITE_DOC_URL, path, query);
}
function doc_check_err(json) {
if ("error" in json)
throw new Error(`Documentation server returned an error: ${json["error"]}`);
}
async function doc_http_get(fetch, url) {
const res = await fetch(url);
const json = await res.json();
doc_check_err(json);
return json;
}
async function doc_get_list(fetch) {
return await doc_http_get(fetch, doc_urljoin("/list"));
}
async function doc_get(fetch, name) {
let url = doc_urljoin("/get");
url = urljoin(url, name);
return await doc_http_get(fetch, url);
}
export { doc_urljoin, doc_get, doc_get_list };

62
app/src/lib/error.svelte Normal file
View File

@ -0,0 +1,62 @@
<script>
import Link from "$lib/link.svelte";
import { color } from "$lib/util.js";
import { _ } from "svelte-i18n";
export let error = "";
</script>
<main>
<h1 style="color: var(--{color()})">{$_("error.title")}</h1>
<code>
{#if error === ""}
Unknown error
{:else}
{error}
{/if}
</code>
<Link link={import.meta.env.WEBSITE_REPORT_URL}>
{$_("error.report")}
</Link>
<img src="/profile/sad.png" alt="" />
</main>
<style>
main {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 1;
display: flex;
flex-direction: column;
justify-content: end;
align-items: flex-start;
gap: 10px;
padding: 50px;
font-size: var(--size-4);
background: var(--background);
background-size: 50%;
}
main h1 {
font-size: var(--size-6);
}
main code {
font-size: var(--size-4);
color: var(--white-2);
}
main img {
width: var(--profile-size);
position: absolute;
right: 0;
bottom: 0;
}
</style>

View File

@ -1,45 +1,51 @@
<script> <script>
import { color, date_from_ts } from "$lib/util.js";
import { api_get_metrics } from "$lib/api.js";
import Link from "$lib/link.svelte"; import Link from "$lib/link.svelte";
import { color } from "$lib/util.js";
import { onMount } from "svelte";
import { _ } from "svelte-i18n"; import { _ } from "svelte-i18n";
let visitor_count = 1001; let show_counter = false,
data = {};
function should_congrat() { onMount(async () => {
return visitor_count % 1000 == 0; show_counter = true;
} data = await api_get_metrics(fetch);
});
</script> </script>
<footer style="border-top: solid 2px var(--{color()});"> <footer style="border-top: solid 2px var(--{color()});">
<div class="info"> <div class="links">
<div class="links">
<span>
<Link href="/" bold={true}>{$_("footer.source")}</Link>
</span>
<span>/</span>
<span>
<Link href="/" bold={true}>{$_("footer.license")}</Link>
</span>
<span>/</span>
<span>
<Link href="/" bold={true}>{$_("footer.privacy")}</Link>
</span>
</div>
<span> <span>
{$_("footer.powered")} <Link link={import.meta.env.WEBSITE_SOURCE_URL} bold={true}
>{$_("footer.source")}</Link
>
</span>
<span>/</span>
<span>
<Link link="/doc/license" bold={true}>{$_("footer.license")}</Link>
</span>
<span>/</span>
<span>
<Link link="/doc/privacy" bold={true}>{$_("footer.privacy")}</Link>
</span> </span>
</div> </div>
<div class="useless"> {#if show_counter}
<span> <span class="counter">
{$_("footer.number", { values: { count: visitor_count } })} {$_("footer.number", {
{#if should_congrat()} values: {
<span style="color: var(--{color()})">({$_("footer.congrats")})</span> total: data.total,
since: date_from_ts(data.since),
},
})}
{#if data.number % 1000 == 0}
<span style="color: var(--{color()})">({$_("footer.wow")})</span>
{/if} {/if}
</span> </span>
<span> {:else}
{$_("footer.version", { values: { api_version: "v1", frontend_version: pkg.version } })} <span class="counter">{$_("footer.js")}</span>
</span> {/if}
</div>
</footer> </footer>
<style> <style>
@ -49,27 +55,29 @@
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
background: var(--black-1); background: var(--black-1);
box-sizing: border-box;
padding: 20px 50px 20px 50px;
} }
div { div {
display: flex; display: flex;
color: var(--white-2);
font-size: var(--size-2); font-size: var(--size-2);
flex-direction: column; flex-direction: column;
gap: 5px; gap: 5px;
} }
.useless { span {
margin: 25px 50px 25px 0; color: var(--white-2);
font-size: 15px;
}
.counter {
text-align: right; text-align: right;
} }
.info { .links {
margin: 25px 0 25px 50px;
text-align: left; text-align: left;
}
.info .links {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
gap: 5px; gap: 5px;

View File

@ -1,15 +1,24 @@
<script> <script>
import { frontend_url, api_url } from "$lib/util.js"; import { api_urljoin } from "$lib/api.js";
export let desc, title; export let desc, title;
</script> </script>
<svelte:head> <svelte:head>
<title>[ngn.tf] | {title}</title> <title>[ngn.tf] | {title}</title>
<meta content="[ngn.tf] | {title}" property="og:title" /> <meta name="description" content={desc} />
<meta content={desc} property="og:description" /> <meta name="author" content="ngn" />
<meta content={frontend_url()} property="og:url" /> <meta name="keywords" content="ngn,ngn13,ngn1,ngn.tf" />
<meta content="#000000" data-react-helmet="true" name="theme-color" /> <meta name="color-scheme" content="only dark" />
<meta name="theme-color" content="#000000" />
<link rel="alternate" type="application/atom+xml" href={api_url("/news/en")} title="Atom Feed" /> <meta property="og:title" content="[ngn.tf] | {title}" />
<meta property="og:description" content={desc} />
<link
rel="alternate"
type="application/atom+xml"
href={api_urljoin("/news/en")}
title="Service news and updates"
/>
</svelte:head> </svelte:head>

View File

@ -1,32 +1,55 @@
<script> <script>
import { browser } from "$app/environment";
import { color } from "$lib/util.js"; import { color } from "$lib/util.js";
import { onMount } from "svelte";
import { _ } from "svelte-i18n"; import { _ } from "svelte-i18n";
export let picture = ""; export let picture = "";
export let title = ""; export let title = "";
let current = ""; let title_cur = title;
let show_animation = false;
for (let i = 0; i < title.length; i++) { function animate(title) {
setTimeout( if (!browser) return;
() => {
current += title[i]; let id = window.setTimeout(function () {}, 0);
},
100 * (i + 1) while (id--) clearTimeout(id);
);
title_cur = "";
for (let i = 0; i < title.length; i++) {
setTimeout(() => {
title_cur += title[i];
}, i * 70);
}
} }
onMount(() => {
show_animation = true;
});
$: animate(title);
</script> </script>
<header> <header>
<h1 style="color: var(--{color()})">{current}</h1> <div>
{#if show_animation}
<h1 class="title" style="color: var(--{color()})">{title_cur}</h1>
<h1 class="cursor" style="color: var(--{color()})">_</h1>
{:else}
<h1 class="title" style="color: var(--{color()})">{title}</h1>
{/if}
</div>
<img src="/profile/{picture}.png" alt="" /> <img src="/profile/{picture}.png" alt="" />
</header> </header>
<style> <style>
header { header {
background: linear-gradient(rgba(11, 11, 11, 0.808), rgba(1, 1, 1, 0.96)), background: var(--background);
url("https://files.ngn.tf/banner.png");
background-size: 50%; background-size: 50%;
width: 100%; width: 100%;
height: 100%; height: 100%;
display: flex; display: flex;
@ -35,15 +58,12 @@
align-items: end; align-items: end;
} }
img { header div {
padding: 50px 50px 0 50px; display: flex;
width: 220px; flex-direction: row;
bottom: 0; align-items: end;
left: 0; padding: 50px 50px 30px 50px;
} font-size: var(--size-6);
h1 {
font-size: var(--size-7);
font-family: font-family:
Consolas, Consolas,
Monaco, Monaco,
@ -53,29 +73,35 @@
Bitstream Vera Sans Mono, Bitstream Vera Sans Mono,
Courier New, Courier New,
monospace; monospace;
padding: 50px 50px 30px 50px;
white-space: nowrap; white-space: nowrap;
text-align: center; justify-content: start;
color: white; width: min-content;
text-shadow: var(--text-shadow);
} }
h1::after { header div .title {
text-shadow: var(--text-shadow);
overflow: hidden;
}
header div .cursor {
content: "_"; content: "_";
display: inline-block; display: inline-block;
animation: blink 1.5s steps(2) infinite; animation: blink 1.5s steps(2) infinite;
} }
header img {
padding: 50px 50px 0 50px;
width: var(--profile-size);
bottom: 0;
left: 0;
}
@media only screen and (max-width: 900px) { @media only screen and (max-width: 900px) {
header { header {
display: block; display: block;
} }
h1 { header img {
padding: 80px;
}
img {
display: none; display: none;
} }
} }

View File

@ -1,4 +0,0 @@
export default [
{ code: "en", name: "English", icon: "🇬🇧", path: "../locales/en.json" },
{ code: "tr", name: "Turkish", icon: "🇹🇷", path: "../locales/tr.json" },
];

View File

@ -5,10 +5,13 @@
const default_color = "white-1"; const default_color = "white-1";
export let active = false; export let active = false;
export let highlight = true;
export let link = ""; export let link = "";
export let icon = ""; export let icon = "";
let style = `text-decoration-color: var(--${color()});`; let style = "";
if (highlight) style = `text-decoration-color: var(--${color()});`;
if (active) style += `color: var(--${color()});`; if (active) style += `color: var(--${color()});`;
else style += `color: var(--${default_color});`; else style += `color: var(--${default_color});`;
@ -17,6 +20,18 @@
{#if icon != ""} {#if icon != ""}
<Icon {icon} /> <Icon {icon} />
{/if} {/if}
<a {style} href={link}> {#if highlight}
<slot></slot> <a data-sveltekit-preload-data {style} href={link}>
</a> <slot></slot>
</a>
{:else}
<a data-sveltekit-preload-data {style} class="no-highlight" href={link}>
<slot></slot>
</a>
{/if}
<style>
.no-highlight:hover {
text-decoration: none;
}
</style>

67
app/src/lib/locale.js Normal file
View File

@ -0,0 +1,67 @@
import { init, locale, register, waitLocale } from "svelte-i18n";
import { browser } from "$app/environment";
import { get, writable } from "svelte/store";
const locale_default = "en";
let locale_index = writable(0);
let locale_list = [];
function locale_setup() {
// english
register("en", () => import("../locales/en.json"));
locale_list.push({ code: "en", name: "English", icon: "🇬🇧" });
// turkish
register("tr", () => import("../locales/tr.json"));
locale_list.push({ code: "tr", name: "Turkish", icon: "🇹🇷" });
init({
fallbackLocale: locale_default,
initialLocale: get(locale),
});
}
function locale_from_browser() {
if (browser) return window.navigator.language.slice(0, 2).toLowerCase();
else return locale_default;
}
function locale_select(l = null) {
if (l === null) {
if (browser && null !== (l = localStorage.getItem("locale")))
locale_select(l);
else locale_select(locale_from_browser());
return;
}
l = l.slice(0, 2);
for (let i = 0; i < locale_list.length; i++) {
if (l !== locale_list[i].code) continue;
if (browser) localStorage.setItem("locale", l);
locale.set(l);
locale_index.set(i);
return;
}
locale.set(locale_default);
locale_index.set(0);
}
async function locale_wait() {
await waitLocale();
}
export {
locale,
locale_list,
locale_index,
locale_default,
locale_setup,
locale_wait,
locale_select,
locale_from_browser,
};

View File

@ -18,13 +18,13 @@
<style> <style>
nav { nav {
box-shadow: var(--box-shadow-1);
background: var(--black-1); background: var(--black-1);
padding: 20px 30px 20px 20px; padding: 20px 30px 20px 20px;
display: flex; display: flex;
flex-direction: row; flex-direction: row;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
box-shadow: var(--def-shadow);
} }
div { div {

View File

@ -3,14 +3,13 @@
import { page } from "$app/stores"; import { page } from "$app/stores";
export let link; export let link;
function is_active() {
return $page.url.pathname == link;
}
</script> </script>
<a <a
style="text-decoration-color: var(--{color()}); {is_active() ? `color: var(--${color()})` : ''}" style="
text-decoration-color: var(--{color()});
{$page.url.pathname === link ? `color: var(--${color()});` : ''}
"
data-sveltekit-preload-data data-sveltekit-preload-data
on:click={click} on:click={click}
href={link} href={link}

View File

@ -1,26 +1,33 @@
<script> <script>
import { locale } from "svelte-i18n"; import { locale_list, locale_select, locale_index } from "$lib/locale.js";
import languages from "$lib/lang.js"; import { onMount } from "svelte";
let icon = "",
indx = 0, let len = locale_list.length;
len = languages.length; let show = false;
function get_next(indx) {
let new_indx = 0;
if (indx + 1 >= len) indx = 0;
else new_indx = indx + 1;
return locale_list[new_indx];
}
function next() { function next() {
if (indx >= languages.length) indx = 0; locale_select(get_next($locale_index).code);
icon = languages[indx].icon;
locale.set(languages[indx++].code);
} }
for (indx = 0; indx < len; indx++) { onMount(() => {
if (languages[indx].code == $locale.slice(0, 2)) { show = true;
icon = languages[indx++].icon; });
break;
}
}
</script> </script>
<button on:click={next}>{icon}</button> {#if show}
<button on:click={next}>
{get_next($locale_index).icon}
</button>
{/if}
<style> <style>
button { button {

View File

@ -3,38 +3,51 @@
import Link from "$lib/link.svelte"; import Link from "$lib/link.svelte";
import { color, time_from_ts } from "$lib/util.js"; import { color, time_from_ts } from "$lib/util.js";
import { locale } from "svelte-i18n"; import { locale, _ } from "svelte-i18n";
export let service = {}; export let service = {};
let style = "";
if (service.check_res == 0) style = "opacity: 70%";
</script> </script>
<main {style}> <main>
<div class="info"> <div class="info">
<div class="title"> <div class="title">
<h1>{service.name}</h1> <h1>{service.name}</h1>
<p>{service.desc[$locale.slice(0, 2)]}</p> <p>{service.desc[$locale]}</p>
</div> </div>
<div class="links"> <div class="links">
<Link link={service.clear}><Icon icon="nf-oct-link" /></Link> <Link highlight={false} link={service.clear}
><Icon icon="nf-oct-link" /></Link
>
{#if service.onion != ""} {#if service.onion != ""}
<Link link={service.onion}><Icon icon="nf-linux-tor" /></Link> <Link highlight={false} link={service.onion}
><Icon icon="nf-linux-tor" /></Link
>
{/if} {/if}
{#if service.i2p != ""} {#if service.i2p != ""}
<Link link={service.i2p}><span style="color: var(--{color()})">I2P</span></Link> <Link highlight={false} link={service.i2p}
><span style="color: var(--{color()})">I2P</span></Link
>
{/if} {/if}
</div> </div>
</div> </div>
<div class="check"> <div class="check">
<h1>Last checked at {time_from_ts(service.check_time)}</h1> <h1>
{$_("services.last", {
values: { time: time_from_ts(service.check_time) },
})}
</h1>
{#if service.check_res == 0} {#if service.check_res == 0}
<span style="background: var(--white-2)">Down</span> <span style="background: var(--white-2)">
{$_("services.status.down")}
</span>
{:else if service.check_res == 1} {:else if service.check_res == 1}
<span style="background: var(--{color()})">Up</span> <span style="background: var(--{color()})">
{$_("services.status.up")}
</span>
{:else if service.check_res == 2} {:else if service.check_res == 2}
<span style="background: var(--white-2)">Slow</span> <span style="background: var(--{color()}); filter: brightness(50%);">
{$_("services.status.slow")}
</span>
{/if} {/if}
</div> </div>
</main> </main>
@ -58,16 +71,19 @@
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
color: var(--white-1); color: var(--white-1);
flex: 1;
} }
main .info .title h1 { main .info .title h1 {
font-size: var(--size-5); font-size: var(--size-5);
margin-bottom: 8px; margin-bottom: 8px;
font-weight: 900;
} }
main .info .title p { main .info .title p {
font-size: var(--size-4); font-size: var(--size-4);
color: var(--white-2); color: var(--white-2);
font-weight: 100;
} }
main .info .links { main .info .links {

View File

@ -1,4 +1,4 @@
import { join } from "$lib/api.js"; import { locale_from_browser } from "$lib/locale.js";
const colors = [ const colors = [
"yellow", "yellow",
@ -8,8 +8,8 @@ const colors = [
"red", "red",
// "blue" (looks kinda ass) // "blue" (looks kinda ass)
]; ];
let colors_pos = -1; let colors_pos = -1;
let api_url = join;
function color() { function color() {
if (colors_pos < 0) colors_pos = Math.floor(Math.random() * colors.length); if (colors_pos < 0) colors_pos = Math.floor(Math.random() * colors.length);
@ -19,17 +19,43 @@ function color() {
} }
function click() { function click() {
let audio = new Audio("/click.wav"); let audio = new Audio("/assets/click.wav");
audio.play(); audio.play();
} }
function frontend_url(path) { function urljoin(url, path = null) {
if (null !== path && path !== "") return new URL(path, import.meta.env.VITE_FRONTEND_URL).href; if (undefined === url || null === url) return;
else return new URL(import.meta.env.VITE_FRONTEND_URL).href;
if (url[url.length - 1] != "/") url += "/";
if (null === path || "" === path) return url;
if (path[0] === "/") return url + path.slice(1);
return url + path;
} }
function time_from_ts(ts) { function time_from_ts(ts) {
return new Date(ts * 1000).toLocaleTimeString(); if (ts === 0 || ts === undefined) return;
let ts_date = new Date(ts * 1000);
let ts_zone = ts_date.toString().match(/([A-Z]+[\+-][0-9]+)/)[1];
return (
new Intl.DateTimeFormat(locale_from_browser(), {
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
}).format(ts_date) + ` (${ts_zone})`
);
} }
export { api_url, frontend_url, click, color, time_from_ts }; function date_from_ts(ts) {
if (ts === 0 || ts === undefined) return;
return new Intl.DateTimeFormat(locale_from_browser(), {
month: "2-digit",
year: "2-digit",
day: "2-digit",
}).format(new Date(ts * 1000));
}
export { color, click, urljoin, time_from_ts, date_from_ts };

View File

@ -2,7 +2,6 @@
"navbar": { "navbar": {
"home": "home", "home": "home",
"services": "services", "services": "services",
"news": "news",
"donate": "donate" "donate": "donate"
}, },
"home": { "home": {
@ -10,7 +9,7 @@
"welcome": { "welcome": {
"title": "about", "title": "about",
"desc": "Welcome to my website, I'm ngn", "desc": "Welcome to my website, I'm ngn",
"whoami": "I'm a privacy, security and freedom addvocate high-schooler from Turkey", "whoami": "I'm a security, privacy and freedom advocate high-schooler from Turkey",
"interest": "I'm interested in system security and software development", "interest": "I'm interested in system security and software development",
"support": "I love and support Free/Libre and Open Source Software (FLOSS)" "support": "I love and support Free/Libre and Open Source Software (FLOSS)"
}, },
@ -18,6 +17,7 @@
"title": "work", "title": "work",
"desc": "I don't currently have a job, so I spend most of my time...", "desc": "I don't currently have a job, so I spend most of my time...",
"build": "building stupid shit", "build": "building stupid shit",
"fix": "fixing stupid shit",
"ctf": "solving CTF challenges", "ctf": "solving CTF challenges",
"contribute": "contributing to random projects", "contribute": "contributing to random projects",
"wiki": "expanding my wiki" "wiki": "expanding my wiki"
@ -25,25 +25,55 @@
"links": { "links": {
"title": "contact", "title": "contact",
"desc": "Here are some useful links if you want to get in contact with me", "desc": "Here are some useful links if you want to get in contact with me",
"prefer": "preferred" "prefer": "I highly prefer email, you can send encrypted emails using my PGP key"
}, },
"info": { "services": {
"title": "services", "title": "services",
"desc": "A part from working on stupid shit, I host free (as in freedom, and price) services available for all", "desc": "A part from working on stupid shit, I host free (as in freedom and price) services available for all",
"speed": "All of these services are available over a 600 Mbit/s interface", "speed": "All of these services are available over an 1 Gbit interface",
"security": "All use SSL encrypted connection and they are all privacy-respecting", "security": "All use SSL encrypted connection and they respect your privacy and freedom",
"privacy": "Accessible from clearnet, TOR and I2P, no region or network blocks", "privacy": "Accessible from clearnet, TOR and I2P, no region or network blocks",
"bullshit": "No CDNs, no cloudflare, no CAPTCHA, no analytics, no bullshit", "bullshit": "No CDNs, no cloudflare, no CAPTCHA, no analytics, no bullshit",
"link": "see all the services" "link": "See all the services!"
},
"projects": {
"title": "projects",
"desc": "I mostly work on free software projects, here are some of projects that you might find interesting"
} }
}, },
"services": {
"title": "service status",
"none": "No services found",
"search": "Search for a service",
"feed": "News and updates",
"last": "Last checked at {time}",
"status": {
"up": "Up",
"down": "Down",
"slow": "Slow"
}
},
"donate": {
"title": "donate!",
"info": "I spend a lot of time and money on different projects and maintaining different services.",
"price": "I mostly pay for hosting and electricity. Which when added up costs around 550₺ per month (~$15 at the time of writing).",
"details": "So even a small donation would be useful. And it would help me keep everything up and running.",
"thanks": "Also huge thanks to all of you who have donated so far!",
"table": {
"platform": "Platform",
"address": "Adress/Link"
}
},
"error": {
"title": "something went wrong!",
"report": "Report this issue"
},
"footer": { "footer": {
"source": "Source", "source": "Source",
"license": "License", "license": "License",
"privacy": "Privacy", "privacy": "Privacy",
"powered": "Powered by Svelte, Go, SQLite and donations", "number": "Visited {total} times since {since}",
"number": "You are the visitor number {count}", "wow": "wow!!",
"congrat": "congrats!!", "js": "Enable javascript to display all the elements"
"version": "Using API version {api_version}, frontend version {frontend_version}"
} }
} }

View File

@ -1,19 +1,21 @@
{ {
"navbar": { "navbar": {
"home": "anasayfa", "home": "anasayfa",
"news": "haberler",
"services": "servisler", "services": "servisler",
"language": "dil" "donate": "bağış"
}, },
"home": { "home": {
"title": "merhaba dünya!",
"welcome": { "welcome": {
"title": "Websiteme hoşgeldiniz, ben ngn", "title": "hakkımda",
"desc": "Websiteme hoşgeldiniz, ben ngn",
"whoami": "Türkiye'den, güvenlik, gizlik ve özgürlük savunucusu bir liseliyim", "whoami": "Türkiye'den, güvenlik, gizlik ve özgürlük savunucusu bir liseliyim",
"interest": "Sistem güvenliği ve yazılım geliştirmek ile ilgileniyorum", "interest": "Sistem güvenliği ve yazılım geliştirmek ile ilgileniyorum",
"support": "Özgür/Libre ve Açık Kaynaklı Yazılımı (FLOSS) seviyorum ve destekliyorum" "support": "Özgür/Libre ve Açık Kaynaklı Yazılımı (FLOSS) seviyorum ve destekliyorum"
}, },
"work": { "work": {
"title": "Zamanım çoğunlukla şunlar ile geçiyor...", "title": "",
"desc": "Şuan bir işim yok, o yüzden zamanımın çoğunu şunlarla geçiriyorum:",
"build": "salak şeyler inşa etmek", "build": "salak şeyler inşa etmek",
"fix": "salak şeyleri düzeltmek", "fix": "salak şeyleri düzeltmek",
"ctf": "CTF challenge'ları çözmek", "ctf": "CTF challenge'ları çözmek",
@ -21,26 +23,57 @@
"wiki": "wikimi genişletmek" "wiki": "wikimi genişletmek"
}, },
"links": { "links": {
"title": "Eğer benim ile iletişime geçmek istiyorsanız, işte bazı faydalı linkler", "title": "iletişim",
"prefer": "tercihim" "desc": "Eğer benim ile iletişime geçmek istiyorsanız, işte bazı faydalı linkler",
"prefer": "Email'i fazlasıyla tercih ediyorum, PGP anahtarım ile şifreli email'ler gönderebilirsiniz"
}, },
"info": { "services": {
"title": "Salak şeyler inşa etmenin yanı sıra, herkes için kullanıma açık özgür ve ücretsiz servisler host ediyorum", "title": "servisler",
"speed": "Tüm servisler 600 Mbit/s ağ arayüzü üzerinden erişilebilir", "desc": "Salak şeyler inşa etmenin yanı sıra, herkes için kullanıma açık özgür ve ücretsiz servisler host ediyorum",
"security": "Hepsi SSL şifreli bağlantı kullanıyor ve hepsi gizliğinize saygı gösteriyor", "speed": "Tüm servisler 1 Gbit ağ arayüzü üzerinden erişilebilir",
"privacy": "Accessible from clearnet, TOR and I2P, no region or network blocks", "security": "Hepsi SSL şifreli bağlantı kullanıyor ve hepsi gizliliğinize ve özgürlüğünüze saygı gösteriyor",
"privacy": "Açık ağdan, TOR ve I2P'den erişilebilirler, bölge ya da ağ blokları yok", "privacy": "Açık ağdan, TOR ve I2P'den erişilebilirler, bölge ya da ağ blokları yok",
"bullshit": "CDN yok, cloudflare yok, CAPTCHA yok, analitikler yok, boktan saçmalıklar yok", "bullshit": "CDN yok, cloudflare yok, CAPTCHA yok, analitikler ve diğer saçmalıklar yok",
"link": "tüm servisleri incele" "link": "Tüm servisleri incele!"
},
"projects": {
"title": "projeler",
"desc": "Çoğunlukla özgür yazılım projeleri üzerinde çalışıyorum, işte ilginç bulabileceğiniz bazı projelerim"
} }
}, },
"services": {
"title": "servis durumu",
"none": "Servis bulunamadı",
"search": "Bir servisi ara",
"feed": "Yenilikler ve güncellemeler",
"last": "Son kontrol zamanı {time}",
"status": {
"up": "Çalışıyor",
"down": "Kapalı",
"slow": "Yavaş"
}
},
"donate": {
"title": "bağış yap!",
"info": "Farklı projeler ve farklı servisleri yönetmek için oldukça zaman ve para harcıyorum.",
"price": "Çoğunlukla hosting ve elektrik için ödeme yapıyorum. Bunlar eklendiği zaman aylık 550₺ civarı bir miktar oluyor (yazdığım sırada ~15$).",
"details": "Bu sebepten küçük bir bağış bile oldukça faydalı olacaktır. Ve herşeyi açık ve çalışmakta tutmama yardımcı olacaktır.",
"thanks": "Ayrıca şuana kadar bağışta bulunan herkese çok teşekkür ederim!",
"table": {
"platform": "Platform",
"address": "Adres/Bağlantı"
}
},
"error": {
"title": "birşeyler yanlış gitti!",
"report": "Bu sorunu raporlayın"
},
"footer": { "footer": {
"source": "Kaynak", "source": "Kaynak",
"license": "Lisans", "license": "Lisans",
"privacy": "Gizlilik", "privacy": "Gizlilik",
"powered": "Svelte, Go, SQLite ve yemek param tarafından destekleniyor", "number": "{since} tarihinden beri {total} kez ziyaret edildi",
"number": "{count}. ziyaretçisiniz", "wow": "vay be!!",
"congrat": "tebrikler!!", "js": "Tüm elementleri görüntelemek için javascript'i açın"
"version": "Kullan API versiyonu {api_version}, arayüz versiyonu {frontend_version}"
} }
} }

View File

@ -1,19 +1,6 @@
import { locale, waitLocale } from "svelte-i18n"; import { locale_setup, locale_wait } from "$lib/locale.js";
import { init, register } from "svelte-i18n";
import { browser } from "$app/environment";
import languages from "$lib/lang.js";
const defaultLocale = languages[0].code; export async function load() {
locale_setup();
for (let i = 0; i < languages.length; i++) await locale_wait();
register(languages[i].code, () => import(/* @vite-ignore */ languages[i].path)); }
init({
fallbackLocale: defaultLocale,
initialLocale: browser ? window.navigator.language.slice(0, 2).toLowerCase() : defaultLocale,
});
export const load = async () => {
if (browser) locale.set(window.navigator.language);
await waitLocale();
};

View File

@ -1,18 +1,27 @@
<script> <script>
import Navbar from "$lib/navbar.svelte"; import Navbar from "$lib/navbar.svelte";
import Footer from "$lib/footer.svelte"; import Footer from "$lib/footer.svelte";
import { locale_select } from "$lib/locale.js";
import { onMount } from "svelte";
let { children } = $props();
onMount(() => {
locale_select();
});
</script> </script>
<main> <main>
<Navbar /> <Navbar />
<div class="content"> <div class="content">
<slot></slot> {@render children()}
</div> </div>
<Footer /> <Footer />
</main> </main>
<style> <style>
@import "../../static/global.css"; @import "/css/global.css";
main { main {
display: flex; display: flex;

15
app/src/routes/+page.js Normal file
View File

@ -0,0 +1,15 @@
import { api_get_projects } from "$lib/api.js";
export async function load({ fetch }) {
try {
let projects = await api_get_projects(fetch);
return {
projects: null === projects ? [] : projects,
error: "",
};
} catch (err) {
return {
error: err.toString(),
};
}
}

View File

@ -1,101 +1,133 @@
<script> <script>
import { api_version } from "$lib/api.js";
import Header from "$lib/header.svelte"; import Header from "$lib/header.svelte";
import Content from "$lib/content.svelte"; import Error from "$lib/error.svelte";
import Head from "$lib/head.svelte"; import Head from "$lib/head.svelte";
import Card from "$lib/card.svelte"; import Card from "$lib/card.svelte";
import Link from "$lib/link.svelte"; import Link from "$lib/link.svelte";
import { browser } from "$app/environment";
import { _, locale } from "svelte-i18n";
import { color } from "$lib/util.js"; import { color } from "$lib/util.js";
import { _ } from "svelte-i18n";
let { data } = $props();
if (browser) {
window._version = {};
window._version.app = pkg.version;
window._version.api = api_version;
}
</script> </script>
<Head title="home" desc="home page of my personal website" /> <Head title="home" desc="home page of my personal website" />
<Header title={$_("home.title")} picture="tired" /> <Header picture="tired" title={$_("home.title")} />
<Content> {#if data.error.length !== 0}
<Card title={$_("home.welcome.title")}> <Error error={data.error} />
<span> 👋 {$_("home.welcome.desc")}</span> {:else}
<ul> <main>
<li>🇹🇷 {$_("home.welcome.whoami")}</li> <Card title={$_("home.welcome.title")}>
<li>🖥️ {$_("home.welcome.interest")}</li> <span> 👋 {$_("home.welcome.desc")}</span>
<li>❤️ {$_("home.welcome.support")}</li> <ul>
</ul> <li>🇹🇷 {$_("home.welcome.whoami")}</li>
</Card> <li>🖥️ {$_("home.welcome.interest")}</li>
<Card title={$_("home.work.title")}> <li>❤️ {$_("home.welcome.support")}</li>
<span>{$_("home.work.desc")}</span> </ul>
<ul> </Card>
<li>⌨️ {$_("home.work.build")}</li> <Card title={$_("home.work.title")}>
<li>🚩 {$_("home.work.ctf")}</li> <span>{$_("home.work.desc")}</span>
<li>👥 {$_("home.work.contribute")}</li> <ul>
<li>📑 {$_("home.work.wiki")}</li> <li>⌨️ {$_("home.work.build")}</li>
</ul> <li>🤦 {$_("home.work.fix")}</li>
</Card> <li>🚩 {$_("home.work.ctf")}</li>
<Card title={$_("home.links.title")}> <li>👥 {$_("home.work.contribute")}</li>
<span>{$_("home.links.desc")}:</span> <li>📑 {$_("home.work.wiki")}</li>
<ul> </ul>
<li> </Card>
<Link icon="nf-fa-key" link="https://keyoxide.org/F9E70878C2FB389AEC2BA34CA3654DF5AD9F641D"> <Card title={$_("home.links.title")}>
PGP <span>{$_("home.links.desc")}:</span>
</Link> <ul>
</li> <li>
<li> <Link
<Link icon="nf-md-mastodon" link="https://defcon.social/@ngn">Mastodon</Link> icon="nf-fa-key"
</li> link="https://keyoxide.org/F9E70878C2FB389AEC2BA34CA3654DF5AD9F641D"
<li> >
<Link icon="nf-cod-github" link="https://github.com/ngn13">Github</Link> PGP
</li> </Link>
<li> </li>
<Link icon="nf-md-email" link="mailto:ngn@ngn.tf">Email</Link> <li>
<span class="prefer">({$_("home.links.prefer")})</span> <Link icon="nf-md-email" link="mailto:ngn@ngn.tf">Email</Link>
</li> </li>
</ul> <li>
</Card> <Link icon="nf-md-mastodon" link="https://defcon.social/@ngn"
<Card title={$_("home.info.title")}> >Mastodon</Link
<div class="services"> >
<div class="info"> </li>
<span> </ul>
{$_("home.info.desc")} <span>
</span> {$_("home.links.prefer")}
</span>
</Card>
<Card title={$_("home.services.title")}>
<span>
{$_("home.services.desc")}:
</span>
<ul>
<li>
<i style="color: var(--{color()});" class="nf nf-md-speedometer_slow"
></i>
{$_("home.services.speed")}
</li>
<li>
<i style="color: var(--{color()});" class="nf nf-fa-lock"></i>
{$_("home.services.security")}
</li>
<li>
<i style="color: var(--{color()});" class="nf nf-fa-network_wired"
></i>
{$_("home.services.privacy")}
</li>
<li>
<i style="color: var(--{color()});" class="nf nf-md-eye_off"></i>
{$_("home.services.bullshit")}
</li>
</ul>
<Link link="/services">{$_("home.services.link")}</Link>
</Card>
<Card title={$_("home.projects.title")}>
<span>
{$_("home.projects.desc")}:
</span>
{#if data.error.length === 0}
<ul> <ul>
<li> {#each data.projects.filter((p) => {
<i style="color: var(--{color()});" class="nf nf-md-speedometer_slow"></i> return p.desc[$locale] !== "" && p.desc[$locale] !== null && p.desc[$locale] !== undefined;
{$_("home.info.speed")} }) as project}
</li> <li>
<li> <Link active={true} link={project.url}>{project.name}</Link>:
<i style="color: var(--{color()});" class="nf nf-fa-lock"></i> {project.desc[$locale]}
{$_("home.info.security")} </li>
</li> {/each}
<li>
<i style="color: var(--{color()});" class="nf nf-fa-network_wired"></i>
{$_("home.info.privacy")}
</li>
<li>
<i style="color: var(--{color()});" class="nf nf-md-eye_off"></i>
{$_("home.info.bullshit")}
</li>
</ul> </ul>
</div> {/if}
</div> </Card>
</Card> </main>
</Content> {/if}
<style> <style>
.prefer { main {
color: var(--white-2);
font-style: italic;
}
.services {
display: flex; display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: center;
align-items: stretch;
padding: 50px;
gap: 28px; gap: 28px;
} }
.services .info { @media only screen and (max-width: 900px) {
display: flex; main {
flex-direction: column; flex-direction: column;
}
} }
</style> </style>

View File

@ -0,0 +1,12 @@
import { doc_get } from "$lib/doc";
export async function load({ fetch, params }) {
try {
return {
doc: await doc_get(fetch, params.name),
error: "",
};
} catch (err) {
return { error: err.toString() };
}
}

View File

@ -0,0 +1,50 @@
<script>
import Header from "$lib/header.svelte";
import Error from "$lib/error.svelte";
import Head from "$lib/head.svelte";
import { locale, _ } from "svelte-i18n";
import { goto } from "$app/navigation";
import { color } from "$lib/util.js";
import DOMPurify from "dompurify";
import { onMount } from "svelte";
import { marked } from "marked";
let { data } = $props();
marked.use({ breaks: true });
onMount(async () => {
for (let key in data.doc)
data.doc[key]["content"] = DOMPurify.sanitize(data.doc[key]["content"]);
if (undefined !== data.error && data.error.includes("not found")) goto("/");
});
</script>
<Head title="documentation" desc="website and API documentation" />
<Header picture="reader" title={data.doc[$locale].title} />
{#if data.error.length !== 0}
{#if !data.error.includes("not found")}
<Error error={data.error} />
{/if}
{:else}
<main>
<div class="markdown-body" style="--link-color: var(--{color()})">
{@html marked.parse(data.doc[$locale].content)}
</div>
</main>
{/if}
<style>
@import "/css/markdown.css";
main {
padding: 50px;
gap: 30px;
}
main .markdown-body :global(a) {
color: var(--link-color);
}
</style>

View File

@ -1,39 +1,39 @@
<script> <script>
import Header from "$lib/header.svelte"; import Header from "$lib/header.svelte";
import Head from "$lib/head.svelte"; import Head from "$lib/head.svelte";
import Icon from "$lib/icon.svelte";
import { color } from "$lib/util.js"; import { color } from "$lib/util.js";
import { _ } from "svelte-i18n";
</script> </script>
<Head title="donate" desc="give me all of your life savings" /> <Head title="donate" desc="give me all of your life savings" />
<Header title="donate money!" picture="money" /> <Header picture="money" title={$_("donate.title")} />
<main> <main>
<span <span> </span>
>I spend a lot of time working on different projects and maintaining different services.</span <span>
> {$_("donate.info")}
<span {$_("donate.price")}
>I also spend a lot of money, but unlike time, you don't usually get much of it for free.</span </span>
>
<span
>I mostly pay for hosting and electricity. Which when added up costs around 550₺ per month, that
is Turkish Lira, equals to ~$15 at time of writing.</span
>
<br /> <br />
<br /> <br />
<span <span>
>So even a small donation would be highly appreciated and it would help me keep everything up {$_("donate.details")}
and running.</span </span>
>
<table> <table>
<thead> <thead>
<tr> <tr>
<th style="color: var(--{color()})">Platform</th> <th style="color: var(--{color()})">{$_("donate.table.platform")}</th>
<th style="color: var(--{color()})">Address/Link</th> <th style="color: var(--{color()})">{$_("donate.table.address")}</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
<tr> <tr>
<td>Monero (XMR)</td> <td>
<Icon icon="nf-fa-monero" />
Monero (XMR)
</td>
<td> <td>
<code> <code>
46q7G7u7cmASvJm7AmrhmNg6ctS77mYMmDAy1QxpDn5w57xV3GUY5za4ZPZHAjqaXdfS5YRWm4AVj5UArLDA1retRkJp47F 46q7G7u7cmASvJm7AmrhmNg6ctS77mYMmDAy1QxpDn5w57xV3GUY5za4ZPZHAjqaXdfS5YRWm4AVj5UArLDA1retRkJp47F
@ -42,10 +42,9 @@
</tr> </tr>
</tbody> </tbody>
</table> </table>
<span <span>
>Also huge thanks to all of you who has donated so far, as I said, I highly appreciate it. Thank {$_("donate.thanks")}
you!</span </span>
>
</main> </main>
<style> <style>
@ -77,6 +76,7 @@
td, td,
th { th {
font-size: var(--size-4);
border: solid 1px var(--black-4); border: solid 1px var(--black-4);
padding: 16px; padding: 16px;
} }

View File

@ -1,7 +1,15 @@
import { services } from "$lib/api.js"; import { api_get_services } from "$lib/api.js";
export async function load({ fetch }) { export async function load({ fetch }) {
return { try {
list: await services(fetch), let services = await api_get_services(fetch);
}; return {
services: null === services ? [] : services,
error: "",
};
} catch (err) {
return {
error: err.toString(),
};
}
} }

View File

@ -1,49 +1,80 @@
<script> <script>
import Service from "$lib/service.svelte"; import Service from "$lib/service.svelte";
import Header from "$lib/header.svelte"; import Header from "$lib/header.svelte";
import Error from "$lib/error.svelte";
import Link from "$lib/link.svelte"; import Link from "$lib/link.svelte";
import Head from "$lib/head.svelte"; import Head from "$lib/head.svelte";
import { api_url } from "$lib/util.js"; import { api_urljoin } from "$lib/api.js";
import { locale } from "svelte-i18n"; import { locale, _ } from "svelte-i18n";
import { onMount } from "svelte";
export let data; let { data } = $props();
let services = $state(data.services);
let list = data.list, let show_input = $state(false);
services = list;
let value = "";
function change(input) { function change(input) {
value = input.target.value.toLowerCase(); let value = input.target.value.toLowerCase();
services = []; services = [];
if (value === "") { if (value === "") {
services = list; services = data.services;
return; return;
} }
list.forEach((s) => { data.services.forEach((s) => {
if (s.name.toLowerCase().includes(value)) services.push(s); if (s.name.toLowerCase().includes(value)) services.push(s);
else if (s.desc[$locale].toLowerCase().includes(value)) services.push(s);
}); });
} }
function get_services() {
return services.filter((s) => {
return (
s.desc[$locale] !== "" &&
s.desc[$locale] !== null &&
s.desc[$locale] !== undefined
);
});
}
onMount(() => {
show_input = true;
});
</script> </script>
<Head title="services" desc="my self-hosted services and projects" /> <Head title="services" desc="my self-hosted services and projects" />
<Header title="service status" picture="cool" /> <Header picture="cool" title={$_("services.title")} />
<main> {#if data.error.length !== 0}
<div class="title"> <Error error={data.error} />
<input on:input={change} type="text" placeholder="Search for a service" /> {:else}
<div> <main>
<Link icon="nf-fa-feed" link={api_url("/news/" + $locale.slice(0, 2))}>News and updates</Link> <div class="title">
{#if show_input}
<input
oninput={change}
type="text"
placeholder={$_("services.search")}
/>
{/if}
<div>
<Link icon="nf-fa-feed" link={api_urljoin("/news/" + $locale)}
>{$_("services.feed")}</Link
>
</div>
</div> </div>
</div> <div class="services">
<div class="services"> {#if get_services().length == 0}
{#each services as service} <h3 class="none">{$_("services.none")}</h3>
<Service {service} /> {:else}
{/each} {#each get_services() as service}
</div> <Service {service} />
</main> {/each}
{/if}
</div>
</main>
{/if}
<style> <style>
main { main {
@ -58,12 +89,16 @@
align-items: center; align-items: center;
} }
main .none {
color: var(--white-3);
}
main .services { main .services {
margin-top: 20px;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: center; justify-content: center;
align-items: stretch; align-items: stretch;
margin-top: 20px;
gap: 28px; gap: 28px;
} }

View File

@ -1,85 +0,0 @@
@keyframes blink {
0% {
opacity: 0;
}
}
@keyframes colorAnimation {
100%,
0% {
color: rgb(255, 0, 0);
}
8% {
color: rgb(255, 127, 0);
}
16% {
color: rgb(255, 255, 0);
}
25% {
color: rgb(127, 255, 0);
}
33% {
color: rgb(0, 255, 0);
}
41% {
color: rgb(0, 255, 127);
}
50% {
color: rgb(0, 255, 255);
}
58% {
color: rgb(0, 127, 255);
}
66% {
color: rgb(0, 0, 255);
}
75% {
color: rgb(127, 0, 255);
}
83% {
color: rgb(255, 0, 255);
}
91% {
color: rgb(255, 0, 127);
}
}
@keyframes borderAnimation {
100%,
0% {
border-bottom-color: rgb(255, 0, 0);
}
8% {
border-bottom-color: rgb(255, 127, 0);
}
16% {
border-bottom-color: rgb(255, 255, 0);
}
25% {
border-bottom-color: rgb(127, 255, 0);
}
33% {
border-bottom-color: rgb(0, 255, 0);
}
41% {
border-bottom-color: rgb(0, 255, 127);
}
50% {
border-bottom-color: rgb(0, 255, 255);
}
58% {
border-bottom-color: rgb(0, 127, 255);
}
66% {
border-bottom-color: rgb(0, 0, 255);
}
75% {
border-bottom-color: rgb(127, 0, 255);
}
83% {
border-bottom-color: rgb(255, 0, 255);
}
91% {
border-bottom-color: rgb(255, 0, 127);
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

View File

@ -0,0 +1,11 @@
@keyframes blink {
0% {
opacity: 0;
}
}
@keyframes cursor {
to {
border-color: transparent;
}
}

7
app/static/css/font.css Normal file
View File

@ -0,0 +1,7 @@
@font-face {
font-family: "Ubuntu";
font-style: normal;
font-weight: 300;
font-display: swap;
src: url("/assets/ubuntu.woff2") format("woff2");
}

View File

@ -1,4 +1,12 @@
/*
* animations.css: stuff like the cursor animation
* webfont.css: webfont dumped from https://www.nerdfonts.com/assets/css/webfont.css
* font.css: the main font (Ubuntu)
*/
@import "./animations.css"; @import "./animations.css";
@import "./nerdfonts.css";
@import "./font.css"; @import "./font.css";
:root { :root {
@ -25,10 +33,18 @@
--size-4: 20px; --size-4: 20px;
--size-5: 24px; --size-5: 24px;
--size-6: 30px; --size-6: 30px;
--size-7: 50px;
--text-shadow: 0px 5px 20px rgba(90, 90, 90, 0.8); --box-shadow-1:
--box-shadow: rgba(20, 20, 20, 0.19) 0px 10px 20px, rgba(30, 30, 30, 0.23) 0px 6px 6px; rgba(20, 20, 20, 0.19) 0px 10px 20px, rgba(30, 30, 30, 0.23) 0px 6px 6px;
--box-shadow-2:
rgba(0, 0, 0, 0.35) 0px 30px 60px -12px inset,
rgba(20, 20, 20, 0.3) 0px 18px 36px -18px inset;
--text-shadow: 3px 2px 8px rgba(50, 50, 50, 0.8);
--background:
linear-gradient(rgba(11, 11, 11, 0.808), rgba(1, 1, 1, 0.96)),
url("/assets/banner.png");
--profile-size: 220px;
} }
* { * {
@ -36,6 +52,10 @@
margin: 0; margin: 0;
} }
html {
box-sizing: border-box;
}
body { body {
background: var(--black-1); background: var(--black-1);
font-family: "Ubuntu", sans-serif; font-family: "Ubuntu", sans-serif;

View File

@ -5,8 +5,9 @@
margin: 0; margin: 0;
color: #c9d1d9; color: #c9d1d9;
background-color: #000; background-color: #000;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, font-family:
sans-serif, "Apple Color Emoji", "Segoe UI Emoji"; -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica,
Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
font-size: 16px; font-size: 16px;
line-height: 1.5; line-height: 1.5;
word-wrap: break-word; word-wrap: break-word;
@ -61,11 +62,6 @@
} }
.markdown-body a { .markdown-body a {
animation-name: colorAnimation;
animation-iteration-count: infinite;
animation-duration: 10s;
background-color: transparent;
color: #58a6ff;
text-decoration: none; text-decoration: none;
} }
@ -725,7 +721,7 @@
margin: 0; margin: 0;
font-size: 85%; font-size: 85%;
white-space: break-spaces; white-space: break-spaces;
background: var(--dark-two); background: var(--black-3);
border-radius: 6px; border-radius: 6px;
} }
@ -770,8 +766,7 @@
overflow: auto; overflow: auto;
font-size: 85%; font-size: 85%;
line-height: 1.45; line-height: 1.45;
background-color: var(--dark-two); background-color: var(--black-3);
border-radius: 6px;
} }
.markdown-body pre code, .markdown-body pre code,
@ -1032,7 +1027,9 @@
} }
.markdown-body .contains-task-list:hover .task-list-item-convert-container, .markdown-body .contains-task-list:hover .task-list-item-convert-container,
.markdown-body .contains-task-list:focus-within .task-list-item-convert-container { .markdown-body
.contains-task-list:focus-within
.task-list-item-convert-container {
display: block; display: block;
width: auto; width: auto;
height: 24px; height: 24px;

View File

@ -1,10 +0,0 @@
/* im using nerd fonts btw */
@import "https://www.nerdfonts.com/assets/css/webfont.css";
@font-face {
font-family: "Ubuntu";
font-style: normal;
font-weight: 300;
font-display: swap;
src: url("/ubuntu.woff2") format("woff2");
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

BIN
app/static/profile/sad.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 22 KiB

3
app/static/robots.txt Normal file
View File

@ -0,0 +1,3 @@
User-Agent: *
Disallow: /doc/
Disallow: /api/

View File

@ -3,13 +3,51 @@ import { defineConfig } from "vite";
import { fileURLToPath } from "url"; import { fileURLToPath } from "url";
import { readFileSync } from "fs"; import { readFileSync } from "fs";
const file = fileURLToPath(new URL("package.json", import.meta.url)); function env_from(prefix, object) {
const json = readFileSync(file, "utf8"); for (const [key, value] of Object.entries(object)) {
const pkg = JSON.parse(json); let type = typeof value;
let name = prefix + "_" + key.toUpperCase();
switch (type) {
case "object":
env_from(name, value);
break;
case "string":
if (process.env[name] === undefined) process.env[name] = value;
break;
}
}
}
const default_env = {
source_url: "https://git.ngn.tf/ngn/website",
report_url: "https://git.ngn.tf/ngn/website/issues",
doc_url: "http://localhost:7003",
api: {
url: "http://localhost:7002",
path: "http://localhost:7002",
},
};
const package_file = fileURLToPath(new URL("package.json", import.meta.url));
const package_json = readFileSync(package_file, "utf8");
const package_data = JSON.parse(package_json);
env_from("WEBSITE", default_env);
export default defineConfig({ export default defineConfig({
plugins: [sveltekit()], plugins: [sveltekit()],
envPrefix: "WEBSITE",
preview: {
port: 7001,
strictPort: true,
},
server: {
port: 7001,
strictPort: true,
},
define: { define: {
pkg: pkg, pkg: package_data,
}, },
}); });

62
deploy/compose.yml Normal file
View File

@ -0,0 +1,62 @@
services:
app:
container_name: "website_app"
image: website_app
build:
context: ./app
args:
WEBSITE_SOURCE_URL: "http://github.com/ngn13/website"
WEBSITE_REPORT_URL: "http://github.com/ngn13/website/issues"
WEBSITE_DOC_URL: "http://doc:7003"
WEBSITE_API_URL: "http://api:7002"
WEBSITE_API_PATH: "http://localhost:7002"
security_opt:
- "no-new-privileges:true"
cap_drop:
- ALL
ports:
- "127.0.0.1:7001:7001"
depends_on:
- api
- doc
read_only: true
restart: unless-stopped
api:
container_name: "website_api"
image: website_api
build:
context: ./api
security_opt:
- "no-new-privileges:true"
cap_drop:
- ALL
ports:
- "127.0.0.1:7002:7002"
volumes:
- ./data.db:/api/data.db:rw
environment:
WEBSITE_DEBUG: "false"
WEBSITE_APP_URL: "http://localhost:7001"
WEBSITE_PASSWORD: "change_me"
WEBSITE_HOST: "0.0.0.0:7002"
WEBSITE_IP_HEADER: "X-Real-IP"
WEBSITE_INTERVAL: "1h"
WEBSITE_TIMEOUT: "15s"
WEBSITE_LIMIT: "5s"
restart: unless-stopped
doc:
container_name: "website_doc"
image: website_doc
build:
context: ./doc
security_opt:
- "no-new-privileges:true"
cap_drop:
- ALL
environment:
WEBSITE_HOST: "0.0.0.0:7003"
WEBSITE_DOCS_DIR: "./docs"
read_only: true
restart: unless-stopped

9
deploy/run.sh Normal file
View File

@ -0,0 +1,9 @@
#!/bin/bash
if [ ! -f data.db ]; then
touch data.db
sudo chmod 1001:1001 data.db
fi
docker-compose build
docker-compose up -d

225
doc/.clang-format Normal file
View File

@ -0,0 +1,225 @@
---
Language: Cpp
# BasedOnStyle: LLVM
AccessModifierOffset: -2
AlignAfterOpenBracket: DontAlign
AlignArrayOfStructures: Left
AlignConsecutiveAssignments:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: true
AlignConsecutiveBitFields:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveDeclarations:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignConsecutiveMacros:
Enabled: true
AcrossEmptyLines: false
AcrossComments: false
AlignCompound: false
PadOperators: false
AlignEscapedNewlines: Right
AlignOperands: Align
AlignTrailingComments:
Kind: Always
OverEmptyLines: 0
AllowAllArgumentsOnNextLine: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: Never
AllowShortCaseLabelsOnASingleLine: false
AllowShortEnumsOnASingleLine: true
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLambdasOnASingleLine: All
AllowShortLoopsOnASingleLine: false
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: false
AlwaysBreakTemplateDeclarations: MultiLine
AttributeMacros:
- __capability
BinPackArguments: false
BinPackParameters: true
BitFieldColonSpacing: Both
BraceWrapping:
AfterCaseLabel: false
AfterClass: false
AfterControlStatement: Never
AfterEnum: false
AfterExternBlock: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
BeforeLambdaBody: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
SplitEmptyRecord: true
SplitEmptyNamespace: true
BreakAfterAttributes: Never
BreakAfterJavaFieldAnnotations: false
BreakArrays: true
BreakBeforeBinaryOperators: None
BreakBeforeConceptDeclarations: Always
BreakBeforeBraces: Attach
BreakBeforeInlineASMColon: OnlyMultiline
BreakBeforeTernaryOperators: true
BreakConstructorInitializers: BeforeColon
BreakInheritanceList: BeforeColon
BreakStringLiterals: true
ColumnLimit: 80
CommentPragmas: '^ IWYU pragma:'
CompactNamespaces: false
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: false
DisableFormat: false
EmptyLineAfterAccessModifier: Never
EmptyLineBeforeAccessModifier: LogicalBlock
ExperimentalAutoDetectBinPacking: false
FixNamespaceComments: true
ForEachMacros:
- foreach
- Q_FOREACH
- BOOST_FOREACH
IfMacros:
- KJ_IF_MAYBE
IncludeBlocks: Preserve
IncludeCategories:
- Regex: '^"(llvm|llvm-c|clang|clang-c)/'
Priority: 2
SortPriority: 0
CaseSensitive: false
- Regex: '^(<|"(gtest|gmock|isl|json)/)'
Priority: 3
SortPriority: 0
CaseSensitive: false
- Regex: '.*'
Priority: 1
SortPriority: 0
CaseSensitive: false
IncludeIsMainRegex: '(Test)?$'
IncludeIsMainSourceRegex: ''
IndentAccessModifiers: false
IndentCaseBlocks: false
IndentCaseLabels: false
IndentExternBlock: AfterExternBlock
IndentGotoLabels: true
IndentPPDirectives: None
IndentRequiresClause: true
IndentWidth: 2
IndentWrappedFunctionNames: false
InsertBraces: false
InsertNewlineAtEOF: false
InsertTrailingCommas: None
IntegerLiteralSeparator:
Binary: 0
BinaryMinDigits: 0
Decimal: 0
DecimalMinDigits: 0
Hex: 0
HexMinDigits: 0
JavaScriptQuotes: Leave
JavaScriptWrapImports: true
KeepEmptyLinesAtTheStartOfBlocks: true
LambdaBodyIndentation: Signature
LineEnding: DeriveLF
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBinPackProtocolList: Auto
ObjCBlockIndentWidth: 2
ObjCBreakBeforeNestedBlockParam: true
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: true
PackConstructorInitializers: BinPack
PenaltyBreakAssignment: 2
PenaltyBreakBeforeFirstCallParameter: 19
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakOpenParenthesis: 0
PenaltyBreakString: 1000
PenaltyBreakTemplateDeclaration: 10
PenaltyExcessCharacter: 1000000
PenaltyIndentedWhitespace: 0
PenaltyReturnTypeOnItsOwnLine: 60
PointerAlignment: Right
PPIndentWidth: -1
QualifierAlignment: Leave
ReferenceAlignment: Pointer
ReflowComments: true
RemoveBracesLLVM: false
RemoveSemicolon: false
RequiresClausePosition: OwnLine
RequiresExpressionIndentation: OuterScope
SeparateDefinitionBlocks: Leave
ShortNamespaceLines: 1
SortIncludes: false
SortJavaStaticImport: Before
SortUsingDeclarations: LexicographicNumeric
SpaceAfterCStyleCast: false
SpaceAfterLogicalNot: false
SpaceAfterTemplateKeyword: true
SpaceAroundPointerQualifiers: Default
SpaceBeforeAssignmentOperators: true
SpaceBeforeCaseColon: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: true
SpaceBeforeInheritanceColon: true
SpaceBeforeParens: ControlStatements
SpaceBeforeParensOptions:
AfterControlStatements: true
AfterForeachMacros: true
AfterFunctionDefinitionName: false
AfterFunctionDeclarationName: false
AfterIfMacros: true
AfterOverloadedOperator: false
AfterRequiresInClause: false
AfterRequiresInExpression: false
BeforeNonEmptyParentheses: false
SpaceBeforeRangeBasedForLoopColon: true
SpaceBeforeSquareBrackets: false
SpaceInEmptyBlock: false
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 1
SpacesInAngles: Never
SpacesInConditionalStatement: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInLineCommentPrefix:
Minimum: 1
Maximum: -1
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Latest
StatementAttributeLikeMacros:
- Q_EMIT
StatementMacros:
- Q_UNUSED
- QT_REQUIRE_VERSION
TabWidth: 8
UseTab: Never
WhitespaceSensitiveMacros:
- BOOST_PP_STRINGIZE
- CF_SWIFT_NAME
- NS_SWIFT_NAME
- PP_STRINGIZE
- STRINGIZE
...

35
doc/.clang-tidy Normal file
View File

@ -0,0 +1,35 @@
---
# "gnu-zero-variadic-macro-arguments" ignored because we are using GNU99
# standart
# "clang-diagnostic-language-extension-token" is ignored because we need the
# asm() extension token
# "DeprecatedOrUnsafeBufferHandling" ignored because C11 "_s" functions are not
# secure either
Checks: >-
clang-diagnostic-*,
-clang-diagnostic-gnu-zero-variadic-macro-arguments,
-clang-diagnostic-language-extension-token,
clang-analyzer-*,
-clang-analyzer-security.insecureAPI.DeprecatedOrUnsafeBufferHandling,
portability-*,
performance-*,
WarningsAsErrors: '*'
HeaderFileExtensions:
- ''
- h
- hh
- hpp
- hxx
ImplementationFileExtensions:
- c
- cc
- cpp
- cxx
HeaderFilterRegex: '.*'
ExcludeHeaderFilterRegex: ''
FormatStyle: file
SystemHeaders: false
...

4
doc/.gitignore vendored Normal file
View File

@ -0,0 +1,4 @@
compile_commands.json
.cache
*.elf
dist

17
doc/Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM ghcr.io/ngn13/ctorm:1.8.1
WORKDIR /doc
COPY Makefile ./
COPY pages ./pages
COPY inc ./inc
COPY src ./src
RUN useradd runner -r -u 1001 -d /doc
RUN chown -R runner:runner /doc
USER runner
RUN make
EXPOSE 7003
ENTRYPOINT ["/doc/doc.elf"]

38
doc/Makefile Normal file
View File

@ -0,0 +1,38 @@
# dirs
DIRS = $(shell find src/* -type d)
DISTDIR = dist
OUTDIRS = $(patsubst src/%,$(DISTDIR)/%,$(DIRS))
# sources
HSRCS = $(wildcard inc/*.h)
CSRCS = $(shell find -type f -name '*.c')
OBJS = $(patsubst ./src/%.c,./$(DISTDIR)/%.o,$(CSRCS))
# compiler flags
CFLAGS = -O3 -fstack-protector-strong -fcf-protection=full -fstack-clash-protection
LIBS = -lctorm -lcjson
INCLUDE = -I./inc
all: doc.elf
doc.elf: $(OBJS)
echo $(OBJS) $(OUTDIRS)
gcc $(CFLAGS) -o $@ $^ $(LIBS)
$(DISTDIR)/%.o: src/%.c
@mkdir -pv $(OUTDIRS)
gcc $(CFLAGS) $(INCLUDE) -c -o $@ $^ $(LIBS)
format:
clang-format -i -style=file $(CSRCS) $(HSRCS)
lint:
clang-tidy --warnings-as-errors --config= $(CSRCS) $(HSRCS)
clean:
rm -rf $(DISTDIR)
run:
./doc.elf
.PHONY: format lint clean run

19
doc/inc/config.h Normal file
View File

@ -0,0 +1,19 @@
#pragma once
#include <stdbool.h>
#include <stdint.h>
typedef struct {
#define OPT_NAME_MAX 20
char name[20]; // option name
char *value; // option value
bool required; // is the option required (does it need to have a value)
} option_t;
typedef struct config {
option_t *options;
int32_t count;
} config_t;
bool config_load(config_t *conf);
char *config_get(config_t *conf, const char *name);

18
doc/inc/docs.h Normal file
View File

@ -0,0 +1,18 @@
#pragma once
#include <linux/limits.h>
#include <stdbool.h>
#include <dirent.h>
#include "file.h"
typedef struct {
DIR *dir;
file_t *file;
char name[NAME_MAX + 1];
char *lang;
} docs_t;
bool docs_init(docs_t *docs, char *dir);
char *docs_next(docs_t *docs, char *name, bool content);
void docs_reset(docs_t *docs);
void docs_free(docs_t *docs);

10
doc/inc/file.h Normal file
View File

@ -0,0 +1,10 @@
#pragma once
#include <stdint.h>
typedef struct {
char *content;
int64_t size;
} file_t;
file_t *file_load(int dirfd, char *path);
void file_free(file_t *file);

7
doc/inc/routes.h Normal file
View File

@ -0,0 +1,7 @@
#pragma once
#include <ctorm/ctorm.h>
void route_cors(ctorm_req_t *req, ctorm_res_t *res);
void route_list(ctorm_req_t *req, ctorm_res_t *res);
void route_get(ctorm_req_t *req, ctorm_res_t *res);
void route_notfound(ctorm_req_t *req, ctorm_res_t *res);

11
doc/inc/util.h Normal file
View File

@ -0,0 +1,11 @@
#pragma once
#include <ctorm/ctorm.h>
#include <stdbool.h>
#include <stdint.h>
#include <ctype.h>
#define util_toupper(str) \
for (char *c = str; *c != 0; c++) \
*c = toupper(*c)
uint64_t util_endswith(char *str, char *suf);
void util_send(ctorm_res_t *res, uint16_t code, cJSON *json);

4
doc/pages/api.en.json Normal file
View File

@ -0,0 +1,4 @@
{
"title": "API",
"desc": "Website's API documentation"
}

View File

@ -1,40 +1,27 @@
<!-- This is the markdown file that will be served by the index route --> My website's API, stores information about my self-hosted services, it also allows me
to publish news and updates about these services using an Atom feed and it keeps track
of visitor metrics.
<style> This documentation contains information about all the available API endpoints. All the
* { endpoints can be accessed using the `/api` route.
font-family: monospace;
}
</style>
# [{{.api.Host}}]({{.api.String}})
This is the API for my personal website, [{{.frontend.Host}}]({{.frontend.String}}).
It stores information about the self-hosted services I provide and it also allows me
to publish news and updates about these services using an Atom feed. It's written in
Go and uses SQLite for storage. Licensed under GNU GPL version 3.
**Source code and the license is available at**: [https://github.com/ngn13/website](https://github.com/ngn13/website)
**You can report issues to**: [https://github.com/ngn13/website/issues](https://github.com/ngn13/website/issues)
The rest of this document contains documentation for all the available API endpoints.
## Version 1 Endpoints ## Version 1 Endpoints
Each version 1 endpoint, can be accessed using the /v1 route. Each version 1 endpoint, can be accessed using the `/v1` route.
All the endpoints return JSON formatted data. All the endpoints return JSON formatted data.
### Errors ### Errors
If any error occurs, you will get a non-200 response. And the JSON data will have an If any error occurs, you will get a non-200 response. And the JSON data will have an
"error" key, which will contain information about the error that occured, in the `error` key, which will contain information about the error that occured, in the
string format. This is the only JSON key that will be set in non-200 responses. string format. This is the only JSON key that will be set in non-200 responses.
### Results ### Results
If no error occurs, "error" key will be set to an emtpy string (""). If the endpoint If no error occurs, `error` key will be set to an emtpy string (""). If the endpoint
returns any data, this will be stored using the "result" key. The "result" have a returns any data, this will be stored using the `result` key. The `result` have a
different expected type and a format for each endpoint. different expected type and a format for each endpoint.
### Multilang ### Multilang
Some "result" formats may use a structure called "Multilang". This is a simple JSON Some `result` formats may use a structure called "Multilang". This is a simple JSON
structure that includes one key for each supported language. The key is named after structure that includes one key for each supported language. The key is named after
the language it represents. Currently only supported languages are: the language it represents. Currently only supported languages are:
- English (`en`) - English (`en`)
@ -49,14 +36,14 @@ Here is an example multilang structure:
"tr": "Merhaba, dünya!" "tr": "Merhaba, dünya!"
} }
``` ```
If a "result" field is using a multilang structure, it will be specified as "Multilang" If a `result` field is using a multilang structure, it will be specified as "Multilang"
in the rest of the documentation. in the rest of the documentation.
### Administrator routes ### Administrator routes
The endpoints under the "/v1/admin" route, are administrator-only routes. To access The endpoints under the `/v1/admin` route, are administrator-only routes. To access
these routes you'll need to specfiy and password using the "Authorization" header. these routes you'll need to specfiy a password using the `Authorization` header. If
If the password you specify, matches with the password specified using the the password you specify, matches with the password specified using the `API_PASSWORD`
`API_PASSWORD` environment variable, you will be able to access the route. environment variable, you will be able to access the route.
### GET /v1/services ### GET /v1/services
Returns a list of available services. Each service has the following JSON format: Returns a list of available services. Each service has the following JSON format:
@ -91,12 +78,24 @@ not supported for this service/status checking is disabled (integer, UNIX timest
- `i2p`: I2P URL for the service (string, empty string if none) - `i2p`: I2P URL for the service (string, empty string if none)
You can also get information about a specific service by specifying it's name using You can also get information about a specific service by specifying it's name using
a URL query named "name". a URL query named `name`.
### GET /v1/news/:language ### GET /v1/news/:language
Returns a Atom feed of news for the given language. Supports languages that are supported Returns a Atom feed of news for the given language. Supports languages that are supported
by Multilang. by Multilang.
### GET /v1/metrics
Returns metrics about the API usage. The metric data has the following format:
```
{
"since":1736294400,
"total":8
}
```
Where:
- `since`: Metric collection start date (integer, UNIX timestamp)
- `total`: Total number of visitors (integer)
### GET /v1/admin/logs ### GET /v1/admin/logs
Returns a list of administrator logs. Each log has the following JSON format: Returns a list of administrator logs. Each log has the following JSON format:
``` ```
@ -109,18 +108,16 @@ Where:
- `action`: Action that the administrator performed (string) - `action`: Action that the administrator performed (string)
- `time`: Time when the administrator action was performed (integer, UNIX timestamp) - `time`: Time when the administrator action was performed (integer, UNIX timestamp)
Client can get the logs for only a single address, by setting the URL query "addr".
### PUT /v1/admin/service/add ### PUT /v1/admin/service/add
Creates a new service. The request body needs to contain JSON data, and it needs to Creates a new service. The request body needs to contain JSON data, and it needs to
have the JSON format used to represent a service. See "/v1/services/all" route to have the JSON format used to represent a service. See `/v1/services/all` route to
see this format. see this format.
Returns no data on success. Returns no data on success.
### DELETE /v1/admin/service/del ### DELETE /v1/admin/service/del
Deletes a service. The client needs to specify the name of the service to delete, by Deletes a service. The client needs to specify the name of the service to delete, by
setting the URL query "name". setting the URL query `name`.
Returns no data on success. Returns no data on success.
@ -156,6 +153,6 @@ Returns no data on success.
### DELETE /v1/admin/news/del ### DELETE /v1/admin/news/del
Deletes a news post. The client needs to specify the ID of the news post to delete, Deletes a news post. The client needs to specify the ID of the news post to delete,
by setting the URL query "id". by setting the URL query `id`.
Returns no data on success. Returns no data on success.

Some files were not shown because too many files have changed in this diff Show More