Compare commits

..

No commits in common. "81af56e5c7550c34e3dc26ca1328163bbc77ee6a" and "91be8274c4b42bd509600a93c81c3ee1bc351978" have entirely different histories.

4 changed files with 217 additions and 983 deletions

46
go.mod
View File

@ -5,50 +5,24 @@ go 1.24
toolchain go1.24.0
require (
gitea.seeseepuff.be/seeseemelk/mysqlite v0.15.0
gitea.seeseepuff.be/seeseemelk/mysqlite v0.7.0
github.com/donseba/go-htmx v1.12.0
github.com/gin-gonic/gin v1.10.1
github.com/playwright-community/playwright-go v0.5200.0
github.com/playwright-community/playwright-go v0.4902.0
)
require (
github.com/bytedance/sonic v1.13.3 // indirect
github.com/bytedance/sonic/loader v0.2.4 // indirect
github.com/cloudwego/base64x v0.1.5 // indirect
github.com/cloudwego/iasm v0.2.0 // indirect
github.com/deckarep/golang-set/v2 v2.8.0 // indirect
github.com/deckarep/golang-set/v2 v2.7.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/gabriel-vasile/mimetype v1.4.9 // indirect
github.com/gin-contrib/sse v1.1.0 // indirect
github.com/go-jose/go-jose/v3 v3.0.4 // indirect
github.com/go-playground/locales v0.14.1 // indirect
github.com/go-playground/universal-translator v0.18.1 // indirect
github.com/go-playground/validator/v10 v10.26.0 // indirect
github.com/go-jose/go-jose/v3 v3.0.3 // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/goccy/go-json v0.10.5 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/klauspost/cpuid/v2 v2.2.10 // indirect
github.com/leodido/go-urn v1.4.0 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/ncruces/go-strftime v0.1.9 // indirect
github.com/pelletier/go-toml/v2 v2.2.4 // indirect
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec // indirect
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
github.com/ugorji/go/codec v1.3.0 // indirect
golang.org/x/arch v0.18.0 // indirect
golang.org/x/crypto v0.39.0 // indirect
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 // indirect
golang.org/x/net v0.41.0 // indirect
golang.org/x/sys v0.33.0 // indirect
golang.org/x/text v0.26.0 // indirect
google.golang.org/protobuf v1.36.6 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
modernc.org/libc v1.65.10 // indirect
modernc.org/mathutil v1.7.1 // indirect
modernc.org/memory v1.11.0 // indirect
modernc.org/sqlite v1.38.0 // indirect
zombiezen.com/go/sqlite v1.4.2 // indirect
golang.org/x/sys v0.22.0 // indirect
modernc.org/libc v1.55.3 // indirect
modernc.org/mathutil v1.6.0 // indirect
modernc.org/memory v1.8.0 // indirect
modernc.org/sqlite v1.33.1 // indirect
zombiezen.com/go/sqlite v1.4.0 // indirect
)

85
go.sum
View File

@ -1,117 +1,51 @@
gitea.seeseepuff.be/seeseemelk/mysqlite v0.7.0 h1:gq75Ce7QTQ5Rj5fzS/6eeOA/enyV0oDMVt5mejwX14Y=
gitea.seeseepuff.be/seeseemelk/mysqlite v0.7.0/go.mod h1:cgswydOxJjMlNwfcBIXnKjr47LwXnMT9BInkiHb0tXE=
gitea.seeseepuff.be/seeseemelk/mysqlite v0.15.0 h1:+k0iBYM/aZJxz7++EKi/G9e66E9u4bPS3DFLrBeDb9Y=
gitea.seeseepuff.be/seeseemelk/mysqlite v0.15.0/go.mod h1:cgswydOxJjMlNwfcBIXnKjr47LwXnMT9BInkiHb0tXE=
github.com/bytedance/sonic v1.13.3 h1:MS8gmaH16Gtirygw7jV91pDCN33NyMrPbN7qiYhEsF0=
github.com/bytedance/sonic v1.13.3/go.mod h1:o68xyaF9u2gvVBuGHPlUVCy+ZfmNNO5ETf1+KgkJhz4=
github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU=
github.com/bytedance/sonic/loader v0.2.4 h1:ZWCw4stuXUsn1/+zQDqeE7JKP+QO47tz7QCNan80NzY=
github.com/bytedance/sonic/loader v0.2.4/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI=
github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4=
github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w=
github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg=
github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/deckarep/golang-set/v2 v2.7.0 h1:gIloKvD7yH2oip4VLhsv3JyLLFnC0Y2mlusgcvJYW5k=
github.com/deckarep/golang-set/v2 v2.7.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/deckarep/golang-set/v2 v2.8.0 h1:swm0rlPCmdWn9mESxKOjWk8hXSqoxOp+ZlfuyaAdFlQ=
github.com/deckarep/golang-set/v2 v2.8.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4=
github.com/donseba/go-htmx v1.12.0 h1:7tESER0uxaqsuGMv3yP3pK1drfBUXM6apG4H7/3+IgE=
github.com/donseba/go-htmx v1.12.0/go.mod h1:8PTAYvNKf8+QYis+DpAsggKz+sa2qljtMgvdAeNBh5s=
github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY=
github.com/dustin/go-humanize v1.0.1/go.mod h1:Mu1zIs6XwVuF/gI1OepvI0qD18qycQx+mFykh5fBlto=
github.com/gabriel-vasile/mimetype v1.4.9 h1:5k+WDwEsD9eTLL8Tz3L0VnmVh9QxGjRmjBvAG7U/oYY=
github.com/gabriel-vasile/mimetype v1.4.9/go.mod h1:WnSQhFKJuBlRyLiKohA/2DtIlPFAbguNaG7QCHcyGok=
github.com/gin-contrib/sse v1.1.0 h1:n0w2GMuUpWDVp7qSpvze6fAu9iRxJY4Hmj6AmBOU05w=
github.com/gin-contrib/sse v1.1.0/go.mod h1:hxRZ5gVpWMT7Z0B0gSNYqqsSCNIJMjzvm6fqCz9vjwM=
github.com/gin-gonic/gin v1.10.1 h1:T0ujvqyCSqRopADpgPgiTT63DUQVSfojyME59Ei63pQ=
github.com/gin-gonic/gin v1.10.1/go.mod h1:4PMNQiOhvDRa013RKVbsiNwoyezlm2rm0uX/T7kzp5Y=
github.com/go-jose/go-jose/v3 v3.0.3 h1:fFKWeig/irsp7XD2zBxvnmA/XaRWp5V3CBsZXJF7G7k=
github.com/go-jose/go-jose/v3 v3.0.3/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
github.com/go-jose/go-jose/v3 v3.0.4 h1:Wp5HA7bLQcKnf6YYao/4kpRpVMp/yf6+pJKV8WFSaNY=
github.com/go-jose/go-jose/v3 v3.0.4/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ=
github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA=
github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY=
github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY=
github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY=
github.com/go-playground/validator/v10 v10.26.0 h1:SP05Nqhjcvz81uJaRfEV0YBSSSGMc/iMaVtFbr3Sw2k=
github.com/go-playground/validator/v10 v10.26.0/go.mod h1:I5QpIEbmr8On7W0TktmJAumgzX4CA1XNl4ZmDuVHKKo=
github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw=
github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4=
github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4=
github.com/goccy/go-json v0.10.5/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M=
github.com/google/go-cmp v0.5.9 h1:O2Tfq5qg4qc4AmwVlvv0oLiVAGB7enBSJ2x2DqQFi38=
github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg=
github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE=
github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0=
github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M=
github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ=
github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI=
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/mitchellh/go-ps v1.0.0 h1:i6ampVEEF4wQFF+bkYfwYgY+F/uYJDktmvLPf7qIgjc=
github.com/mitchellh/go-ps v1.0.0/go.mod h1:J4lOc8z8yJs6vUwklHw2XEIiT4z4C40KtWVN3nvg8Pg=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/ncruces/go-strftime v0.1.9 h1:bY0MQC28UADQmHmaF5dgpLmImcShSi2kHU9XLdhx/f4=
github.com/ncruces/go-strftime v0.1.9/go.mod h1:Fwc5htZGVVkseilnfgOVb9mKy6w1naJmn9CehxcKcls=
github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4=
github.com/pelletier/go-toml/v2 v2.2.4/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
github.com/playwright-community/playwright-go v0.4902.0 h1:SslPUKmc35YgTBZKTLhokxrqTsVk3/mirj+TkqR6dC0=
github.com/playwright-community/playwright-go v0.4902.0/go.mod h1:kBNWs/w2aJ2ZUp1wEOOFLXgOqvppFngM5OS+qyhl+ZM=
github.com/playwright-community/playwright-go v0.5200.0 h1:z/5LGuX2tBrg3ug1HupMXLjIG93f1d2MWdDsNhkMQ9c=
github.com/playwright-community/playwright-go v0.5200.0/go.mod h1:UnnyQZaqUOO5ywAZu60+N4EiWReUqX1MQBBA3Oofvf8=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec h1:W09IVJc94icq4NjY3clb7Lk8O1qJ8BdBEF8z0ibU0rE=
github.com/remyoudompheng/bigfft v0.0.0-20230129092748-24d4a6f8daec/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA=
github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI=
github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08=
github.com/ugorji/go/codec v1.3.0 h1:Qd2W2sQawAfG8XSvzwhBeoGq71zXOC/Q1E9y/wUcsUA=
github.com/ugorji/go/codec v1.3.0/go.mod h1:pRBVtBSKl77K30Bv8R2P+cLSGaTtex6fsA2Wjqmfxj4=
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
golang.org/x/arch v0.18.0 h1:WN9poc33zL4AzGxqf8VtpKUnGvMi8O9lhNyBMF/85qc=
golang.org/x/arch v0.18.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM=
golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U=
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476 h1:bsqhLWFR6G6xiQcb+JoGqdKdRU6WzPWmK8E0jxTjzo4=
golang.org/x/exp v0.0.0-20250606033433-dcc06ee1d476/go.mod h1:3//PLf8L/X+8b4vuAfHzxeRUl04Adcb341+IGKfnqS8=
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
golang.org/x/mod v0.16.0 h1:QX4fJ0Rr5cPQCF7O9lh9Se4pmwfwskqZfq5moyldzic=
golang.org/x/mod v0.16.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c=
golang.org/x/mod v0.25.0 h1:n7a+ZbQKQA/Ysbyb0/6IbB1H/X41mKgbhfv7AfG/44w=
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.41.0 h1:vBTly1HeNPEn3wtREYfy4GZ/NECgw2Cnl+nK6Nz3uvw=
golang.org/x/net v0.41.0/go.mod h1:B/K4NNqkfmg07DQYrbwvSluqCJOOXwUjeb/5lOisjbA=
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@ -126,8 +60,6 @@ golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
@ -140,8 +72,6 @@ golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ=
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
golang.org/x/text v0.26.0 h1:P42AVeLghgTYr4+xUnTRKDMqpar+PtX7KWuNQL21L8M=
golang.org/x/text v0.26.0/go.mod h1:QK15LZJUUQVJxhz7wXgxSy/CJaTFjd0G+YLonydOVQA=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
@ -149,8 +79,6 @@ golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
golang.org/x/tools v0.19.0 h1:tfGCXNR1OsFG+sVdLAitlpjAvD/I6dHDKnYrpEZUHkw=
golang.org/x/tools v0.19.0/go.mod h1:qoJWxmGSIBmAeriMx19ogtrEPrGtDbPK634QFIcLAhc=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
google.golang.org/protobuf v1.36.6 h1:z1NpPI8ku2WgiWnf+t9wTPsn6eP1L7ksHUlkfLvd9xY=
google.golang.org/protobuf v1.36.6/go.mod h1:jduwjTPXsFjZGTmRluh+L6NjiWu7pchiJ2/5YcXBHnY=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
@ -161,36 +89,23 @@ modernc.org/ccgo/v4 v4.19.2 h1:lwQZgvboKD0jBwdaeVCTouxhxAyN6iawF3STraAal8Y=
modernc.org/ccgo/v4 v4.19.2/go.mod h1:ysS3mxiMV38XGRTTcgo0DQTeTmAO4oCmJl1nX9VFI3s=
modernc.org/fileutil v1.3.0 h1:gQ5SIzK3H9kdfai/5x41oQiKValumqNTDXMvKo62HvE=
modernc.org/fileutil v1.3.0/go.mod h1:XatxS8fZi3pS8/hKG2GH/ArUogfxjpEKs3Ku3aK4JyQ=
modernc.org/fileutil v1.3.3 h1:3qaU+7f7xxTUmvU1pJTZiDLAIoJVdUSSauJNHg9yXoA=
modernc.org/gc/v2 v2.4.1 h1:9cNzOqPyMJBvrUipmynX0ZohMhcxPtMccYgGOJdOiBw=
modernc.org/gc/v2 v2.4.1/go.mod h1:wzN5dK1AzVGoH6XOzc3YZ+ey/jPgYHLuVckd62P0GYU=
modernc.org/libc v1.55.3 h1:AzcW1mhlPNrRtjS5sS+eW2ISCgSOLLNyFzRh/V3Qj/U=
modernc.org/libc v1.55.3/go.mod h1:qFXepLhz+JjFThQ4kzwzOjA/y/artDeg+pcYnY+Q83w=
modernc.org/libc v1.65.10 h1:ZwEk8+jhW7qBjHIT+wd0d9VjitRyQef9BnzlzGwMODc=
modernc.org/libc v1.65.10/go.mod h1:StFvYpx7i/mXtBAfVOjaU0PWZOvIRoZSgXhrwXzr8Po=
modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4=
modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo=
modernc.org/mathutil v1.7.1 h1:GCZVGXdaN8gTqB1Mf/usp1Y/hSqgI2vAGGP4jZMCxOU=
modernc.org/mathutil v1.7.1/go.mod h1:4p5IwJITfppl0G4sUEDtCr4DthTaT47/N3aT6MhfgJg=
modernc.org/memory v1.8.0 h1:IqGTL6eFMaDZZhEWwcREgeMXYwmW83LYW8cROZYkg+E=
modernc.org/memory v1.8.0/go.mod h1:XPZ936zp5OMKGWPqbD3JShgd/ZoQ7899TUuQqxY+peU=
modernc.org/memory v1.11.0 h1:o4QC8aMQzmcwCK3t3Ux/ZHmwFPzE6hf2Y5LbkRs+hbI=
modernc.org/memory v1.11.0/go.mod h1:/JP4VbVC+K5sU2wZi9bHoq2MAkCnrt2r98UGeSK7Mjw=
modernc.org/opt v0.1.3 h1:3XOZf2yznlhC+ibLltsDGzABUGVx8J6pnFMS3E4dcq4=
modernc.org/opt v0.1.3/go.mod h1:WdSiB5evDcignE70guQKxYUl14mgWtbClRi5wmkkTX0=
modernc.org/sortutil v1.2.0 h1:jQiD3PfS2REGJNzNCMMaLSp/wdMNieTbKX920Cqdgqc=
modernc.org/sortutil v1.2.0/go.mod h1:TKU2s7kJMf1AE84OoiGppNHJwvB753OYfNl2WRb++Ss=
modernc.org/sqlite v1.33.1 h1:trb6Z3YYoeM9eDL1O8do81kP+0ejv+YzgyFo+Gwy0nM=
modernc.org/sqlite v1.33.1/go.mod h1:pXV2xHxhzXZsgT/RtTFAPY6JJDEvOTcTdwADQCCWD4k=
modernc.org/sqlite v1.38.0 h1:+4OrfPQ8pxHKuWG4md1JpR/EYAh3Md7TdejuuzE7EUI=
modernc.org/sqlite v1.38.0/go.mod h1:1Bj+yES4SVvBZ4cBOpVZ6QgesMCKpJZDq0nxYzOpmNE=
modernc.org/strutil v1.2.0 h1:agBi9dp1I+eOnxXeiZawM8F4LawKv4NzGWSaLfyeNZA=
modernc.org/strutil v1.2.0/go.mod h1:/mdcBmfOibveCTBxUl5B5l6W+TTH1FXPLHZE6bTosX0=
modernc.org/token v1.1.0 h1:Xl7Ap9dKaEs5kLoOQeQmPWevfnk/DM5qcLcYlA8ys6Y=
modernc.org/token v1.1.0/go.mod h1:UGzOrNV1mAFSEB63lOFHIpNRUVMvYTc6yu1SMY/XTDM=
nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50=
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
zombiezen.com/go/sqlite v1.4.0 h1:N1s3RIljwtp4541Y8rM880qgGIgq3fTD2yks1xftnKU=
zombiezen.com/go/sqlite v1.4.0/go.mod h1:0w9F1DN9IZj9AcLS9YDKMboubCACkwYCGkzoy3eG5ik=
zombiezen.com/go/sqlite v1.4.2 h1:KZXLrBuJ7tKNEm+VJcApLMeQbhmAUOKA5VWS93DfFRo=
zombiezen.com/go/sqlite v1.4.2/go.mod h1:5Kd4taTAD4MkBzT25mQ9uaAlLjyR0rFhsR6iINO70jc=

View File

@ -1,598 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Viva++</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<style>
body {
background-color: #000;
background-image: radial-gradient(circle at 50% 200%, rgba(255, 0, 0, 0.4) 0%, transparent 70%),
radial-gradient(circle at 50% -100%, rgba(0, 0, 255, 0.4) 0%, transparent 70%);
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
overflow: hidden; /* To prevent any unexpected scrollbars */
}
.loader {
position: fixed; /* Changed for global overlay */
left: 50%;
top: 50%;
transform: translate(-50%, -50%); /* Center on screen */
z-index: 10001; /* Above video overlay */
border: 1.5vw solid #333;
border-top: 1.5vw solid #3498db;
border-bottom: 1.5vw solid #3498db;
border-radius: 50%;
width: 10vw;
height: 10vw;
animation: spin 2s linear infinite;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
#video-container {
display: none;
width: 100%;
justify-content: center;
align-items: center;
gap: 2vw;
}
.video-thumbnail {
border-radius: 8px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
background-color: #444;
aspect-ratio: 16/9;
width: 20vw;
transition: width 0.3s ease, box-shadow 0.3s ease, left 0.3s ease;
transform: translate(-50%, -50%);
position: fixed;
}
.video-thumbnail.focussed {
outline: 3px solid #557; /* Existing focus outline */
box-shadow: 0 0 400px -10px #446; /* Existing focus shadow */
width: 50vw;
z-index: 3; /* Ensure focused thumbnail is on top */
}
.side-video {
width: 20vw;
opacity: 0.7;
z-index: 1;
}
.play-button {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
width: 80px; /* Adjust size as needed */
height: 80px; /* Adjust size as needed */
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M8 5v14l11-7z'/%3E%3C/svg%3E");
background-color: rgba(0, 0, 0, 0.5); /* Semi-transparent background */
background-repeat: no-repeat;
background-position: center;
background-size: 50%; /* Adjust icon size within button */
border-radius: 50%; /* Circular button */
cursor: pointer;
z-index: 3; /* Ensure it's above the video thumbnails */
border: 2px solid white;
box-shadow: 0 0 15px rgba(0,0,0,0.7);
}
#video-overlay-container {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: black;
z-index: 10000; /* Above other page content */
display: none; /* Initially hidden, JS will change to flex */
align-items: center;
justify-content: center;
}
#video-overlay-container .video-player {
width: 100%;
height: 100%;
display: block;
position: fixed;
}
#video-overlay-container #back-button { /* Back button is now inside the container */
position: absolute;
top: 20px;
left: 20px;
z-index: 1; /* z-index relative to siblings in container */
padding: 10px 20px;
font-size: 16px;
background-color: rgba(0, 0, 0, 0.5);
color: white;
border: 1px solid white;
border-radius: 5px;
cursor: pointer;
opacity: 1; /* Visible by default */
transition: opacity 0.3s ease-in-out; /* Smooth transition */
}
#video-overlay-container #back-button.button-hidden {
opacity: 0; /* Class to hide the button */
}
#custom-video-controls {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
padding: 10px;
background-color: rgba(0, 0, 0, 0.5);
display: flex;
align-items: center;
z-index: 1; /* Above video, but below back button if it were in the same direct stacking context */
opacity: 1;
transition: opacity 0.3s ease-in-out;
box-sizing: border-box;
}
#custom-video-controls.controls-hidden {
opacity: 0;
}
#custom-play-pause-button {
background: none;
border: none;
color: white;
font-size: 1.5em; /* Adjust size as needed */
cursor: pointer;
padding: 5px 10px;
margin-right: 10px;
}
#custom-seek-bar {
flex-grow: 1;
cursor: pointer;
accent-color: #3498db; /* Optional: color for the seek bar thumb and progress */
}
/* Styles for TV remote focus indication */
#back-button:focus {
outline: 3px solid #3498db !important; /* A clear blue outline */
box-shadow: 0 0 15px #3498db; /* A glow effect */
}
.nofocus:focus {
outline: none !important; /* Remove focus outline for elements with nofocus class */
}
</style>
<script>
function hideSpinner() { // Was hideLoader, now only hides spinner
$(".loader").hide();
}
function showSpinner() { // Was showLoader
$(".loader").show();
}
function showVideoContainer() {
$("#video-container").css("display", "flex");
}
let currentVideo = null;
let videoElement = null;
let overlayContainer = null;
let inactivityTimer = null;
let backButton = null;
let customControls = null;
let playPauseButton = null;
let seekBar = null;
function exitVideoPlayback() {
if (videoElement && videoElement.pause) {
videoElement.pause();
}
clearTimeout(inactivityTimer);
if (overlayContainer) {
overlayContainer.css('cursor', 'default');
overlayContainer.off('mousemove.inactivityControls'); // Remove session-specific listener
overlayContainer.hide(); // Hide instead of remove
}
$(document).off('fullscreenchange.videoPlayback webkitfullscreenchange.videoPlayback mozFullScreen.videoPlayback MSFullscreenChange.videoPlayback', handleFullscreenChange);
if (videoElement) {
$(videoElement).off('.currentVideo'); // Remove all namespaced video events
videoElement.src = ""; // Clear the source
videoElement.load(); // Important to ensure the video unloads
}
if (seekBar) { // seekBar is a jQuery object
seekBar.val(0);
seekBar.css('background', ''); // Reset seek bar style
}
updatePlayPauseButtonState(); // Update button to show play icon usually
// Attempt to exit fullscreen
if (document.fullscreenElement || document.webkitIsFullScreen || document.mozFullScreen || document.msFullscreenElement) {
if (document.exitFullscreen) {
document.exitFullscreen().catch(() => {});
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
}
}
// FOCUS: Return focus to the main view's play button
if ($("#video-container").is(":visible") && $('#play-button').length) {
$('#play-button').focus();
}
}
function showControlsAndResetTimer() {
if (backButton) backButton.removeClass('button-hidden');
if (customControls) customControls.removeClass('controls-hidden');
if (overlayContainer) overlayContainer.css('cursor', 'default');
clearTimeout(inactivityTimer);
inactivityTimer = setTimeout(function() {
if (backButton) backButton.addClass('button-hidden');
if (customControls) customControls.addClass('controls-hidden');
if (overlayContainer) overlayContainer.css('cursor', 'none');
}, 3000);
}
function handlePlayPauseClick() {
if (videoElement) {
if (videoElement.paused) {
videoElement.play();
} else {
videoElement.pause();
}
}
updatePlayPauseButtonState();
}
function updatePlayPauseButtonState() {
if (!playPauseButton || !videoElement) return;
if (videoElement.paused) {
playPauseButton.text('►');
} else {
playPauseButton.text('❚❚');
}
}
function handleVideoLoadedMetadata() {
if (seekBar && videoElement) {
seekBar.attr('max', videoElement.duration);
}
}
function handleVideoTimeUpdate() {
if (seekBar && videoElement && videoElement.duration) { // Check videoElement.duration to prevent NaN
seekBar.val(videoElement.currentTime);
const percentage = (videoElement.currentTime / videoElement.duration) * 100;
seekBar.css('background', `linear-gradient(to right, #3498db ${percentage}%, #555 ${percentage}%)`);
} else if (seekBar) {
seekBar.val(0); // Reset if duration is not available
}
}
function handleSeekBarInput() {
if (videoElement && seekBar) {
videoElement.currentTime = seekBar.val();
}
}
function handleFullscreenChange() {
const isActuallyFullscreen = document.fullscreenElement || document.webkitIsFullScreen || document.mozFullScreen || document.msFullscreenElement;
if (!isActuallyFullscreen && overlayContainer && overlayContainer.is(':visible')) {
// If fullscreen exited and overlay was visible, treat as exiting video playback
// This helps if user presses Esc.
exitVideoPlayback();
}
}
let videoInfo = [];
let selectedThumbnailIndex = 0;
/**
* Creates a new video thumbnail element.
*
* @param data The video data returned by the server.
* @param selected Set to true if this is the currently selected video thumbnail.
* @param append Set to true if this thumbnail should be appended to the video container, false if it should be prepended.
*/
function createVideoThumbnailElement(data, selected, append) {
let container = $(`<span></span>`);
let thumbnail = $(`<img src="${data.thumbnail}" class="video-thumbnail" alt="Video Thumbnail" tabindex="0">`)[0];
container.append(thumbnail)
let index;
if (append) {
$("#video-container").append(container);
index = videoInfo.length;
videoInfo.push({
thumbnail,
data
})
} else {
$("#video-container").prepend(container);
index = 0;
videoInfo.unshift({
thumbnail,
data
});
selectedThumbnailIndex++;
}
if (selected) {
thumbnail.classList.add("focussed");
selectedThumbnailIndex = index;
}
}
/**
* Selects a video thumbnail by its index into the videoThumbnails array.
* @param index The index of the thumbnail to select.
*/
function selectThumbnail(index) {
if (index < 0 || index >= videoInfo.length) return; // Out of bounds check
if (selectedThumbnailIndex !== -1 && videoInfo[selectedThumbnailIndex]) {
videoInfo[selectedThumbnailIndex].thumbnail.classList.remove("focussed");
}
selectedThumbnailIndex = index;
videoInfo[selectedThumbnailIndex].thumbnail.classList.add("focussed");
const offset = 12;
for (let i = 0; i < videoInfo.length; i++) {
if (i < selectedThumbnailIndex - 1) {
videoInfo[i].thumbnail.style.left = "-20%";
} else if (i === selectedThumbnailIndex - 1) {
videoInfo[i].thumbnail.style.left = offset + "%";
} else if (i === selectedThumbnailIndex) {
videoInfo[i].thumbnail.style.left = "50%";
} else if (i === selectedThumbnailIndex + 1) {
videoInfo[i].thumbnail.style.left = (100 - offset) + "%";
} else {
videoInfo[i].thumbnail.style.left = "120%";
}
}
}
/**
* Starts the currently selected video.
*/
function startVideo() {
showSpinner();
let currentVideo = videoInfo[selectedThumbnailIndex].data
// Clear previous handlers and set new ones for this specific load attempt
videoElement.oncanplaythrough = null;
videoElement.onerror = null;
videoElement.oncanplaythrough = function() {
hideSpinner();
videoElement.oncanplaythrough = null; // Clean up handler
videoElement.onerror = null; // Clean up handler
videoElement.play().catch(err => {
console.error("Error attempting to play video:", err);
exitVideoPlayback(); // Exit overlay on play error
});
};
videoElement.onerror = function() {
console.error("Error loading video.");
hideSpinner();
videoElement.oncanplaythrough = null; // Clean up handler
videoElement.onerror = null; // Clean up handler
exitVideoPlayback(); // Exit overlay on load error
};
videoElement.src = currentVideo.url;
videoElement.load();
// --- Setup Inactivity Controls (session-specific) ---
showControlsAndResetTimer(); // Initial call
updatePlayPauseButtonState(); // Initial state for the button
// Show overlay and request fullscreen
overlayContainer.css('display', 'flex');
const containerEl = overlayContainer[0];
if (containerEl.requestFullscreen) {
containerEl.requestFullscreen().catch(err => console.error("Error attempting to enable full-screen mode:", err));
} else if (containerEl.mozRequestFullScreen) {
containerEl.mozRequestFullScreen();
} else if (containerEl.webkitRequestFullscreen) {
containerEl.webkitRequestFullscreen();
} else if (containerEl.msRequestFullscreen) {
containerEl.msRequestFullscreen();
}
// FOCUS: Set focus in the video overlay
if (playPauseButton && playPauseButton.length) {
playPauseButton.focus();
}
updatePlayPauseButtonState()
}
$(document).on("mousemove", function () {
showControlsAndResetTimer()
})
$(document).ready(function() {
// Initialize global selectors for static elements
overlayContainer = $("#video-overlay-container");
videoElement = overlayContainer.find(".video-player")[0];
backButton = overlayContainer.find("#back-button");
customControls = overlayContainer.find("#custom-video-controls");
playPauseButton = customControls.find("#custom-play-pause-button");
seekBar = customControls.find("#custom-seek-bar");
// Spinner is visible by default (CSS). Video container is hidden (CSS).
// Pre-set all thumbnails to a placeholder state
$(".video-thumbnail").attr("src", "data:image/svg+xml,%3Csvg xmlns=\\\'http://www.w3.org/2000/svg\\\' width=\\\'100%25\\\' height=\\\'100%25\\\' viewBox=\\\'0 0 16 9\\\'%3E%3C/svg%3E");
$.getJSON("/api/homepage", function(data) {
createVideoThumbnailElement(data.currentVideo, true, true);
for (let i = 0; i < data.nextVideos.length; i++)
createVideoThumbnailElement(data.nextVideos[i], false, true);
// currentVideo = data.currentVideo;
// nextVideo = data.nextVideo;
// $("#current-thumb").attr("src", currentVideo.thumbnail);
// $("#next-thumb").attr("src", nextVideo.thumbnail);
// Consider populating prev-thumb and next-thumb here if data provides them
hideSpinner();
showVideoContainer();
selectThumbnail(selectedThumbnailIndex);
}).fail(function(jqXHR, textStatus, errorThrown) {
console.error("Failed to load homepage data:", textStatus, errorThrown);
hideSpinner();
// Display a user-friendly error message
if (!$('#init-error-msg').length) { // Prevent multiple error messages
$('body').append('<div id="init-error-msg" style="color:white; text-align:center; padding:20px; position:fixed; top:50%; left:50%; transform:translate(-50%,-50%); background-color:rgba(0,0,0,0.8); border-radius:8px; z-index: 10002;">Failed to load content. Please try again later.</div>');
}
});
// Attach event listeners that can be set up once for static controls
if (playPauseButton) playPauseButton.click(handlePlayPauseClick);
if (seekBar) seekBar.on('input', handleSeekBarInput);
if (backButton) backButton.click(exitVideoPlayback);
// --- Setup Custom Video Controls Events (session-specific for video element) ---
$(videoElement).on('play.currentVideo', updatePlayPauseButtonState);
$(videoElement).on('pause.currentVideo', updatePlayPauseButtonState);
$(videoElement).on('loadedmetadata.currentVideo', handleVideoLoadedMetadata);
$(videoElement).on('ended.currentVideo', exitVideoPlayback);
setInterval(handleVideoTimeUpdate, 1000/30);
// --- Setup Fullscreen Change Listener (session-specific) ---
$(document).off('fullscreenchange.videoPlayback webkitfullscreenchange.videoPlayback mozFullScreen.videoPlayback MSFullscreenChange.videoPlayback', handleFullscreenChange);
$(document).on('fullscreenchange.videoPlayback webkitfullscreenchange.videoPlayback mozFullScreen.videoPlayback MSFullscreenChange.videoPlayback', handleFullscreenChange);
overlayContainer.on('mousemove.inactivityControls', showControlsAndResetTimer);
// --- TV Remote/Keyboard Navigation ---
const getOverlayViewFocusableElements = () => [backButton, playPauseButton, seekBar].filter(el => el && el.length > 0 && el.is(':visible'));
$(document).on('keydown', function(e) {
let isOverlayVisible = overlayContainer.is(':visible');
let activeFocusableSet;
if (isOverlayVisible) {
activeFocusableSet = getOverlayViewFocusableElements();
const focusedElement = $(document.activeElement);
let currentIndex = -1;
for (let i = 0; i < activeFocusableSet.length; i++) {
if (focusedElement.is(activeFocusableSet[i])) {
currentIndex = i;
break;
}
}
}
// Global key handling for overlay
if (isOverlayVisible) {
switch (e.key || e.keyCode) {
case 'Backspace':
case 8:
e.preventDefault();
if (backButton && backButton.length) backButton.click();
return;
case 'Enter':
case 13:
case 179: // MediaPlayPause
e.preventDefault();
if (playPauseButton && playPauseButton.length) playPauseButton.click();
return;
case 178: // MediaStop
e.preventDefault();
exitVideoPlayback();
return;
case 'ArrowLeft':
case 37: // ArrowLeft
videoElement.currentTime = Math.max(0, videoElement.currentTime - 5); // Seek back 5s
handleVideoTimeUpdate();
showControlsAndResetTimer();
e.preventDefault();
return;
case 'ArrowRight':
case 39: // ArrowRight
videoElement.currentTime = Math.min(videoElement.duration, videoElement.currentTime + 5); // Seek forward 5s
handleVideoTimeUpdate();
showControlsAndResetTimer();
e.preventDefault();
return;
}
}
let keyHandled = false;
let nextIndex;
switch (e.key || e.keyCode) {
case 'ArrowLeft':
case 37: // ArrowLeft
nextIndex = Math.max(selectedThumbnailIndex - 1, 0);
selectThumbnail(nextIndex);
keyHandled = true;
break;
case 'ArrowRight':
case 39: // ArrowRight
nextIndex = Math.min(selectedThumbnailIndex + 1, videoInfo.length - 1);
selectThumbnail(nextIndex);
keyHandled = true;
break;
case 'Enter':
case 13: // Enter
startVideo();
keyHandled = true;
break;
case 179: // MediaPlayPause (if not handled by global overlay section)
if (!isOverlayVisible && $('#play-button').length) {
$('#play-button').click();
keyHandled = true;
}
break;
}
if (keyHandled) {
e.preventDefault();
}
});
})
</script>
</head>
<body>
<div class="loader" id="loader"></div>
<div id="video-container">
<!-- <img id="prev-thumb" class="video-thumbnail side-video" alt="Previous Video" tabindex="0">-->
<!-- <img id="current-thumb" class="video-thumbnail current-video" alt="Current Video" tabindex="0">-->
<!-- <img id="next-thumb" class="video-thumbnail side-video" alt="Next Video" tabindex="0">-->
<!-- <div class="play-button" id="play-button" tabindex="0" role="button" aria-label="Play video"></div>-->
</div>
<!-- STATIC VIDEO OVERLAY STRUCTURE -->
<div id="video-overlay-container">
<video class="video-player"></video> <!-- no src, no autoplay, no controls initially -->
<button id="back-button" tabindex="0">Back</button>
<div id="custom-video-controls">
<button id="custom-play-pause-button" class="nofocus" tabindex="0"></button> <!-- Default to Play icon -->
<input type="range" id="custom-seek-bar" class="nofocus" value="0" step="any" tabindex="0" aria-label="Video seek bar" />
</div>
</div>
</body>
</html>

View File

@ -1,16 +1,16 @@
package main
import (
"cmp"
"fmt"
"gitea.seeseepuff.be/seeseemelk/mysqlite"
"github.com/donseba/go-htmx"
"github.com/gin-gonic/gin"
"log"
"net/http"
"os"
"path/filepath"
"strconv"
"strings"
"gitea.seeseepuff.be/seeseemelk/mysqlite"
"github.com/donseba/go-htmx"
)
type App struct {
@ -19,198 +19,151 @@ type App struct {
}
func serveWebview(db *mysqlite.Db) {
addr := "0.0.0.0:8081"
addr := "localhost:8081"
app := &App{
db: db,
htmx: htmx.New(),
}
log.Printf("Listening on %s", addr)
http.Handle("/static/", http.StripPrefix("/static/", staticFileServer()))
http.HandleFunc("/video/", app.serveVideo)
http.HandleFunc("/stream/", app.serveStream)
http.HandleFunc("/mark-watched/", app.handleMarkWatched)
http.HandleFunc("/mark-unwatched/", app.handleMarkUnwatched)
http.HandleFunc("/", app.serveIndex)
router := gin.Default()
router.StaticFile("/", "static/index.html")
router.GET("/stream/:id", app.serveStream)
api := router.Group("/api")
api.GET("/homepage", app.homePage)
err := router.Run(addr)
err := http.ListenAndServe(addr, nil)
if err != nil {
log.Fatalf("Failed to start server: %v", err)
panic(err)
}
//http.Handle("/static/", http.StripPrefix("/static/", staticFileServer()))
//http.HandleFunc("/video/", app.serveVideo)
//http.HandleFunc("/stream/", app.serveStream)
//http.HandleFunc("/mark-watched/", app.handleMarkWatched)
//http.HandleFunc("/mark-unwatched/", app.handleMarkUnwatched)
//http.HandleFunc("/", app.serveIndex)
//
//err := http.ListenAndServe(addr, nil)
//if err != nil {
// panic(err)
//}
}
type VideoModel struct {
ID int `json:"id"`
Thumbnail string `json:"thumbnail"`
URL string `json:"url"`
}
type HomePageModel struct {
Current VideoModel `json:"currentVideo"`
Next []VideoModel `json:"nextVideos"`
Previous []VideoModel `json:"previousVideos"`
}
func (a *App) homePage(c *gin.Context) {
model := HomePageModel{}
errCurrent := a.db.Query("SELECT id, thumbnail FROM videos WHERE (watch_state IS NULL OR watch_state != 'watched') ORDER BY upload_date, episode LIMIT 1").
ScanSingle(&model.Current.ID, &model.Current.Thumbnail)
var errNext, errPrevious error
for row := range a.db.Query("SELECT id, thumbnail FROM videos WHERE (watch_state IS NULL OR watch_state != 'watched') ORDER BY upload_date, episode LIMIT 3 OFFSET 1").Range(&errNext) {
video := VideoModel{}
err := row.Scan(&video.ID, &video.Thumbnail)
func (a *App) renderTemplate(w http.ResponseWriter, name string, viewmodel interface{}) {
err := renderTemplate(w, "index", viewmodel)
if err != nil {
log.Printf("Failed to scan next video: %v", err)
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to retrieve next videos"})
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}
func (a *App) getViewModelForVideo(id int) (*VideoInfoVM, error) {
// Query the database for the requested video
var title, description, thumbnail string
var watchState *string
err := a.db.Query(`SELECT title, description, thumbnail, watch_state FROM videos WHERE id = ? LIMIT 1`).Bind(id).ScanSingle(&title, &description, &thumbnail, &watchState)
if err != nil {
return nil, err
}
// Find the previous video ID based on upload date and episode number
var previousID int
err = a.db.Query(`
SELECT id FROM videos
WHERE (upload_date < (SELECT upload_date FROM videos WHERE id = ?))
OR (upload_date = (SELECT upload_date FROM videos WHERE id = ?) AND episode < (SELECT episode FROM videos WHERE id = ?))
ORDER BY upload_date DESC, episode DESC
LIMIT 1
`).Bind(id, id, id).ScanSingle(&previousID)
if err != nil {
// If there's no previous video, set previousID to 0 or -1 to indicate no previous video
previousID = 0
}
// Determine if the video has been watched
isWatched := watchState != nil && *watchState == "watched"
return &VideoInfoVM{
ID: id,
PreviousID: previousID,
Title: title,
Description: description,
Thumbnail: thumbnail,
IsWatched: isWatched,
}, nil
}
func (a *App) getViewModelForUnwachtedVideo() (*VideoInfoVM, error) {
// Query the database for the oldest unwatched episode
var id int
err := a.db.Query(`SELECT id FROM videos WHERE (watch_state IS NULL OR watch_state != 'watched') ORDER BY upload_date, episode LIMIT 1`).ScanSingle(&id)
if err != nil {
return nil, err
}
return a.getViewModelForVideo(id)
}
func (a *App) serveIndex(w http.ResponseWriter, r *http.Request) {
var vm *VideoInfoVM
var err error
// Check if a specific video ID was requested
videoIDParam := r.URL.Query().Get("video")
if videoIDParam != "" {
videoID, parseErr := strconv.Atoi(videoIDParam)
if parseErr == nil {
vm, err = a.getViewModelForVideo(videoID)
} else {
http.Error(w, "Invalid video ID", http.StatusBadRequest)
return
}
video.URL = fmt.Sprintf("/stream/%d", video.ID)
model.Next = append(model.Next, video)
} else {
// Fall back to the default behavior - get the oldest unwatched video
vm, err = a.getViewModelForUnwachtedVideo()
}
if err := cmp.Or(errCurrent, errNext, errPrevious); err != nil {
log.Printf("Failed to retrieve videos: %v", err)
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to retrieve videos"})
if err != nil {
log.Printf("Failed to find video: %v", err)
http.Error(w, "Failed to find video", http.StatusInternalServerError)
return
}
model.Current.URL = fmt.Sprintf("/stream/%d", model.Current.ID)
c.JSON(200, model)
a.renderTemplate(w, "index", vm)
}
//func (a *App) renderTemplate(w http.ResponseWriter, name string, viewmodel interface{}) {
// err := renderTemplate(w, "index", viewmodel)
// if err != nil {
// http.Error(w, err.Error(), http.StatusInternalServerError)
// }
//}
//
//func (a *App) getViewModelForVideo(id int) (*VideoInfoVM, error) {
// // Query the database for the requested video
// var title, description, thumbnail string
// var watchState *string
// err := a.db.Query(`SELECT title, description, thumbnail, watch_state FROM videos WHERE id = ? LIMIT 1`).Bind(id).ScanSingle(&title, &description, &thumbnail, &watchState)
// if err != nil {
// return nil, err
// }
//
// // Find the previous video ID based on upload date and episode number
// var previousID int
// err = a.db.Query(`
// SELECT id FROM videos
// WHERE (upload_date < (SELECT upload_date FROM videos WHERE id = ?))
// OR (upload_date = (SELECT upload_date FROM videos WHERE id = ?) AND episode < (SELECT episode FROM videos WHERE id = ?))
// ORDER BY upload_date DESC, episode DESC
// LIMIT 1
// `).Bind(id, id, id).ScanSingle(&previousID)
// if err != nil {
// // If there's no previous video, set previousID to 0 or -1 to indicate no previous video
// previousID = 0
// }
//
// // Determine if the video has been watched
// isWatched := watchState != nil && *watchState == "watched"
//
// return &VideoInfoVM{
// ID: id,
// PreviousID: previousID,
// Title: title,
// Description: description,
// Thumbnail: thumbnail,
// IsWatched: isWatched,
// }, nil
//}
//
//func (a *App) getViewModelForUnwachtedVideo() (*VideoInfoVM, error) {
// // Query the database for the oldest unwatched episode
// var id int
// err := a.db.Query(`SELECT id FROM videos WHERE (watch_state IS NULL OR watch_state != 'watched') ORDER BY upload_date, episode LIMIT 1`).ScanSingle(&id)
// if err != nil {
// return nil, err
// }
// return a.getViewModelForVideo(id)
//}
//
//func (a *App) serveIndex(w http.ResponseWriter, r *http.Request) {
// var vm *VideoInfoVM
// var err error
//
// // Check if a specific video ID was requested
// videoIDParam := r.URL.Query().Get("video")
// if videoIDParam != "" {
// videoID, parseErr := strconv.Atoi(videoIDParam)
// if parseErr == nil {
// vm, err = a.getViewModelForVideo(videoID)
// } else {
// http.Error(w, "Invalid video ID", http.StatusBadRequest)
// return
// }
// } else {
// // Fall back to the default behavior - get the oldest unwatched video
// vm, err = a.getViewModelForUnwachtedVideo()
// }
//
// if err != nil {
// log.Printf("Failed to find video: %v", err)
// http.Error(w, "Failed to find video", http.StatusInternalServerError)
// return
// }
// a.renderTemplate(w, "index", vm)
//}
//
//func (a *App) serveVideo(w http.ResponseWriter, r *http.Request) {
// // Parse the video ID from the URL
// pathParts := strings.Split(r.URL.Path, "/")
// if len(pathParts) < 3 {
// http.Error(w, "Invalid video ID", http.StatusBadRequest)
// return
// }
//
// videoIDStr := pathParts[2]
// videoID, err := strconv.Atoi(videoIDStr)
// if err != nil {
// http.Error(w, "Invalid video ID", http.StatusBadRequest)
// return
// }
//
// // Query the database for the video with the given ID
// var title, description string
// err = a.db.Query(`SELECT title, description FROM videos WHERE id = ?`).Bind(videoID).ScanSingle(&title, &description)
// if err != nil {
// log.Printf("Failed to find video: %v", err)
// http.Error(w, "Video not found", http.StatusNotFound)
// return
// }
//
// vm := VideoPlayerVM{
// ID: videoID,
// Title: title,
// Description: description,
// }
// a.renderTemplate(w, "video", vm)
//}
func (a *App) serveStream(c *gin.Context) {
func (a *App) serveVideo(w http.ResponseWriter, r *http.Request) {
// Parse the video ID from the URL
idStr := c.Param("id")
videoID, err := strconv.Atoi(idStr)
pathParts := strings.Split(r.URL.Path, "/")
if len(pathParts) < 3 {
http.Error(w, "Invalid video ID", http.StatusBadRequest)
return
}
videoIDStr := pathParts[2]
videoID, err := strconv.Atoi(videoIDStr)
if err != nil {
log.Printf("Failed to parse video ID: %v", err)
c.JSON(http.StatusBadRequest, gin.H{"error": "Invalid video ID"})
http.Error(w, "Invalid video ID", http.StatusBadRequest)
return
}
// Query the database for the video with the given ID
var title, description string
err = a.db.Query(`SELECT title, description FROM videos WHERE id = ?`).Bind(videoID).ScanSingle(&title, &description)
if err != nil {
log.Printf("Failed to find video: %v", err)
http.Error(w, "Video not found", http.StatusNotFound)
return
}
vm := VideoPlayerVM{
ID: videoID,
Title: title,
Description: description,
}
a.renderTemplate(w, "video", vm)
}
func (a *App) serveStream(w http.ResponseWriter, r *http.Request) {
// Parse the video ID from the URL
pathParts := strings.Split(r.URL.Path, "/")
if len(pathParts) < 3 {
http.Error(w, "Invalid video ID", http.StatusBadRequest)
return
}
videoIDStr := pathParts[2]
videoID, err := strconv.Atoi(videoIDStr)
if err != nil {
http.Error(w, "Invalid video ID", http.StatusBadRequest)
return
}
@ -218,8 +171,7 @@ func (a *App) serveStream(c *gin.Context) {
var year, episode int
err = a.db.Query(`SELECT year, episode FROM videos WHERE id = ?`).Bind(videoID).ScanSingle(&year, &episode)
if err != nil {
log.Printf("Failed to find video: %v", err)
c.JSON(http.StatusNotFound, gin.H{"error": "Video not found"})
http.Error(w, "Video not found", http.StatusNotFound)
return
}
@ -237,103 +189,94 @@ func (a *App) serveStream(c *gin.Context) {
log.Printf("Streaming video: %s", videoPath)
_, err = os.Stat(videoPath)
if os.IsNotExist(err) {
log.Printf("Video file not found: %s", videoPath)
c.JSON(http.StatusNotFound, gin.H{"error": "Video file not found"})
http.Error(w, "Video file not found", http.StatusNotFound)
return
}
// Serve the file
w := c.Writer
r := c.Request
w.Header().Set("Content-Type", "video/mp4")
w.Header().Set("Content-Disposition", fmt.Sprintf("inline; filename=\"%s\"", videoFilename))
w.Header().Set("Cache-Control", "no-cache, no-store, must-revalidate")
w.Header().Set("Pragma", "no-cache")
w.Header().Set("Expires", "0")
log.Printf("Serving video file: %s", videoPath)
http.ServeFile(w, r, videoPath)
}
//func (a *App) handleMarkWatched(w http.ResponseWriter, r *http.Request) {
// // Only handle POST requests
// if r.Method != http.MethodPost {
// http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
// return
// }
//
// // Parse the video ID from the URL
// pathParts := strings.Split(r.URL.Path, "/")
// if len(pathParts) < 3 {
// http.Error(w, "Invalid video ID", http.StatusBadRequest)
// return
// }
//
// videoIDStr := pathParts[2]
// videoID, err := strconv.Atoi(videoIDStr)
// if err != nil {
// http.Error(w, "Invalid video ID", http.StatusBadRequest)
// return
// }
//
// // Update the watch state in the database
// err = a.db.Query(`UPDATE videos SET watch_state = NULL WHERE id = ?`).Bind(videoID).Exec()
// if err != nil {
// http.Error(w, "Failed to update watch state", http.StatusInternalServerError)
// return
// }
//
// h := a.htmx.NewHandler(w, r)
// if h.RenderPartial() {
// vm, err := a.getViewModelForVideo(videoID)
// if err != nil {
// http.Error(w, "Failed to find video", http.StatusInternalServerError)
// return
// }
// a.renderTemplate(w, "frag-index", vm)
// } else {
// // Redirect back to the homepage
// http.Redirect(w, r, "/", http.StatusSeeOther)
// }
//}
//
//func (a *App) handleMarkUnwatched(w http.ResponseWriter, r *http.Request) {
// // Only handle POST requests
// if r.Method != http.MethodPost {
// http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
// return
// }
//
// // Parse the video ID from the URL
// pathParts := strings.Split(r.URL.Path, "/")
// if len(pathParts) < 3 {
// http.Error(w, "Invalid video ID", http.StatusBadRequest)
// return
// }
//
// videoIDStr := pathParts[2]
// videoID, err := strconv.Atoi(videoIDStr)
// if err != nil {
// http.Error(w, "Invalid video ID", http.StatusBadRequest)
// return
// }
//
// // Update the watch state in the database
// err = a.db.Query(`UPDATE videos SET watch_state = 'unwatched' WHERE id = ?`).Bind(videoID).Exec()
// if err != nil {
// http.Error(w, "Failed to update watch state", http.StatusInternalServerError)
// return
// }
//
// h := a.htmx.NewHandler(w, r)
// if h.RenderPartial() {
// vm, err := a.getViewModelForVideo(videoID)
// if err != nil {
// http.Error(w, "Failed to find video", http.StatusInternalServerError)
// return
// }
// a.renderTemplate(w, "frag-index", vm)
// } else {
// // Redirect back to the homepage
// http.Redirect(w, r, "/", http.StatusSeeOther)
// }
//}
func (a *App) handleMarkWatched(w http.ResponseWriter, r *http.Request) {
// Only handle POST requests
if r.Method != http.MethodPost {
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
return
}
// Parse the video ID from the URL
pathParts := strings.Split(r.URL.Path, "/")
if len(pathParts) < 3 {
http.Error(w, "Invalid video ID", http.StatusBadRequest)
return
}
videoIDStr := pathParts[2]
videoID, err := strconv.Atoi(videoIDStr)
if err != nil {
http.Error(w, "Invalid video ID", http.StatusBadRequest)
return
}
// Update the watch state in the database
err = a.db.Query(`UPDATE videos SET watch_state = NULL WHERE id = ?`).Bind(videoID).Exec()
if err != nil {
http.Error(w, "Failed to update watch state", http.StatusInternalServerError)
return
}
h := a.htmx.NewHandler(w, r)
if h.RenderPartial() {
vm, err := a.getViewModelForVideo(videoID)
if err != nil {
http.Error(w, "Failed to find video", http.StatusInternalServerError)
return
}
a.renderTemplate(w, "frag-index", vm)
} else {
// Redirect back to the homepage
http.Redirect(w, r, "/", http.StatusSeeOther)
}
}
func (a *App) handleMarkUnwatched(w http.ResponseWriter, r *http.Request) {
// Only handle POST requests
if r.Method != http.MethodPost {
http.Error(w, "Method not allowed", http.StatusMethodNotAllowed)
return
}
// Parse the video ID from the URL
pathParts := strings.Split(r.URL.Path, "/")
if len(pathParts) < 3 {
http.Error(w, "Invalid video ID", http.StatusBadRequest)
return
}
videoIDStr := pathParts[2]
videoID, err := strconv.Atoi(videoIDStr)
if err != nil {
http.Error(w, "Invalid video ID", http.StatusBadRequest)
return
}
// Update the watch state in the database
err = a.db.Query(`UPDATE videos SET watch_state = 'unwatched' WHERE id = ?`).Bind(videoID).Exec()
if err != nil {
http.Error(w, "Failed to update watch state", http.StatusInternalServerError)
return
}
h := a.htmx.NewHandler(w, r)
if h.RenderPartial() {
vm, err := a.getViewModelForVideo(videoID)
if err != nil {
http.Error(w, "Failed to find video", http.StatusInternalServerError)
return
}
a.renderTemplate(w, "frag-index", vm)
} else {
// Redirect back to the homepage
http.Redirect(w, r, "/", http.StatusSeeOther)
}
}