diff --git a/.github/workflows/gorelease.yml b/.github/workflows/gorelease.yml index 0927c926..9e0da810 100644 --- a/.github/workflows/gorelease.yml +++ b/.github/workflows/gorelease.yml @@ -23,7 +23,7 @@ jobs: - name: Setup Go with cache uses: actions/setup-go@v5 with: - go-version: ">=1.22.7" + go-version: ">=1.23.4" cache: true - name: Run GoReleaser diff --git a/assets/js/editor-artifact.js b/assets/js/editor-artifact.js index 284d6ca3..f6780b5b 100644 --- a/assets/js/editor-artifact.js +++ b/assets/js/editor-artifact.js @@ -602,7 +602,7 @@ import { clipValue, formatPaste, getElmById, titleize } from "./helper.mjs"; youtube.addEventListener("paste", () => { setTimeout(() => { youtube.value = youtube.value.replace( - /https?:\/\/www.youtube.com\/watch\?v=/, + /https?:\/\/www\.youtube\.com\/watch\?v=/, "" ); }, 0); @@ -615,14 +615,14 @@ import { clipValue, formatPaste, getElmById, titleize } from "./helper.mjs"; // on paste event for websites remove the https://16colo.rs/ URL colors16.addEventListener("paste", () => { setTimeout(() => { - colors16.value = colors16.value.replace(/https?:\/\/16colo.rs\//, ""); + colors16.value = colors16.value.replace(/https?:\/\/16colo\.rs\//, ""); }, 0); }); colors16.addEventListener("input", (e) => validate16color(e.target)); // on paste event for github remove the https://github.com/ URL github.addEventListener("paste", () => { setTimeout(() => { - github.value = github.value.replace(/https?:\/\/github.com\//, ""); + github.value = github.value.replace(/https?:\/\/github\.com\//, ""); }, 0); }); github.addEventListener("input", (e) => validateGitHub(e.target)); diff --git a/go.mod b/go.mod index f7daf1a0..894b3a53 100644 --- a/go.mod +++ b/go.mod @@ -23,7 +23,7 @@ require ( github.com/subpop/go-ini v0.1.5 github.com/urfave/cli/v2 v2.27.5 github.com/volatiletech/null/v8 v8.1.2 - github.com/volatiletech/sqlboiler/v4 v4.17.1 + github.com/volatiletech/sqlboiler/v4 v4.18.0 github.com/volatiletech/strmangle v0.0.8 go.uber.org/zap v1.27.0 golang.org/x/image v0.23.0 @@ -73,14 +73,14 @@ require ( go.opentelemetry.io/otel/trace v1.33.0 // indirect go.uber.org/multierr v1.11.0 // indirect golang.org/x/crypto v0.31.0 // indirect - golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 // indirect + golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329 // indirect golang.org/x/net v0.33.0 // indirect - golang.org/x/oauth2 v0.24.0 // indirect + golang.org/x/oauth2 v0.25.0 // indirect golang.org/x/sync v0.10.0 // indirect - golang.org/x/sys v0.28.0 // indirect - golang.org/x/time v0.8.0 // indirect + golang.org/x/sys v0.29.0 // indirect + golang.org/x/time v0.9.0 // indirect golang.org/x/xerrors v0.0.0-20240903120638-7835f813f4da // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d // indirect google.golang.org/grpc v1.69.2 // indirect google.golang.org/protobuf v1.36.1 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index 7c5e60af..2ae2d27e 100644 --- a/go.sum +++ b/go.sum @@ -351,6 +351,7 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/kat-co/vala v0.0.0-20170210184112-42e1d8b61f12/go.mod h1:u9MdXq/QageOOSGp7qG4XAQsYUMP+V5zEel/Vrl6OOc= github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= @@ -519,10 +520,10 @@ github.com/volatiletech/null/v8 v8.1.2 h1:kiTiX1PpwvuugKwfvUNX/SU/5A2KGZMXfGD0DU github.com/volatiletech/null/v8 v8.1.2/go.mod h1:98DbwNoKEpRrYtGjWFctievIfm4n4MxG0A6EBUcoS5g= github.com/volatiletech/randomize v0.0.1 h1:eE5yajattWqTB2/eN8df4dw+8jwAzBtbdo5sbWC4nMk= github.com/volatiletech/randomize v0.0.1/go.mod h1:GN3U0QYqfZ9FOJ67bzax1cqZ5q2xuj2mXrXBjWaRTlY= -github.com/volatiletech/sqlboiler/v4 v4.17.1 h1:3AggaTfY9SLBp7m3H0X2qMXN4OZzGGtCm20BfQ7O88g= -github.com/volatiletech/sqlboiler/v4 v4.17.1/go.mod h1:XgPlHwMabot/eOqvsRnzc4Bw84BJNzizr+ac+T9LTic= +github.com/volatiletech/sqlboiler/v4 v4.18.0 h1:ISz4w94NmJrGAIO3FnYqzD76yYL54Ll61PIfM/c5cdM= +github.com/volatiletech/sqlboiler/v4 v4.18.0/go.mod h1:e4TAZHRyiLwKrHzKS9OuOfc9SJy/AprEMbn+ZrAohO8= github.com/volatiletech/strmangle v0.0.1/go.mod h1:F6RA6IkB5vq0yTG4GQ0UsbbRcl3ni9P76i+JrTBKFFg= -github.com/volatiletech/strmangle v0.0.7-0.20240503230658-86517898275a/go.mod h1:ycDvbDkjDvhC0NUU8w3fWwl5JEMTV56vTKXzR3GeR+0= +github.com/volatiletech/strmangle v0.0.6/go.mod h1:ycDvbDkjDvhC0NUU8w3fWwl5JEMTV56vTKXzR3GeR+0= github.com/volatiletech/strmangle v0.0.8 h1:UZkTDFIjZcL1Lk4BXhGsxcyXxNcWuM5ZwdzZc0sJcWg= github.com/volatiletech/strmangle v0.0.8/go.mod h1:ycDvbDkjDvhC0NUU8w3fWwl5JEMTV56vTKXzR3GeR+0= github.com/xrash/smetrics v0.0.0-20240521201337-686a1a2994c1 h1:gEOO8jv9F4OT7lGCjxCBTO/36wtF6j2nSip77qHd4x4= @@ -596,8 +597,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67 h1:1UoZQm6f0P/ZO0w1Ri+f+ifG/gXhegadRdwBIXEFWDo= -golang.org/x/exp v0.0.0-20241217172543-b2144cdd0a67/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= +golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329 h1:9kj3STMvgqy3YA4VQXBrN7925ICMxD5wzMRcgA30588= +golang.org/x/exp v0.0.0-20250103183323-7d7fa50e5329/go.mod h1:qj5a5QZpwLU2NLQudwIN5koi3beDhSAlJwa67PuM98c= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/image v0.23.0 h1:HseQ7c2OpPKTPVzNjG5fwJsOTCiiwS4QdsYi5XU6H68= @@ -697,8 +698,8 @@ golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ golang.org/x/oauth2 v0.0.0-20220223155221-ee480838109b/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220309155454-6242fa91716a/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5/go.mod h1:DAh4E804XQdzx2j+YRIaUnCqCV2RuMz24cGBJ5QYIrc= -golang.org/x/oauth2 v0.24.0 h1:KTBBxWqUa0ykRPLtV69rRto9TLXcqYkeswu48x/gvNE= -golang.org/x/oauth2 v0.24.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.25.0 h1:CY4y7XT9v0cRI9oupztF8AgiIu99L/ksR/Xp/6jrZ70= +golang.org/x/oauth2 v0.25.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -798,8 +799,8 @@ golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220825204002-c680a09ffe64/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= -golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.29.0 h1:TPYlXGxvx1MGTn2GiZDhnjPA9wZzZeGKHHmKhHYvgaU= +golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= 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/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -816,8 +817,8 @@ golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.8.0 h1:9i3RxcPv3PZnitoVGMPDKZSq1xW1gK1Xy3ArNOGZfEg= -golang.org/x/time v0.8.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= +golang.org/x/time v0.9.0 h1:EsRrnYcQiGH+5FfbgvV4AP7qEZstoyrHB0DzarOQ4ZY= +golang.org/x/time v0.9.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= @@ -1010,8 +1011,8 @@ google.golang.org/genproto v0.0.0-20220421151946-72621c1f0bd3/go.mod h1:8w6bsBMX google.golang.org/genproto v0.0.0-20220429170224-98d788798c3e/go.mod h1:8w6bsBMX6yCPbAVTeqQHvzxW0EIFigd5lZyahWgyfDo= google.golang.org/genproto v0.0.0-20220505152158-f39f71e6c8f3/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= google.golang.org/genproto v0.0.0-20220519153652-3a47de7e79bd/go.mod h1:RAyBrSAP7Fh3Nc84ghnVLDPuV51xc9agzmm4Ph6i0Q4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8 h1:TqExAhdPaB60Ux47Cn0oLV07rGnxZzIsaRhQaqS666A= -google.golang.org/genproto/googleapis/rpc v0.0.0-20241223144023-3abc09e42ca8/go.mod h1:lcTa1sDdWEIHMWlITnIczmw5w60CF9ffkb8Z+DVmmjA= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d h1:xJJRGY7TJcvIlpSrN3K6LAWgNFUILlO+OMAqtg9aqnw= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250102185135-69823020774d/go.mod h1:3ENsm/5D1mzDyhpzeRi1NR784I0BcofWBoSc5QqqMK4= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= diff --git a/handler/htmx/artifact.go b/handler/htmx/artifact.go index 0ea938ce..f8821ab6 100644 --- a/handler/htmx/artifact.go +++ b/handler/htmx/artifact.go @@ -80,9 +80,7 @@ func RecordImageCopier(c echo.Context, debug *zap.SugaredLogger, dirs command.Di if err != nil { return badRequest(c, err) } - if strings.Contains(name, "/") || strings.Contains(name, "\\") || strings.Contains(name, "..") { - return badRequest(c, ErrName) - } + name = filepath.Clean(name) unid := c.Param("unid") tmp, err := helper.MkContent(unid) if err != nil { @@ -110,6 +108,7 @@ func RecordReadmeImager(c echo.Context, logger *zap.SugaredLogger, amigaFont boo if err != nil { return badRequest(c, err) } + name = filepath.Clean(name) unid := c.Param("unid") tmp, err := helper.MkContent(unid) if err != nil { @@ -137,6 +136,7 @@ func RecordDizCopier(c echo.Context, dirs command.Dirs) error { if err != nil { return badRequest(c, err) } + name = filepath.Clean(name) unid := c.Param("unid") tmp, err := helper.MkContent(unid) if err != nil { @@ -165,6 +165,7 @@ func RecordReadmeCopier(c echo.Context, dirs command.Dirs) error { if err != nil { return badRequest(c, err) } + name = filepath.Clean(name) unid := c.Param("unid") tmp, err := helper.MkContent(unid) if err != nil { @@ -216,6 +217,7 @@ func RecordImagesDeleter(c echo.Context, dirs ...string) error { func RecordDizDeleter(c echo.Context, extraDir string) error { unid := c.Param("unid") dst := filepath.Join(extraDir, unid+".diz") + dst = filepath.Clean(dst) st, err := os.Stat(dst) if err != nil { return badRequest(c, err) @@ -233,6 +235,7 @@ func RecordDizDeleter(c echo.Context, extraDir string) error { func RecordReadmeDeleter(c echo.Context, extraDir string) error { unid := c.Param("unid") dst := filepath.Join(extraDir, unid+".txt") + dst = filepath.Clean(dst) st, err := os.Stat(dst) if err != nil { return badRequest(c, err) diff --git a/handler/htmx/transfer.go b/handler/htmx/transfer.go index 42e47ff3..f25fb87d 100644 --- a/handler/htmx/transfer.go +++ b/handler/htmx/transfer.go @@ -665,6 +665,7 @@ func UploadReplacement(c echo.Context, db *sql.DB, downloadDir, extraDir string) return c.HTML(http.StatusInternalServerError, "The database commit failed") } repack := filepath.Join(extraDir, up.unid+".zip") + repack = filepath.Clean(repack) defer os.Remove(repack) if mkc, err := helper.MkContent(abs); err == nil { defer os.RemoveAll(mkc) diff --git a/internal/command/images.go b/internal/command/images.go index c980760f..d10d867b 100644 --- a/internal/command/images.go +++ b/internal/command/images.go @@ -311,6 +311,8 @@ func (dir Dirs) PictureImager(debug *zap.SugaredLogger, src, unid string) error // can be used by the ANSILOVE command to create a PNG image. 80 columns and 29 rows are // works well with a 400x400 pixel thumbnail. func TextCrop(src, dst string) error { + src = filepath.Clean(src) + dst = filepath.Clean(dst) srcFile, err := os.Open(src) if err != nil { return fmt.Errorf("text crop open %w", err) @@ -367,6 +369,7 @@ func TextCrop(src, dst string) error { } func textCropper(src, unid string) (string, error) { + src = filepath.Clean(src) path, err := helper.MkContent(src + "-textimager") if err != nil { return "", fmt.Errorf("make content %w", err) @@ -401,6 +404,7 @@ func (dir Dirs) TextImager(debug *zap.SugaredLogger, src, unid string, amigaFont } func (dir Dirs) textDOSImager(debug *zap.SugaredLogger, src, unid string) error { + src = filepath.Clean(src) args := Args{} args.AnsiMsDos() srcPath, err := textCropper(src, unid) diff --git a/public/css/layout.min.css b/public/css/layout.min.css index afa0e946..225d2c2c 100644 --- a/public/css/layout.min.css +++ b/public/css/layout.min.css @@ -1,2 +1,2 @@ -/* layout.min.css © Defacto2 2024 */ +/* layout.min.css © Defacto2 2025 */ .bi:before{display:inline-block;content:"";vertical-align:-.125em;background-image:url("data:image/svg+xml,");background-repeat:no-repeat;background-size:1rem 1rem}.bi-discord{color:#5865f2}.bi-envelope{color:#d44638}.bi-facebook{color:#3b5998}.bi-mastodon{color:#5a4fdb}.bi-twitter{color:#1da1f2}.bi-youtube{color:#cd201f}@font-face{font-family:font-cascadia-mono;font-display:swap;src:url(/font/CascadiaMono.woff2) format("woff2"),url(/font/CascadiaMono.woff) format("woff"),url(/font/CascadiaMono.ttf) format("truetype")}.font-cascadia-mono{font-family:font-cascadia-mono,sans-serif;font-size:1em;font-style:normal;font-weight:400}@font-face{font-family:font-vga-eight;font-display:swap;src:url(/font/pxplus_ibm_vga8.woff2) format("woff2"),url(/font/pxplus_ibm_vga8.woff) format("woff"),url(/font/pxplus_ibm_vga8.ttf) format("truetype")}.font-dos{font-family:font-vga-eight,monospace;font-style:normal;font-weight:400;line-height:1}@font-face{font-family:font-topaz-two;font-display:swap;src:url(/font/topazplus_a1200.woff2) format("woff2"),url(/font/topazplus_a1200.woff) format("woff"),url(/font/topazplus_a1200.ttf) format("truetype")}.font-amiga{font-family:font-topaz-two,font-vga-eight,monospace;font-size:1em;font-style:normal;font-weight:400}.pre-wrap{white-space:pre-wrap}.reader{font-size:133%;line-height:1;white-space:pre-wrap;hyphens:manual}#logo-container{container-type:inline-size;container-name:cardcontainer}#logo-text{overflow:hidden}.reader-invert{background-color:#000;color:#fff}@container cardcontainer (width > 575px){pre{font-size:100%}}@container cardcontainer (width < 576px){pre{font-size:.75rem}}@container cardcontainer (width < 422px){pre{font-size:.5rem}}.input-date::placeholder{opacity:.3;color:red}canvas,.dosbox-container{width:100%;height:100%;margin:0;padding:0;overflow:hidden} diff --git a/public/js/editor-artifact.min.js b/public/js/editor-artifact.min.js index 7c649e75..01aa8bc0 100644 --- a/public/js/editor-artifact.min.js +++ b/public/js/editor-artifact.min.js @@ -1,2 +1,2 @@ -/* editor-artifact.min.js © Defacto2 2024 */ -(()=>{function F(e,i,r){if(e==null)throw new Error("The year input element is null.");if(i==null)throw new Error("The month input element is null.");if(r==null)throw new Error("The day input element is null.");e.classList.remove("is-invalid","is-valid"),i.classList.remove("is-invalid","is-valid"),r.classList.remove("is-invalid","is-valid");let l=parseInt(e.value,10);isNaN(l)?e.value="0":e.value=l;let n=parseInt(i.value,10);isNaN(n)?i.value="0":i.value=n;let a=parseInt(r.value,10);isNaN(a)?r.value="0":r.value=a;let s=0,p=new Date().getFullYear(),g=l>=1980&&l<=p;l>s&&!g&&e.classList.add("is-invalid");let I=n>=1&&n<=12;n>s&&!I&&i.classList.add("is-invalid");let E=a>=1&&a<=31;a>s&&!E&&r.classList.add("is-invalid"),isNaN(l)&&(I||E)&&e.classList.add("is-invalid"),(n==s||isNaN(n))&&E&&i.classList.add("is-invalid")}function ye(e){return Be(e,!0)}function be(e){return Be(e,!1)}function Be(e,i){if(e==null)throw new Error("The repository URL element is null.");e.classList.remove("is-valid","is-invalid");let r=e.value.trim();if(r.length===0)return;if(i==!0&&r.startsWith("refs/")){e.classList.add("is-invalid");return}if(r.includes("://")){e.classList.add("is-invalid");return}let n=/[^A-Za-z0-9-._/]/g;r=r.replace(n,""),r=r.replaceAll("//","/");let a=/^\//;r=r.replace(a,""),e.value=r;let s=e.getAttribute("maxlength");if(s===null)throw new Error(`The maxlength attribute is required for ${e.id}.`);if(r.length>s){e.classList.add("is-invalid");return}}function q(e){if(e==null)throw new Error("The element of the releaser validator is null.");e.classList.remove("is-valid","is-invalid");let i=e.value.trimStart().toUpperCase();i=i.replace("+",", "),i=i.replace(/[^ A-ZÀ-ÖØ-Þ0-9\-,&]/g,""),i=i.replace(/[ ]{2,}/g," "),e.value=i;let r=e.getAttribute("minlength"),l=e.getAttribute("maxlength"),n=e.getAttribute("required");if(r===null)throw new Error(`The minlength attribute is required for ${e.id}.`);if(l===null)throw new Error(`The maxlength attribute is required for ${e.id}.`);let a=document.getElementById("artifact-editor-releasers-error");if(a===null)throw new Error("The releasers error element is null.");let s=i.lengthl;if(n!=null&&s){e.classList.add("is-invalid"),e.id==="-1"&&a.classList.add("d-block");return}let p=i.length>0&&(i.lengthl);if(n==null&&p){e.classList.add("is-invalid");return}e.classList.remove("is-invalid"),a.classList.remove("d-block")}function Te(e){if(e==null)throw new Error("The element of the releaser validator is null.");e.classList.remove("is-valid","is-invalid");let i=e.value.trim();i.length>0&&i.length!=11&&e.classList.add("is-invalid")}function Z(e,i){if(e==null)throw new Error("The element of the number validator is null.");e.classList.remove("is-valid","is-invalid");let r=parseInt(e.value,10);isNaN(r)&&e.classList.add("is-invalid"),(r>i||r<0)&&e.classList.add("is-invalid")}function ke(e){e.preventDefault();let i=(e.clipboardData||window.Clipboard).getData("text"),r=this,l=r.selectionStart,n=r.selectionEnd;r.value=r.value.slice(0,l)+i+r.value.slice(n),r.setSelectionRange(l+i.length,l+i.length);let a=H(r.value);r.value!=a&&(console.log('Formatted input text "%s" is formatted to "%s".',r.value,a),r.value=a)}function H(e){let i=["a","addon","aka","an","and","as","at","beta","betas","but","by","compatibility","crack","cracks","demo","demos","doc","docs","documentation","fix","fixes","for","final","from","if","in","installer","installers","is","hint","hints","map","maps","mod","mods","of","on","or","patch","patches","part","prerelease","prereleases","preview","previews","proper","release","releases","repack","repacks","rip","rips","so","solve","solves","the","trainer","trainers","to","update","updates","unprotect","unprotects","vs","with"],r=[".com",".exe","2d","3d","4d","abc","ad&d","api","bbs","bios","bsa","cd","cga","dos","dox","dvd","ega","ehq","f1","fbi","ftp","hd","hq","ibm","id","iso","la","lego","ls","masm","mbl","ms","mtv","nascar","nba","ncaa","nfl","nsa","nfo","nhl","nt","oem","os","pc","pga","ppe","pfs","pkarc","pkzip","psx","rac","rom","sdk","sfx","spa","tv","ufo","usa","ushq","uss","vga","whq","ww1","ww2","ww3","wwf","xp","ys"];e=e.trim(),e=e.replace(/_/g," "),e.match(/\./g)&&e.match(/\./g).length>4&&(e=e.replace(/\./g," ")),e=e.replace(/['"`]/g,""),e=e.replace(/ \([0-9a-z]\)/g,""),e=e.replace(/([a-zA-Z0-9]): /g,"$1 : "),e=e.replace(/([xX][-| ][Mm]en)/g,"X-Men"),e=e.replace(/\(/g,"( "),e=e.replace(/\)/g," )");let l=e.split(" ").length;return e=e.split(" ").map((n,a)=>{var s=n;if(Re(s)===!0)return s.toLowerCase();if(r.includes(s.toLowerCase()))return s.toUpperCase();let p=Fe(s);if(p!=="")return p;let g=Ue(s);a>0&&Number.isInteger(g)&&(s=`${g}`);let I=Me(s,a,l);return I!==s&&(s=I),n!==s?s:a===0||!i.includes(s.toLowerCase())?s.charAt(0).toUpperCase()+s.slice(1).toLowerCase():n.toLowerCase()}).join(" ").trim(),e=e.replace(/(Lotus 123)/g,"Lotus 1-2-3"),e=e.replace(/(Falcon at )/g,"Falcon AT "),e=e.replace(/(the Games)/g,"The Games"),e=e.replace(/^(Unprotect for )(.+)/,"$2 unprotect"),e=e.replace(/^(Unprotecting )(.+)/,"$2 unprotect"),e=e.replace(/^(Unprotect )(.+)/,"$2 unprotect"),e=e.replace(/( : a)/g," : A"),e=e.replace(/( - a)/g," - A"),e=e.replace(/( : t)/g," : T"),e=e.replace(/( - t)/g," - T"),e=e.replace(/(f-)/g,"F-"),e=e.replace(/(3-d)/g,"3D"),e=e.replace(/(Pfs-)/g,"PFS-"),e=e.replace(/(Mean-18)/g,"Mean 18"),e=e.replace(/(v\d+)\.0/g,"$1"),e=e.replace(/\( /g,"("),e=e.replace(/ \)/g,")"),e=e.replace(/\[([^)]+)\]/g,function(n){return n.toUpperCase()}),e}function Re(e){return/^[vV]\d+(\.\d+)?[a-z]?$/i.test(e)}function Me(e,i,r){return i!=r-1?e:["cheat","cheater","cracktro","loader","installer","trainer","version"].includes(e.toLowerCase())?"":e}function Ue(e){let i={I:1,V:5,X:10},r=0,l=0;for(let n=e.length-1;n>=0;n--){let a=i[e[n].toUpperCase()];aa?`${(Math.round(e*100/a)/100).toFixed(2)} GB`:e>n?`${(Math.round(e*100/n)/100).toFixed(1)} MB`:e>1e3?`${(Math.round(e*100/1e3)/100).toFixed()} kB`:`${Math.round(e).toFixed()} bytes`}(()=>{"use strict";function e(t){return function(){t.forEach(o=>{o.disabled=!0,o.classList.remove("btn-outline-primary"),o.classList.add("btn-light")})}}function i(t){return function(){t.forEach(o=>{o.disabled=!1,o.classList.remove("btn-light"),o.classList.add("btn-outline-primary")})}}let r=document.getElementById("artifact-editor-modal"),l=document.getElementsByName("artifact-editor-dataeditor");r.addEventListener("shown.bs.modal",()=>{e(l)()}),r.addEventListener("hidden.bs.modal",()=>{i(l)()});let n=document.getElementById("asset-editor-modal"),a=document.getElementsByName("artifact-editor-fileeditor");n.addEventListener("shown.bs.modal",()=>{e(a)()}),n.addEventListener("hidden.bs.modal",()=>{i(a)()});let s=document.getElementById("emulate-editor-modal"),p=document.getElementsByName("artifact-editor-emueditor");s.addEventListener("shown.bs.modal",()=>{e(p)()}),s.addEventListener("hidden.bs.modal",()=>{i(p)()});let g=document.getElementById("emulate-run-program");if(g!==null){let t=document.getElementById("emulate-guess-program");if(t===null)throw new Error("The guess program input is missing.");g.addEventListener("input",()=>{if(g.value=g.value.toUpperCase(),g.value!==""){t.disabled=!0;return}t.disabled=!1})}if(c("artifact-dataeditor-key-value")===null)throw new Error("The key value is missing.");let E=c("artifact-dataeditor-key-label");if(E===null)throw new Error("The key label is missing.");if(E.addEventListener("click",()=>k("artifact-dataeditor-key-value")),c("artifact-fileeditor-key-value")===null)throw new Error("The key value is missing.");let Ie=c("artifact-fileeditor-key-label");if(E===null)throw new Error("The key label is missing.");if(Ie.addEventListener("click",()=>k("artifact-fileeditor-key-value")),c("artifact-dataeditor-unique-id-value")===null)throw new Error("The unique id value is missing.");let K=c("artifact-dataeditor-unique-id-label");if(K===null)throw new Error("The unique id label is missing.");if(K.addEventListener("click",()=>k("artifact-dataeditor-unique-id-value")),c("artifact-fileeditor-unique-id-value")===null)throw new Error("The unique id value is missing.");let _=c("artifact-fileeditor-unique-id-label");if(_===null)throw new Error("The unique id label is missing.");if(_.addEventListener("click",()=>k("artifact-fileeditor-unique-id-value")),c("artifact-editor-location-value")===null)throw new Error("The location value is missing.");let J=c("artifact-editor-location-label");if(J===null)throw new Error("The location label is missing.");J.addEventListener("click",()=>k("artifact-editor-location-value"));let Q=c("artifact-editor-templocation");if(Q!=null){let t=c("artifact-editor-templocation-label");t!==null&&t.addEventListener("click",()=>k("artifact-editor-templocation"))}if(document.getElementById("artifact-editor-os-label")===null)throw new Error("The operating system label is missing.");let L=document.getElementById("artifact-editor-operating-system");if(L===null)throw new Error("The operating system input is missing.");L.addEventListener("input",P);let y=document.getElementById("artifact-editor-category");if(y===null)throw new Error("The category input is missing.");y.addEventListener("input",S),P(),S();function P(){L.selectedIndex==0&&(L.classList.remove("is-valid"),L.classList.add("is-invalid"))}function S(){y.selectedIndex==0&&(y.classList.remove("is-valid"),y.classList.add("is-invalid"))}let z=document.getElementsByName("prereset-classifications");if(z.length===0)throw new Error("The preset classifications are missing.");for(let t=0;t{A.preventDefault(),L.value=h,L.classList.remove("is-invalid"),y.value=f,y.classList.remove("is-invalid"),P(),S()})}let w=document.getElementById("artifact-editor-filename");if(w===null)throw new Error("The filename input is missing.");w.addEventListener("input",t=>{t.target.classList.remove("is-valid"),t.target.classList.remove("is-invalid"),t.target.value.trim().length===0&&t.target.classList.add("is-invalid")});let ee=document.getElementById("artifact-editor-filename-reset");if(ee===null)throw new Error("The filename reset is missing.");let Y=document.getElementsByName("artifact-editor-filename-undo");if(Y.length===0)throw new Error("The filename resetter is missing.");ee.addEventListener("click",()=>{if(w.classList.remove("is-valid"),Y.length===0)throw new Error("The filename resetter is missing.");w.value=Y[0].value,w.classList.add("is-valid"),w.classList.remove("is-invalid"),w.value.trim().length===0&&w.classList.add("is-invalid")});let D=document.getElementById("artifact-editor-releaser-1");if(D===null)throw new Error("The releaser 1 input is missing.");D.addEventListener("input",t=>q(t.target));let $=document.getElementById("artifact-editor-releaser-2");if($===null)throw new Error("The releaser 2 input is missing.");$.addEventListener("input",t=>q(t.target));let te=document.getElementById("artifact-editor-releaser-undo");if(te===null)throw new Error("The releasers reset is missing.");te.addEventListener("click",Ae);function Ae(){let t=D.getAttribute("data-reset-rel1");if(t===null)throw new Error("data-reset-rel1 attribute is required for artifact-editor-releaser-1.");D.value=t,q(D);let o=$.getAttribute("data-reset-rel2");if(o===null)throw new Error("data-reset-rel2 attribute is required for artifact-editor-releaser-2.");$.value=o,q($)}let u=document.getElementById("artifact-editor-title");if(u===null)throw new Error("The title input is missing.");u.addEventListener("paste",ke),u.addEventListener("input",t=>{t.target.classList.remove("is-valid")});let re=document.getElementById("artifact-editor-title-undo");if(re===null)throw new Error("The title reset is missing.");let x=document.getElementsByName("artifact-editor-titleundo");if(x.length===0)throw new Error("The title resetter is missing.");re.addEventListener("click",()=>{if(u.classList.remove("is-valid"),x.length===0)throw new Error("The title resetter is missing.");u.value=x[0].value,u.classList.add("is-valid")});let ie=document.getElementById("artifact-editor-titleize");if(ie.length===0)throw new Error("The titleize button is missing.");ie.addEventListener("click",()=>{u.value=H(u.value);let t=new Event("keyup");u.dispatchEvent(t)});let ne=document.getElementById("artifact-editor-title-delete");if(ne.length===0)throw new Error("The title delete button is missing.");ne.addEventListener("click",()=>{u.value="";let t=new Event("keyup");u.dispatchEvent(t)});let V=document.getElementById("artifact-editor-credit-text");if(V===null)throw new Error("The creator text input is missing.");V.addEventListener("input",t=>{t.target.classList.remove("is-valid")});let j=document.getElementById("artifact-editor-credit-ill");if(j===null)throw new Error("The creator illustrator input is missing.");j.addEventListener("input",t=>{t.target.classList.remove("is-valid")});let G=document.getElementById("artifact-editor-credit-prog");if(G===null)throw new Error("The creator programmer input is missing.");G.addEventListener("input",t=>{t.target.classList.remove("is-valid")});let O=document.getElementById("artifact-editor-credit-audio");if(O===null)throw new Error("The creator audio input is missing.");O.addEventListener("input",t=>{t.target.classList.remove("is-valid")});let W=document.getElementById("artifact-editor-credits-undo");if(W===null)throw new Error("The creator resetter is missing.");let ae=document.getElementById("artifact-editor-credit-undo");if(ae===null)throw new Error("The creator reset is missing.");ae.addEventListener("click",()=>{if(W.length===0)throw new Error("The creator resetter is missing.");let t=W.value.split(";");if(t.length!=4)throw new Error("The creator resetter values are invalid.");let o=t[0],h=t[1],f=t[2],A=t[3];V.value=o,j.value=h,G.value=f,O.value=A});let se=document.getElementById("artifact-editor-virustotal");if(se===null)throw new Error("The virustotal input is missing.");se.addEventListener("input",t=>{t.target.classList.remove("is-valid","is-invalid");let o=t.target.value.trim();o.length!=0&&(o.startsWith("https://www.virustotal.com/")||t.target.classList.add("is-invalid"))});let d=document.getElementById("artifact-editor-year");if(d===null)throw new Error("The year input is missing.");d.addEventListener("input",()=>{let t=parseInt(d.value,10);t>=79&&t<=99&&(d.value=1900+t),F(d,m,v)});let m=document.getElementById("artifact-editor-month");if(m===null)throw new Error("The month input is missing.");m.addEventListener("input",()=>{F(d,m,v)});let v=document.getElementById("artifact-editor-day");if(v===null)throw new Error("The day input is missing.");v.addEventListener("input",()=>{F(d,m,v)});let oe=document.getElementById("artifact-editor-date-reset");if(oe===null)throw new Error("The date reset is missing.");let le=document.getElementById("artifact-editor-date-resetter");if(le===null)throw new Error("The date resetter is missing.");oe.addEventListener("click",()=>{d.classList.remove("is-invalid","is-valid"),m.classList.remove("is-invalid","is-valid"),v.classList.remove("is-invalid","is-valid");let o=le.value.split("-");if(o.length!=3)throw new Error("The date resetter values are invalid.");d.value=o[0],m.value=o[1],v.value=o[2]});let N=document.getElementById("artifact-editor-comment");if(N===null)throw new Error("The comment input is missing.");N.addEventListener("input",t=>{if(t.target.classList.remove("is-valid"),(d.value==0&&m.value==0&&v.value==0)==!1)return;let f=/(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/(\d{2})/.exec(t.target.value);if(f||(f=/(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])-(\d{2})/.exec(t.target.value)),f){let A=f[1],qe=f[2],Ne=f[3],U=parseInt(Ne,10);d.value=2e3+U,U>=79&&U<=99&&(d.value=1900+U),m.value=A,v.value=qe;let Le=document.getElementById("artifact-editor-date-update");Le!==null&&Le.click()}});let de=document.getElementById("artifact-editor-comment-undo");if(de===null)throw new Error("The comment reset is missing.");let ce=document.getElementById("artifact-editor-comment-resetter");if(ce===null)throw new Error("The comment resetter is missing.");de.addEventListener("click",()=>{N.classList.remove("is-valid"),N.value=ce.value});let ue=document.getElementById("artifact-editor-date-lastmod");if(ue!==null){let t=document.getElementById("artifact-editor-date-lastmodder");if(t===null)throw new Error("The date last modder input is missing.");ue.addEventListener("click",()=>{d.classList.remove("is-invalid","is-valid"),m.classList.remove("is-invalid","is-valid"),v.classList.remove("is-invalid","is-valid");let h=t.value.split("-");if(h.length!=3)throw new Error("The date last modder values are invalid.");d.value=h[0],m.value=h[1],v.value=h[2]})}let me=document.getElementById("artifact-editor-links-reset");if(me===null)throw new Error("The links reset is missing.");let b=document.getElementById("artifact-editor-youtube"),ve=document.getElementById("artifact-editor-youtube-reset");if(b===null||ve===null)throw new Error("A YouTube input is missing.");let R=document.getElementById("artifact-editor-demozoo"),fe=document.getElementById("artifact-editor-demozoo-reset");if(R===null||fe===null)throw new Error("A Demozoo input is missing.");let M=document.getElementById("artifact-editor-pouet"),ge=document.getElementById("artifact-editor-pouet-reset");if(M===null||ge===null)throw new Error("A Pouet input is missing.");let B=document.getElementById("artifact-editor-16colors"),he=document.getElementById("artifact-editor-16colors-reset");if(B===null||he===null)throw new Error("A 16colors input is missing.");let T=document.getElementById("artifact-editor-github"),pe=document.getElementById("artifact-editor-github-reset");if(T===null||pe===null)throw new Error("A GitHub input is missing.");let X=document.getElementById("artifact-editor-relations"),we=document.getElementById("artifact-editor-relations-reset");if(X===null||we===null)throw new Error("A relations input is missing.");let C=document.getElementById("artifact-editor-websites"),Ee=document.getElementById("artifact-editor-websites-reset");if(C===null||Ee===null)throw new Error("A websites input is missing.");C.addEventListener("paste",()=>{setTimeout(()=>{C.value=C.value.replace(/https?:\/\//,"")},0)}),me.addEventListener("click",()=>{b.classList.remove("is-invalid","is-valid"),R.classList.remove("is-invalid","is-valid"),M.classList.remove("is-invalid","is-valid"),B.classList.remove("is-invalid","is-valid"),T.classList.remove("is-invalid","is-valid"),X.classList.remove("is-invalid","is-valid"),C.classList.remove("is-invalid","is-valid"),b.value=ve.value,R.value=fe.value,M.value=ge.value,B.value=he.value,T.value=pe.value,X.value=we.value,C.value=Ee.value});let De=45e4,$e=2e5;b.addEventListener("paste",()=>{setTimeout(()=>{b.value=b.value.replace(/https?:\/\/www.youtube.com\/watch\?v=/,"")},0)}),b.addEventListener("input",t=>Te(t.target)),R.addEventListener("input",t=>Z(t.target,De)),M.addEventListener("input",t=>Z(t.target,$e)),B.addEventListener("paste",()=>{setTimeout(()=>{B.value=B.value.replace(/https?:\/\/16colo.rs\//,"")},0)}),B.addEventListener("input",t=>be(t.target)),T.addEventListener("paste",()=>{setTimeout(()=>{T.value=T.value.replace(/https?:\/\/github.com\//,"")},0)}),T.addEventListener("input",t=>ye(t.target))})();})(); +/* editor-artifact.min.js © Defacto2 2025 */ +(()=>{function F(e,i,r){if(e==null)throw new Error("The year input element is null.");if(i==null)throw new Error("The month input element is null.");if(r==null)throw new Error("The day input element is null.");e.classList.remove("is-invalid","is-valid"),i.classList.remove("is-invalid","is-valid"),r.classList.remove("is-invalid","is-valid");let l=parseInt(e.value,10);isNaN(l)?e.value="0":e.value=l;let n=parseInt(i.value,10);isNaN(n)?i.value="0":i.value=n;let a=parseInt(r.value,10);isNaN(a)?r.value="0":r.value=a;let s=0,p=new Date().getFullYear(),g=l>=1980&&l<=p;l>s&&!g&&e.classList.add("is-invalid");let I=n>=1&&n<=12;n>s&&!I&&i.classList.add("is-invalid");let E=a>=1&&a<=31;a>s&&!E&&r.classList.add("is-invalid"),isNaN(l)&&(I||E)&&e.classList.add("is-invalid"),(n==s||isNaN(n))&&E&&i.classList.add("is-invalid")}function ye(e){return Be(e,!0)}function be(e){return Be(e,!1)}function Be(e,i){if(e==null)throw new Error("The repository URL element is null.");e.classList.remove("is-valid","is-invalid");let r=e.value.trim();if(r.length===0)return;if(i==!0&&r.startsWith("refs/")){e.classList.add("is-invalid");return}if(r.includes("://")){e.classList.add("is-invalid");return}let n=/[^A-Za-z0-9-._/]/g;r=r.replace(n,""),r=r.replaceAll("//","/");let a=/^\//;r=r.replace(a,""),e.value=r;let s=e.getAttribute("maxlength");if(s===null)throw new Error(`The maxlength attribute is required for ${e.id}.`);if(r.length>s){e.classList.add("is-invalid");return}}function q(e){if(e==null)throw new Error("The element of the releaser validator is null.");e.classList.remove("is-valid","is-invalid");let i=e.value.trimStart().toUpperCase();i=i.replace("+",", "),i=i.replace(/[^ A-ZÀ-ÖØ-Þ0-9\-,&]/g,""),i=i.replace(/[ ]{2,}/g," "),e.value=i;let r=e.getAttribute("minlength"),l=e.getAttribute("maxlength"),n=e.getAttribute("required");if(r===null)throw new Error(`The minlength attribute is required for ${e.id}.`);if(l===null)throw new Error(`The maxlength attribute is required for ${e.id}.`);let a=document.getElementById("artifact-editor-releasers-error");if(a===null)throw new Error("The releasers error element is null.");let s=i.lengthl;if(n!=null&&s){e.classList.add("is-invalid"),e.id==="-1"&&a.classList.add("d-block");return}let p=i.length>0&&(i.lengthl);if(n==null&&p){e.classList.add("is-invalid");return}e.classList.remove("is-invalid"),a.classList.remove("d-block")}function Te(e){if(e==null)throw new Error("The element of the releaser validator is null.");e.classList.remove("is-valid","is-invalid");let i=e.value.trim();i.length>0&&i.length!=11&&e.classList.add("is-invalid")}function Z(e,i){if(e==null)throw new Error("The element of the number validator is null.");e.classList.remove("is-valid","is-invalid");let r=parseInt(e.value,10);isNaN(r)&&e.classList.add("is-invalid"),(r>i||r<0)&&e.classList.add("is-invalid")}function ke(e){e.preventDefault();let i=(e.clipboardData||window.Clipboard).getData("text"),r=this,l=r.selectionStart,n=r.selectionEnd;r.value=r.value.slice(0,l)+i+r.value.slice(n),r.setSelectionRange(l+i.length,l+i.length);let a=H(r.value);r.value!=a&&(console.log('Formatted input text "%s" is formatted to "%s".',r.value,a),r.value=a)}function H(e){let i=["a","addon","aka","an","and","as","at","beta","betas","but","by","compatibility","crack","cracks","demo","demos","doc","docs","documentation","fix","fixes","for","final","from","if","in","installer","installers","is","hint","hints","map","maps","mod","mods","of","on","or","patch","patches","part","prerelease","prereleases","preview","previews","proper","release","releases","repack","repacks","rip","rips","so","solve","solves","the","trainer","trainers","to","update","updates","unprotect","unprotects","vs","with"],r=[".com",".exe","2d","3d","4d","abc","ad&d","api","bbs","bios","bsa","cd","cga","dos","dox","dvd","ega","ehq","f1","fbi","ftp","hd","hq","ibm","id","iso","la","lego","ls","masm","mbl","ms","mtv","nascar","nba","ncaa","nfl","nsa","nfo","nhl","nt","oem","os","pc","pga","ppe","pfs","pkarc","pkzip","psx","rac","rom","sdk","sfx","spa","tv","ufo","usa","ushq","uss","vga","whq","ww1","ww2","ww3","wwf","xp","ys"];e=e.trim(),e=e.replace(/_/g," "),e.match(/\./g)&&e.match(/\./g).length>4&&(e=e.replace(/\./g," ")),e=e.replace(/['"`]/g,""),e=e.replace(/ \([0-9a-z]\)/g,""),e=e.replace(/([a-zA-Z0-9]): /g,"$1 : "),e=e.replace(/([xX][-| ][Mm]en)/g,"X-Men"),e=e.replace(/\(/g,"( "),e=e.replace(/\)/g," )");let l=e.split(" ").length;return e=e.split(" ").map((n,a)=>{var s=n;if(Re(s)===!0)return s.toLowerCase();if(r.includes(s.toLowerCase()))return s.toUpperCase();let p=Fe(s);if(p!=="")return p;let g=Ue(s);a>0&&Number.isInteger(g)&&(s=`${g}`);let I=Me(s,a,l);return I!==s&&(s=I),n!==s?s:a===0||!i.includes(s.toLowerCase())?s.charAt(0).toUpperCase()+s.slice(1).toLowerCase():n.toLowerCase()}).join(" ").trim(),e=e.replace(/(Lotus 123)/g,"Lotus 1-2-3"),e=e.replace(/(Falcon at )/g,"Falcon AT "),e=e.replace(/(the Games)/g,"The Games"),e=e.replace(/^(Unprotect for )(.+)/,"$2 unprotect"),e=e.replace(/^(Unprotecting )(.+)/,"$2 unprotect"),e=e.replace(/^(Unprotect )(.+)/,"$2 unprotect"),e=e.replace(/( : a)/g," : A"),e=e.replace(/( - a)/g," - A"),e=e.replace(/( : t)/g," : T"),e=e.replace(/( - t)/g," - T"),e=e.replace(/(f-)/g,"F-"),e=e.replace(/(3-d)/g,"3D"),e=e.replace(/(Pfs-)/g,"PFS-"),e=e.replace(/(Mean-18)/g,"Mean 18"),e=e.replace(/(v\d+)\.0/g,"$1"),e=e.replace(/\( /g,"("),e=e.replace(/ \)/g,")"),e=e.replace(/\[([^)]+)\]/g,function(n){return n.toUpperCase()}),e}function Re(e){return/^[vV]\d+(\.\d+)?[a-z]?$/i.test(e)}function Me(e,i,r){return i!=r-1?e:["cheat","cheater","cracktro","loader","installer","trainer","version"].includes(e.toLowerCase())?"":e}function Ue(e){let i={I:1,V:5,X:10},r=0,l=0;for(let n=e.length-1;n>=0;n--){let a=i[e[n].toUpperCase()];aa?`${(Math.round(e*100/a)/100).toFixed(2)} GB`:e>n?`${(Math.round(e*100/n)/100).toFixed(1)} MB`:e>1e3?`${(Math.round(e*100/1e3)/100).toFixed()} kB`:`${Math.round(e).toFixed()} bytes`}(()=>{"use strict";function e(t){return function(){t.forEach(o=>{o.disabled=!0,o.classList.remove("btn-outline-primary"),o.classList.add("btn-light")})}}function i(t){return function(){t.forEach(o=>{o.disabled=!1,o.classList.remove("btn-light"),o.classList.add("btn-outline-primary")})}}let r=document.getElementById("artifact-editor-modal"),l=document.getElementsByName("artifact-editor-dataeditor");r.addEventListener("shown.bs.modal",()=>{e(l)()}),r.addEventListener("hidden.bs.modal",()=>{i(l)()});let n=document.getElementById("asset-editor-modal"),a=document.getElementsByName("artifact-editor-fileeditor");n.addEventListener("shown.bs.modal",()=>{e(a)()}),n.addEventListener("hidden.bs.modal",()=>{i(a)()});let s=document.getElementById("emulate-editor-modal"),p=document.getElementsByName("artifact-editor-emueditor");s.addEventListener("shown.bs.modal",()=>{e(p)()}),s.addEventListener("hidden.bs.modal",()=>{i(p)()});let g=document.getElementById("emulate-run-program");if(g!==null){let t=document.getElementById("emulate-guess-program");if(t===null)throw new Error("The guess program input is missing.");g.addEventListener("input",()=>{if(g.value=g.value.toUpperCase(),g.value!==""){t.disabled=!0;return}t.disabled=!1})}if(c("artifact-dataeditor-key-value")===null)throw new Error("The key value is missing.");let E=c("artifact-dataeditor-key-label");if(E===null)throw new Error("The key label is missing.");if(E.addEventListener("click",()=>k("artifact-dataeditor-key-value")),c("artifact-fileeditor-key-value")===null)throw new Error("The key value is missing.");let Ie=c("artifact-fileeditor-key-label");if(E===null)throw new Error("The key label is missing.");if(Ie.addEventListener("click",()=>k("artifact-fileeditor-key-value")),c("artifact-dataeditor-unique-id-value")===null)throw new Error("The unique id value is missing.");let K=c("artifact-dataeditor-unique-id-label");if(K===null)throw new Error("The unique id label is missing.");if(K.addEventListener("click",()=>k("artifact-dataeditor-unique-id-value")),c("artifact-fileeditor-unique-id-value")===null)throw new Error("The unique id value is missing.");let _=c("artifact-fileeditor-unique-id-label");if(_===null)throw new Error("The unique id label is missing.");if(_.addEventListener("click",()=>k("artifact-fileeditor-unique-id-value")),c("artifact-editor-location-value")===null)throw new Error("The location value is missing.");let J=c("artifact-editor-location-label");if(J===null)throw new Error("The location label is missing.");J.addEventListener("click",()=>k("artifact-editor-location-value"));let Q=c("artifact-editor-templocation");if(Q!=null){let t=c("artifact-editor-templocation-label");t!==null&&t.addEventListener("click",()=>k("artifact-editor-templocation"))}if(document.getElementById("artifact-editor-os-label")===null)throw new Error("The operating system label is missing.");let L=document.getElementById("artifact-editor-operating-system");if(L===null)throw new Error("The operating system input is missing.");L.addEventListener("input",P);let y=document.getElementById("artifact-editor-category");if(y===null)throw new Error("The category input is missing.");y.addEventListener("input",S),P(),S();function P(){L.selectedIndex==0&&(L.classList.remove("is-valid"),L.classList.add("is-invalid"))}function S(){y.selectedIndex==0&&(y.classList.remove("is-valid"),y.classList.add("is-invalid"))}let z=document.getElementsByName("prereset-classifications");if(z.length===0)throw new Error("The preset classifications are missing.");for(let t=0;t{A.preventDefault(),L.value=h,L.classList.remove("is-invalid"),y.value=f,y.classList.remove("is-invalid"),P(),S()})}let w=document.getElementById("artifact-editor-filename");if(w===null)throw new Error("The filename input is missing.");w.addEventListener("input",t=>{t.target.classList.remove("is-valid"),t.target.classList.remove("is-invalid"),t.target.value.trim().length===0&&t.target.classList.add("is-invalid")});let ee=document.getElementById("artifact-editor-filename-reset");if(ee===null)throw new Error("The filename reset is missing.");let Y=document.getElementsByName("artifact-editor-filename-undo");if(Y.length===0)throw new Error("The filename resetter is missing.");ee.addEventListener("click",()=>{if(w.classList.remove("is-valid"),Y.length===0)throw new Error("The filename resetter is missing.");w.value=Y[0].value,w.classList.add("is-valid"),w.classList.remove("is-invalid"),w.value.trim().length===0&&w.classList.add("is-invalid")});let D=document.getElementById("artifact-editor-releaser-1");if(D===null)throw new Error("The releaser 1 input is missing.");D.addEventListener("input",t=>q(t.target));let $=document.getElementById("artifact-editor-releaser-2");if($===null)throw new Error("The releaser 2 input is missing.");$.addEventListener("input",t=>q(t.target));let te=document.getElementById("artifact-editor-releaser-undo");if(te===null)throw new Error("The releasers reset is missing.");te.addEventListener("click",Ae);function Ae(){let t=D.getAttribute("data-reset-rel1");if(t===null)throw new Error("data-reset-rel1 attribute is required for artifact-editor-releaser-1.");D.value=t,q(D);let o=$.getAttribute("data-reset-rel2");if(o===null)throw new Error("data-reset-rel2 attribute is required for artifact-editor-releaser-2.");$.value=o,q($)}let u=document.getElementById("artifact-editor-title");if(u===null)throw new Error("The title input is missing.");u.addEventListener("paste",ke),u.addEventListener("input",t=>{t.target.classList.remove("is-valid")});let re=document.getElementById("artifact-editor-title-undo");if(re===null)throw new Error("The title reset is missing.");let x=document.getElementsByName("artifact-editor-titleundo");if(x.length===0)throw new Error("The title resetter is missing.");re.addEventListener("click",()=>{if(u.classList.remove("is-valid"),x.length===0)throw new Error("The title resetter is missing.");u.value=x[0].value,u.classList.add("is-valid")});let ie=document.getElementById("artifact-editor-titleize");if(ie.length===0)throw new Error("The titleize button is missing.");ie.addEventListener("click",()=>{u.value=H(u.value);let t=new Event("keyup");u.dispatchEvent(t)});let ne=document.getElementById("artifact-editor-title-delete");if(ne.length===0)throw new Error("The title delete button is missing.");ne.addEventListener("click",()=>{u.value="";let t=new Event("keyup");u.dispatchEvent(t)});let V=document.getElementById("artifact-editor-credit-text");if(V===null)throw new Error("The creator text input is missing.");V.addEventListener("input",t=>{t.target.classList.remove("is-valid")});let j=document.getElementById("artifact-editor-credit-ill");if(j===null)throw new Error("The creator illustrator input is missing.");j.addEventListener("input",t=>{t.target.classList.remove("is-valid")});let G=document.getElementById("artifact-editor-credit-prog");if(G===null)throw new Error("The creator programmer input is missing.");G.addEventListener("input",t=>{t.target.classList.remove("is-valid")});let O=document.getElementById("artifact-editor-credit-audio");if(O===null)throw new Error("The creator audio input is missing.");O.addEventListener("input",t=>{t.target.classList.remove("is-valid")});let W=document.getElementById("artifact-editor-credits-undo");if(W===null)throw new Error("The creator resetter is missing.");let ae=document.getElementById("artifact-editor-credit-undo");if(ae===null)throw new Error("The creator reset is missing.");ae.addEventListener("click",()=>{if(W.length===0)throw new Error("The creator resetter is missing.");let t=W.value.split(";");if(t.length!=4)throw new Error("The creator resetter values are invalid.");let o=t[0],h=t[1],f=t[2],A=t[3];V.value=o,j.value=h,G.value=f,O.value=A});let se=document.getElementById("artifact-editor-virustotal");if(se===null)throw new Error("The virustotal input is missing.");se.addEventListener("input",t=>{t.target.classList.remove("is-valid","is-invalid");let o=t.target.value.trim();o.length!=0&&(o.startsWith("https://www.virustotal.com/")||t.target.classList.add("is-invalid"))});let d=document.getElementById("artifact-editor-year");if(d===null)throw new Error("The year input is missing.");d.addEventListener("input",()=>{let t=parseInt(d.value,10);t>=79&&t<=99&&(d.value=1900+t),F(d,m,v)});let m=document.getElementById("artifact-editor-month");if(m===null)throw new Error("The month input is missing.");m.addEventListener("input",()=>{F(d,m,v)});let v=document.getElementById("artifact-editor-day");if(v===null)throw new Error("The day input is missing.");v.addEventListener("input",()=>{F(d,m,v)});let oe=document.getElementById("artifact-editor-date-reset");if(oe===null)throw new Error("The date reset is missing.");let le=document.getElementById("artifact-editor-date-resetter");if(le===null)throw new Error("The date resetter is missing.");oe.addEventListener("click",()=>{d.classList.remove("is-invalid","is-valid"),m.classList.remove("is-invalid","is-valid"),v.classList.remove("is-invalid","is-valid");let o=le.value.split("-");if(o.length!=3)throw new Error("The date resetter values are invalid.");d.value=o[0],m.value=o[1],v.value=o[2]});let N=document.getElementById("artifact-editor-comment");if(N===null)throw new Error("The comment input is missing.");N.addEventListener("input",t=>{if(t.target.classList.remove("is-valid"),(d.value==0&&m.value==0&&v.value==0)==!1)return;let f=/(0[1-9]|1[0-2])\/(0[1-9]|[12][0-9]|3[01])\/(\d{2})/.exec(t.target.value);if(f||(f=/(0[1-9]|1[0-2])-(0[1-9]|[12][0-9]|3[01])-(\d{2})/.exec(t.target.value)),f){let A=f[1],qe=f[2],Ne=f[3],U=parseInt(Ne,10);d.value=2e3+U,U>=79&&U<=99&&(d.value=1900+U),m.value=A,v.value=qe;let Le=document.getElementById("artifact-editor-date-update");Le!==null&&Le.click()}});let de=document.getElementById("artifact-editor-comment-undo");if(de===null)throw new Error("The comment reset is missing.");let ce=document.getElementById("artifact-editor-comment-resetter");if(ce===null)throw new Error("The comment resetter is missing.");de.addEventListener("click",()=>{N.classList.remove("is-valid"),N.value=ce.value});let ue=document.getElementById("artifact-editor-date-lastmod");if(ue!==null){let t=document.getElementById("artifact-editor-date-lastmodder");if(t===null)throw new Error("The date last modder input is missing.");ue.addEventListener("click",()=>{d.classList.remove("is-invalid","is-valid"),m.classList.remove("is-invalid","is-valid"),v.classList.remove("is-invalid","is-valid");let h=t.value.split("-");if(h.length!=3)throw new Error("The date last modder values are invalid.");d.value=h[0],m.value=h[1],v.value=h[2]})}let me=document.getElementById("artifact-editor-links-reset");if(me===null)throw new Error("The links reset is missing.");let b=document.getElementById("artifact-editor-youtube"),ve=document.getElementById("artifact-editor-youtube-reset");if(b===null||ve===null)throw new Error("A YouTube input is missing.");let R=document.getElementById("artifact-editor-demozoo"),fe=document.getElementById("artifact-editor-demozoo-reset");if(R===null||fe===null)throw new Error("A Demozoo input is missing.");let M=document.getElementById("artifact-editor-pouet"),ge=document.getElementById("artifact-editor-pouet-reset");if(M===null||ge===null)throw new Error("A Pouet input is missing.");let B=document.getElementById("artifact-editor-16colors"),he=document.getElementById("artifact-editor-16colors-reset");if(B===null||he===null)throw new Error("A 16colors input is missing.");let T=document.getElementById("artifact-editor-github"),pe=document.getElementById("artifact-editor-github-reset");if(T===null||pe===null)throw new Error("A GitHub input is missing.");let X=document.getElementById("artifact-editor-relations"),we=document.getElementById("artifact-editor-relations-reset");if(X===null||we===null)throw new Error("A relations input is missing.");let C=document.getElementById("artifact-editor-websites"),Ee=document.getElementById("artifact-editor-websites-reset");if(C===null||Ee===null)throw new Error("A websites input is missing.");C.addEventListener("paste",()=>{setTimeout(()=>{C.value=C.value.replace(/https?:\/\//,"")},0)}),me.addEventListener("click",()=>{b.classList.remove("is-invalid","is-valid"),R.classList.remove("is-invalid","is-valid"),M.classList.remove("is-invalid","is-valid"),B.classList.remove("is-invalid","is-valid"),T.classList.remove("is-invalid","is-valid"),X.classList.remove("is-invalid","is-valid"),C.classList.remove("is-invalid","is-valid"),b.value=ve.value,R.value=fe.value,M.value=ge.value,B.value=he.value,T.value=pe.value,X.value=we.value,C.value=Ee.value});let De=45e4,$e=2e5;b.addEventListener("paste",()=>{setTimeout(()=>{b.value=b.value.replace(/https?:\/\/www\.youtube\.com\/watch\?v=/,"")},0)}),b.addEventListener("input",t=>Te(t.target)),R.addEventListener("input",t=>Z(t.target,De)),M.addEventListener("input",t=>Z(t.target,$e)),B.addEventListener("paste",()=>{setTimeout(()=>{B.value=B.value.replace(/https?:\/\/16colo\.rs\//,"")},0)}),B.addEventListener("input",t=>be(t.target)),T.addEventListener("paste",()=>{setTimeout(()=>{T.value=T.value.replace(/https?:\/\/github\.com\//,"")},0)}),T.addEventListener("input",t=>ye(t.target))})();})(); diff --git a/public/js/editor-assets.min.js b/public/js/editor-assets.min.js index 30a7637a..b6c310f0 100644 --- a/public/js/editor-assets.min.js +++ b/public/js/editor-assets.min.js @@ -1,2 +1,2 @@ -/* editor-assets.min.js © Defacto2 2024 */ +/* editor-assets.min.js © Defacto2 2025 */ (()=>{function d(r){let t=document.getElementById(r);if(t==null){console.error(`The ${r} for getElmById() element is null.`);return}return t}var L="is-invalid",v="d-none",V=100,y=1024*1024,S=100*y;async function Y(r){if(r==null)throw new Error("The file value of checkSHA is null.");let t=await O(r),a=await fetch(`/uploader/sha384/${t}`,{method:"PATCH",headers:{"Content-Type":"text/plain"},body:t});if(!a.ok)throw new Error(`Hashing is not possible, server response: ${a.status}`);return await a.text()}async function O(r){if(r==null)throw new Error("The file value of sha384 is null.");try{let t=await r.arrayBuffer(),a=await crypto.subtle.digest("SHA-384",t);return Array.from(new Uint8Array(a)).map(c=>c.toString(16).padStart(2,"0")).join("")}catch(t){throw new Error(`Could not use arrayBuffer or crypto.subtle: ${t}`)}}function x(r,t){if(r==null)throw new Error("The formId value of progress is null.");if(t==null)throw new Error("The elementId value of progress is null.");htmx.on(`#${r}`,"htmx:xhr:progress",function(a){a.target.id==`${r}`&&htmx.find(`#${t}`).setAttribute("value",a.detail.loaded/a.detail.total*V)})}function A(r){if(r==null)throw new Error("The file value of checkSize is null.");return r.size>S?`The chosen file is too big at ${Math.round(r.size/y)}MB, maximum size is ${S/y}MB.`:""}function F(r,t,a,c){if(r==null)throw new Error("The errors value of checkErrors is null.");if(t==null)throw new Error("The alert value of checkErrors is null.");if(a==null)throw new Error("The fileInput value of checkErrors is null.");if(c==null)throw new Error("The results value of checkErrors is null.");r=r.filter(h=>h!=""),!(r.length<=0)&&(t.innerText=r.join(" "),t.classList.remove(v),a.innerText="",a.classList.add(L),c.classList.add(v))}async function U(r,t,a,c){if(r==null)throw new Error("The file value of checkDuplicate is null.");if(t==null)throw new Error("The alert value of checkDuplicate is null.");if(a==null)throw new Error("The fileInput value of checkDuplicate is null.");if(c==null)throw new Error("The results value of checkDuplicate is null.");let h=()=>{t.classList.remove(v),a.innerText="",a.classList.add(L),c.classList.add(v)},T="";try{let u=await Y(r);if(u==""){t.innerText="";return}T=u}catch(u){console.log(`${u}`),t.innerText=`${u}`,h();return}t.innerText="The chosen file already exists in the database: ";let f=document.createElement("a");f.href=`/f/${T}`,f.innerText=`${r.name}`,t.appendChild(f),h()}function z(r,t,a){if(r==null)throw new Error("The fileInput value of resetInput is null.");if(t==null)throw new Error("The alert value of resetInput is null.");if(a==null)throw new Error("The results value of resetInput is null.");r.innerText="",r.classList.remove(L),t.innerText="",t.classList.add(v),a.innerText="",a.classList.add(v)}(()=>{"use strict";x("artifact-editor-dl-form","artifact-editor-dl-progress"),x("artifact-editor-preview-form","artifact-editor-preview-progress");let r=d("artifact-editor-preview-reset"),t=d("artifact-editor-replace-preview"),a=d("artifact-editor-preview-submit"),c=d("artifact-editor-dl-alert"),h=d("artifact-editor-dl-reset"),T=d("artifact-editor-last-modified"),f=d("artifact-editor-dl-results"),u=d("artifact-editor-dl-up");u.addEventListener("change",H);async function H(){z(u,c,f);let e=this.files[0],s=[A(e)];F(s,c,u,f),U(e,c,u,f);let n=e.lastModified,o=new Date().getTime(),i=60*60*1e3;o-n{location.reload()},500);return}if(e.detail.failed&&e.detail.xhr){o.classList.add(i),o.innerText=`Something on the server is not working, ${g.status} status: ${g.responseText}.`;return}o.classList.add(i),o.innerText="Something with the browser is not working, please try again or refresh the page."}function I(e,s,n,o){if(e.detail.elt===null||e.detail.elt.id!==`${s}`)return;let i=document.getElementById(n);if(i===null)throw new Error(`The htmx successful input element ${n} is null`);let l=document.getElementById(o);if(l===null)throw new Error(`The htmx successful feedback element ${o} is null`);if(e.detail.successful)return P(e,i,l);if(e.detail.failed&&e.detail.xhr)return j(e,i,l);R(i,l)}function P(e,s,n){let o=e.detail.xhr;n.innerText=`${o.responseText}`,n.classList.remove("invalid-feedback"),n.classList.add("valid-feedback"),s.classList.remove("is-invalid"),s.classList.add("is-valid"),setTimeout(()=>{location.reload()},500)}function j(e,s,n){let o=e.detail.xhr;n.innerText=`Something on the server is not working, ${o.status} status: ${o.responseText}.`,n.classList.remove("valid-feedback"),n.classList.add("invalid-feedback"),s.classList.remove("is-valid"),s.classList.add("is-invalid")}function R(e,s){e.classList.remove("is-valid"),e.classList.add("is-invalid"),s.innerText="Something with the browser is not working, please try again or refresh the page.",s.classList.remove("d-none")}h.addEventListener("click",function(){c.innerText="",c.classList.add("d-none"),u.value="",u.classList.remove("is-invalid","is-valid")}),r.addEventListener("click",function(){t.value="",t.classList.remove("is-invalid","is-valid")}),t.addEventListener("change",function(e){e.target.value.trim()!==""&&(console.log("Submitting the image or photo preview form"),a.click())})})();})(); diff --git a/public/js/editor-forapproval.min.js b/public/js/editor-forapproval.min.js index 3556a19a..3bbd31f5 100644 --- a/public/js/editor-forapproval.min.js +++ b/public/js/editor-forapproval.min.js @@ -1,2 +1,2 @@ -/* editor-forapproval.min.js © Defacto2 2024 */ +/* editor-forapproval.min.js © Defacto2 2025 */ (()=>{"use strict";const a=document.getElementsByName("editorGetDemozoo"),c=[];for(const t of a){t.addEventListener("click",i,!1);const e=t.dataset.uid;e?c.push(e):console.error("No UUID found")}function r(t){console.log("event listener removed"),t.target.removeEventListener("click",i,!1)}function i(t){const e=t.target,n=t.target.dataset.id,d=t.target.dataset.uid;e.classList.add("btn-outline-primary"),e.classList.remove("btn-outline-warning","btn-outline-danger","btn-outline-success");const s=document.getElementById("editorFeedback"+n);s.classList.remove("text-danger-emphasis","text-success-emphasis"),s.classList.add("text-primary-emphasis"),s.textContent=`Fetching download from Demozoo ID ${n}`,fetch("/editor/get/demozoo/download/"+n+"?uuid="+d,{method:"GET",headers:{"Content-Type":"application/json"}}).then(o=>o.json()).then(o=>{console.log(JSON.stringify(o,null,2)),o.success?(e.classList.add("btn-outline-success"),e.classList.remove("btn-outline-primary"),s.classList.remove("text-primary-emphasis"),s.classList.add("text-success-emphasis"),s.textContent=`Success, got ${o.filename}, refresh the page to see changes`,e.disabled=!0,r(t)):(e.classList.add("btn-outline-danger"),e.classList.remove("btn-outline-primary"),s.classList.remove("text-primary-emphasis"),s.classList.add("text-danger-emphasis"),s.textContent=`Problem, ${o.error}`)})}})(); diff --git a/public/js/layout.min.js b/public/js/layout.min.js index 9bbd20da..c839fecc 100644 --- a/public/js/layout.min.js +++ b/public/js/layout.min.js @@ -1,2 +1,2 @@ -/* layout.min.js © Defacto2 2024 */ +/* layout.min.js © Defacto2 2025 */ (()=>{var m="ArrowRight",h="ArrowLeft",E=document.getElementById("paginationStart"),b=document.getElementById("paginationPrev"),T=document.getElementById("paginationPrev2"),$=document.getElementById("paginationNext"),I=document.getElementById("paginationNext2"),B=document.getElementById("paginationEnd");function L(){document.addEventListener("keydown",function(t){if(t.ctrlKey&&t.key==h){E?.click();return}if(t.ctrlKey&&t.key==m){B?.click();return}if(t.shiftKey&&t.key==h){T?.click();return}if(t.shiftKey&&t.key==m){I?.click();return}if(t.key==h){b?.click();return}if(t.key==m){$?.click();return}})}function k(t){let i=document.getElementById(t);if(typeof i>"u"||i===null)return;i.addEventListener("change",function(){q(i.value)});let r="paginationRangeLabel",e=document.getElementById(r);if(e===null)throw new Error(`The ${r} for pagination() element is null.`);i.addEventListener("input",function(){e.textContent="Jump to page "+i.value})}function q(t){let i=new URL(window.location.href),e=i.pathname.split("/"),a=e[e.length-1];!isNaN(a)&&typeof Number(a)=="number"?e[e.length-1]=t:e.push(t),i.pathname=e.join("/"),window.location.href=i.href}var p="search-htmx-alert",z="search-htmx-clear",g="search-htmx-indicator",x="search-htmx-input";function A(){let t=document.getElementById(z);t!==null&&t.addEventListener("click",function(){C(p,x,g)})}function C(){let t=document.getElementById(x);if(t===null)throw new Error(`The ${x} for clearer() element is null`);let i=document.getElementById(p);if(i===null)throw new Error(`The htmx alert element ${p} is null`);let r=document.getElementById(g);if(r===null)throw new Error(`The htmx search indicator element ${g} is null`);let e=document.getElementById("search-htmx-results");if(e===null)throw new Error("The htmx search indicator element is null");t.value="",t.focus(),i.setAttribute("hidden","true"),r.style.opacity=0,e.innerHTML=""}var S=K;function K(){A(),document.body.addEventListener("htmx:beforeRequest",function(t){n(t,"artifact-editor-classifications-undo"),n(t,"artifact-editor-text-for-dos"),n(t,"artifact-editor-text-for-amiga"),n(t,"artifact-editor-proof-of-release"),n(t,"artifact-editor-intro-for-dos"),n(t,"artifact-editor-intro-for-win"),n(t,"artifact-editor-intro-for-bbs"),n(t,"artifact-editor-trainer-for-dos"),n(t,"artifact-editor-trainer-for-win"),n(t,"artifact-editor-ansi-for-bbs"),n(t,"artifact-editor-magazine-for-text"),n(t,"artifact-editor-magazine-for-dos"),n(t,"artifact-editor-dox")}),document.body.addEventListener("htmx:afterRequest",function(t){d(t,"search-htmx-input","search-htmx-alert");let i="uploader-image-alert";d(t,"uploader-image-form",i),d(t,"uploader-image-releaser-1",i),d(t,"uploader-image-releaser-2",i);let r="uploader-intro-alert";d(t,"uploader-intro-form",r),d(t,"uploader-intro-releaser-1",r),d(t,"uploader-intro-releaser-2",r);let e="uploader-text-alert";d(t,"uploader-text-form",e),d(t,"uploader-text-releaser-1",e),d(t,"uploader-text-releaser-2",e);let a="uploader-trainer-alert";d(t,"uploader-trainer-form",a),d(t,"uploader-trainer-releaser-1",a),d(t,"uploader-trainer-releaser-2",a),R(t,"artifact-editor-hidden","artifact-editor-public"),R(t,"artifact-editor-public","artifact-editor-hidden"),o(t,"artifact-editor-operating-system"),o(t,"artifact-editor-category"),s(t,"artifact-editor-text-for-dos"),s(t,"artifact-editor-text-for-amiga"),s(t,"artifact-editor-proof-of-release"),s(t,"artifact-editor-intro-for-dos"),s(t,"artifact-editor-intro-for-win"),s(t,"artifact-editor-intro-for-bbs"),s(t,"artifact-editor-trainer-for-dos"),s(t,"artifact-editor-trainer-for-win"),s(t,"artifact-editor-ansi-for-bbs"),s(t,"artifact-editor-magazine-for-text"),s(t,"artifact-editor-magazine-for-dos"),s(t,"artifact-editor-dox"),o(t,"artifact-editor-releaser-undo"),H(t,"artifact-editor-releaser-update"),o(t,"artifact-editor-title"),y(t,"artifact-editor-title-reset","artifact-editor-title"),o(t,"artifact-editor-filename"),y(t,"artifact-editor-filename-reset","artifact-editor-filename"),o(t,"artifact-editor-virustotal"),o(t,"artifact-editor-date-reset"),o(t,"artifact-editor-date-lastmod"),D(t,"artifact-editor-date-update"),o(t,"artifact-editor-credit-text"),o(t,"artifact-editor-credit-ill"),o(t,"artifact-editor-credit-prog"),o(t,"artifact-editor-credit-audio"),U(t,'artifact-editor-credit-undo"'),o(t,"artifact-editor-comment"),y(t,"artifact-editor-comment-undo","artifact-editor-comment"),o(t,"artifact-editor-youtube"),o(t,"artifact-editor-demozoo"),o(t,"artifact-editor-pouet"),o(t,"artifact-editor-16colors"),o(t,"artifact-editor-github"),o(t,"artifact-editor-relations"),o(t,"artifact-editor-websites"),P(t,"artifact-editor-links-reset")})}function P(t,i){if(t.detail.elt===null||t.detail.elt.id!==`${i}`)return;let r="artifact-editor-alert",e=document.getElementById(r);if(typeof e>"u"||e===null)throw new Error(`The htmx alert element ${r} is null`);t.detail.successful&&console.log("okay"),t.detail.failed&&t.detail.xhr&&console.log("error"),u(e)}function U(t,i){if(t.detail.elt===null||t.detail.elt.id!==`${i}`)return;let r="artifact-editor-alert",e=document.getElementById(r);if(typeof e>"u"||e===null)throw new Error(`The htmx alert element ${r} is null`);if(t.detail.successful)return c(e,"artifact-editor-credit-text"),c(e,"artifact-editor-credit-ill"),c(e,"artifact-editor-credit-prog"),c(e,"artifact-editor-credit-audio");if(t.detail.failed&&t.detail.xhr)return f(t,"artifact-editor-credit-text",e),f(t,"artifact-editor-credit-ill",e),f(t,"artifact-editor-credit-prog",e),f(t,"artifact-editor-credit-audio",e);u(e)}function D(t,i){if(t.detail.elt===null||t.detail.elt.id!==`${i}`)return;let r="artifact-editor-alert",e=document.getElementById(r);if(typeof e>"u"||e===null)throw new Error(`The htmx alert element ${r} is null`);let a="artifact-editor-year",l="artifact-editor-month",w="artifact-editor-day";if(t.detail.successful)return c(e,a),c(e,l),c(e,w);if(t.detail.failed&&t.detail.xhr)return f(t,a,e),f(t,l,e),f(t,w,e);u(e)}function H(t,i){if(t.detail.elt===null||t.detail.elt.id!==`${i}`)return;let r="artifact-editor-alert",e=document.getElementById(r);if(typeof e>"u"||e===null)throw new Error(`The htmx alert element ${r} is null`);let a="artifact-editor-releaser-1",l="artifact-editor-releaser-2";if(t.detail.successful)return c(e,a),c(e,l);if(t.detail.failed&&t.detail.xhr)return f(t,a,e),f(t,l,e);u(e)}function n(t,i){if(t.detail.elt===null||t.detail.elt.id!==`${i}`)return;let r="artifact-editor-operating-system",e="artifact-editor-category",a=document.getElementById(r);if(typeof a>"u"||a===null)return;a.classList.remove("is-valid");let l=document.getElementById(e);typeof l>"u"||l===null||l.classList.remove("is-valid")}function o(t,i){if(t.detail.elt===null||t.detail.elt.id!==`${i}`)return;let r="artifact-editor-alert",e=document.getElementById(r);if(typeof e>"u"||e===null)throw new Error(`The htmx alert element ${r} is null`);if(t.detail.successful)return c(e,i);if(t.detail.failed&&t.detail.xhr)return f(t,i,e);u(e)}function s(t,i){if(t.detail.elt===null||t.detail.elt.id!==`${i}`)return;let r="artifact-editor-alert",e="artifact-editor-operating-system",a="artifact-editor-category",l=document.getElementById(r);if(typeof l>"u"||l===null)throw new Error(`The htmx alert element ${r} is null`);if(t.detail.successful){c(l,e),c(l,a);return}if(t.detail.failed&&t.detail.xhr)return f(t,null,l);u(l)}function y(t,i,r){if(t.detail.elt===null||t.detail.elt.id!==`${i}`)return;let e="artifact-editor-alert",a=document.getElementById(e);if(typeof a>"u"||a===null)throw new Error(`The htmx alert element ${e} is null`);if(console.log(`afterReset ${i} ${r}`,t.detail),t.detail.successful)return console.log(t.detail.successful,"sucessful"),c(a,r);if(t.detail.failed&&t.detail.xhr)return console.log(t.detail.failed,"failed"),f(t,r,a);u(a)}function c(t,i){if(console.log(`updateSuccess ${i}`),t.innerText="",t.classList.add("d-none"),typeof i>"u"||i===null)return;let r=document.getElementById(i);typeof r>"u"||r===null||(r.classList.remove("is-invalid"),r.classList.add("is-valid"))}function f(t,i,r){let e=t.detail.xhr;r.innerText=`${N()} Could not update the database record, ${e.responseText}.`,r.classList.remove("d-none"),i!==null&&document.getElementById(i).classList.remove("is-valid")}function R(t,i,r){if(t.detail.elt===null||t.detail.elt.id!==`${i}`)return;let e="artifact-editor-alert",a=document.getElementById(e);if(typeof a>"u"||a===null)throw new Error(`The htmx alert element ${e} is null`);if(t.detail.successful)return M(t,i,a);if(t.detail.failed&&t.detail.xhr)return j(t,r,a);u(a)}function M(t,i,r){r.classList.add("d-none"),r.innerText="";let e=document.getElementById("artifact-editor-modal-header");switch(i){case"artifact-editor-hidden":e.classList.remove("bg-success-subtle"),e.classList.add("bg-danger-subtle");break;case"artifact-editor-public":e.classList.add("bg-success-subtle"),e.classList.remove("bg-danger-subtle");break;default:console.error(`The record success ${i} is not supported.`)}}function j(t,i,r){let e=t.detail.xhr;r.innerText=`${N()} Could not update the database record, ${e.responseText}.`,r.classList.remove("d-none"),document.getElementById(i).checked=!0}function N(){let t=new Date,i=t.getHours(),r=t.getMinutes(),e=t.getSeconds();return r=(r<10?"0":"")+r,e=(e<10?"0":"")+e,i+":"+r+":"+e}function d(t,i,r){if(t.detail.elt===null||t.detail.elt.id!==`${i}`)return;let e=document.getElementById(r);if(typeof e>"u"||e===null)throw new Error(`The htmx alert element ${r} is null`);if(t.detail.successful)return F(t,e);if(t.detail.failed&&t.detail.xhr)return V(e,t);u(e)}function F(t,i){i.classList.add("d-none"),i.innerText="";let r="-form",e=t.target.id;if(e.slice(-r.length)==r){let l=e.replace(r,"-file");J(t,`#${l}`)}}function J(t,i){let r=t.target.querySelector(i);if(r){r.value="",r.innerText="";return}console.error(`The reset file ${i} element is null`)}function V(t,i){let r=i.detail.xhr;t.innerText=`Something on the server is not working, ${r.status} status: ${r.responseText}.`,t.classList.remove("d-none")}function u(t){t.innerText="Something with the browser is not working, please try again or refresh the page.",t.classList.remove("d-none")}(()=>{"use strict";S(),L(),k("paginationRange"),X()})();function X(){let t=document.querySelectorAll('[data-bs-toggle="tooltip"]');if(t===null)throw new Error("Tooltip trigger list not found");if(typeof bootstrap.Tooltip>"u")throw new Error("Bootstrap Tooltip is undefined");let i=[...t].map(r=>new bootstrap.Tooltip(r))}})(); diff --git a/public/js/readme.min.js b/public/js/readme.min.js index 6c344e24..57bf7e58 100644 --- a/public/js/readme.min.js +++ b/public/js/readme.min.js @@ -1,2 +1,2 @@ -/* readme.min.js © Defacto2 2024 */ +/* readme.min.js © Defacto2 2025 */ (()=>{async function l(e){let o=s(e);o.focus(),await navigator.clipboard.writeText(`${o.textContent}`).then(function(){console.log(`Copied ${v(o.textContent.length)} to the clipboard`);let r=document.getElementById("artifact-copy-readme-body");if(r===null)return;let t=r.textContent;r.textContent="\u2713 Copied",window.setTimeout(()=>{r.textContent=`${t}`},1e3)},function(r){console.error(`could not save any text to the clipboard: ${r}`)})}function s(e){let a=document.getElementById(e);if(a==null){console.error(`The ${e} for getElmById() element is null.`);return}return a}function v(e=0){let t=Math.pow(1e3,2),n=Math.pow(1e3,3);return e>n?`${(Math.round(e*100/n)/100).toFixed(2)} GB`:e>t?`${(Math.round(e*100/t)/100).toFixed(1)} MB`:e>1e3?`${(Math.round(e*100/1e3)/100).toFixed()} kB`:`${Math.round(e).toFixed()} bytes`}(()=>{"use strict";let e="d-none",a=["reader-invert","border","border-black","rounded-1"],o="readmeLatin1",r=s(o),t="readmeCP437",n=s(t),p=document.querySelector('input[name="readme-base"]:checked'),u=document.getElementById("monoFont");u!==null&&u.addEventListener("click",f);function f(){switch(p.id){case"vgaFont":r.classList.add(e),n.classList.remove(e,"font-dos",...a),n.classList.add("font-cascadia-mono");break;case"topazFont":n.classList.add(e),r.classList.remove(e,"font-amiga",...a),r.classList.add("font-cascadia-mono");break;default:throw new Error("no default font found for the readme")}}let c=document.getElementById("topazFont");c!==null&&c.addEventListener("click",m);function m(){n.classList.add(e),r.classList.remove(e,"font-cascadia-mono"),r.classList.add("font-amiga",...a)}let i=document.getElementById("vgaFont");i!==null&&i.addEventListener("click",g);function g(){r.classList.add(e),n.classList.remove(e,"font-cascadia-mono"),n.classList.add("font-dos",...a)}let d=s("artifact-copy-readme-body");typeof navigator.clipboard>"u"?d.classList.add(e):d.addEventListener("click",h);function h(){c!==null&&c.checked?l(o):i!==null&&i.checked?l(t):l(t)}})();})(); diff --git a/public/js/uploader.min.js b/public/js/uploader.min.js index 1d1eb32a..3199c968 100644 --- a/public/js/uploader.min.js +++ b/public/js/uploader.min.js @@ -1,2 +1,2 @@ -/* uploader.min.js © Defacto2 2024 */ +/* uploader.min.js © Defacto2 2025 */ (()=>{function T(e){e.preventDefault();let a=(e.clipboardData||window.Clipboard).getData("text"),t=this,s=t.selectionStart,n=t.selectionEnd;t.value=t.value.slice(0,s)+a+t.value.slice(n),t.setSelectionRange(s+a.length,s+a.length);let o=It(t.value);t.value!=o&&(console.log('Formatted input text "%s" is formatted to "%s".',t.value,o),t.value=o)}function It(e){let a=["a","addon","aka","an","and","as","at","beta","betas","but","by","compatibility","crack","cracks","demo","demos","doc","docs","documentation","fix","fixes","for","final","from","if","in","installer","installers","is","hint","hints","map","maps","mod","mods","of","on","or","patch","patches","part","prerelease","prereleases","preview","previews","proper","release","releases","repack","repacks","rip","rips","so","solve","solves","the","trainer","trainers","to","update","updates","unprotect","unprotects","vs","with"],t=[".com",".exe","2d","3d","4d","abc","ad&d","api","bbs","bios","bsa","cd","cga","dos","dox","dvd","ega","ehq","f1","fbi","ftp","hd","hq","ibm","id","iso","la","lego","ls","masm","mbl","ms","mtv","nascar","nba","ncaa","nfl","nsa","nfo","nhl","nt","oem","os","pc","pga","ppe","pfs","pkarc","pkzip","psx","rac","rom","sdk","sfx","spa","tv","ufo","usa","ushq","uss","vga","whq","ww1","ww2","ww3","wwf","xp","ys"];e=e.trim(),e=e.replace(/_/g," "),e.match(/\./g)&&e.match(/\./g).length>4&&(e=e.replace(/\./g," ")),e=e.replace(/['"`]/g,""),e=e.replace(/ \([0-9a-z]\)/g,""),e=e.replace(/([a-zA-Z0-9]): /g,"$1 : "),e=e.replace(/([xX][-| ][Mm]en)/g,"X-Men"),e=e.replace(/\(/g,"( "),e=e.replace(/\)/g," )");let s=e.split(" ").length;return e=e.split(" ").map((n,o)=>{var i=n;if($t(i)===!0)return i.toLowerCase();if(t.includes(i.toLowerCase()))return i.toUpperCase();let y=St(i);if(y!=="")return y;let ce=Bt(i);o>0&&Number.isInteger(ce)&&(i=`${ce}`);let ue=Dt(i,o,s);return ue!==i&&(i=ue),n!==i?i:o===0||!a.includes(i.toLowerCase())?i.charAt(0).toUpperCase()+i.slice(1).toLowerCase():n.toLowerCase()}).join(" ").trim(),e=e.replace(/(Lotus 123)/g,"Lotus 1-2-3"),e=e.replace(/(Falcon at )/g,"Falcon AT "),e=e.replace(/(the Games)/g,"The Games"),e=e.replace(/^(Unprotect for )(.+)/,"$2 unprotect"),e=e.replace(/^(Unprotecting )(.+)/,"$2 unprotect"),e=e.replace(/^(Unprotect )(.+)/,"$2 unprotect"),e=e.replace(/( : a)/g," : A"),e=e.replace(/( - a)/g," - A"),e=e.replace(/( : t)/g," : T"),e=e.replace(/( - t)/g," - T"),e=e.replace(/(f-)/g,"F-"),e=e.replace(/(3-d)/g,"3D"),e=e.replace(/(Pfs-)/g,"PFS-"),e=e.replace(/(Mean-18)/g,"Mean 18"),e=e.replace(/(v\d+)\.0/g,"$1"),e=e.replace(/\( /g,"("),e=e.replace(/ \)/g,")"),e=e.replace(/\[([^)]+)\]/g,function(n){return n.toUpperCase()}),e}function $t(e){return/^[vV]\d+(\.\d+)?[a-z]?$/i.test(e)}function Dt(e,a,t){return a!=t-1?e:["cheat","cheater","cracktro","loader","installer","trainer","version"].includes(e.toLowerCase())?"":e}function Bt(e){let a={I:1,V:5,X:10},t=0,s=0;for(let n=e.length-1;n>=0;n--){let o=a[e[n].toUpperCase()];ot)}function u(e){return`${e}`==""?!0:!(e<1||e>12)}function pe(e){return`${e}`==""?!0:!(e<1||e>31)}function Fe(e,a){if(e=="")return!0;let t=Number(e),s=Number(a);if(!Number.isInteger(s)||s<1)throw new Error(`The ID sanity value is invalid: ${s}`);return Number.isInteger(t)&&t>0&&t<=s}var d="is-invalid",$="d-none",Ct=100,Ee=1024*1024,Ae=100*Ee;function z(e,a){if(e==null)throw new Error("The elementId value of focusModalById is null.");if(a==null)throw new Error("The submissionId value of focusModalById is null.");let t=document.getElementById(a);if(t==null)throw new Error(`The ${a} element is null.`);let s=r(e);if(s.addEventListener("shown.bs.modal",function(){t.focus()}),bootstrap===void 0)throw new Error("The bootstrap object is undefined.");return new bootstrap.Modal(s,{keyboard:!0})}async function Ht(e){if(e==null)throw new Error("The file value of checkSHA is null.");let a=await Ft(e),t=await fetch(`/uploader/sha384/${a}`,{method:"PATCH",headers:{"Content-Type":"text/plain"},body:a});if(!t.ok)throw new Error(`Hashing is not possible, server response: ${t.status}`);return await t.text()}async function Ft(e){if(e==null)throw new Error("The file value of sha384 is null.");try{let a=await e.arrayBuffer(),t=await crypto.subtle.digest("SHA-384",a);return Array.from(new Uint8Array(t)).map(s=>s.toString(16).padStart(2,"0")).join("")}catch(a){throw new Error(`Could not use arrayBuffer or crypto.subtle: ${a}`)}}function Y(e,a){if(e==null)throw new Error("The formId value of progress is null.");if(a==null)throw new Error("The elementId value of progress is null.");htmx.on(`#${e}`,"htmx:xhr:progress",function(t){t.target.id==`${e}`&&htmx.find(`#${a}`).setAttribute("value",t.detail.loaded/t.detail.total*Ct)})}function f(e){if(e==null)throw new Error("The file value of checkSize is null.");return e.size>Ae?`The chosen file is too big at ${Math.round(e.size/Ee)}MB, maximum size is ${Ae/Ee}MB.`:""}function Ye(){return pe(this.value)==!1?(this.classList.add(d),!1):(this.classList.remove(d),!0)}function m(){return console.log(`The month value is ${this.value}.`),u(this.value)==!1?(this.classList.add(d),!1):(this.classList.remove(d),!0)}function h(){return c(this.value)==!1?(this.classList.add(d),!1):(this.classList.remove(d),!0)}function v(e,a,t,s){if(e==null)throw new Error("The errors value of checkErrors is null.");if(a==null)throw new Error("The alert value of checkErrors is null.");if(t==null)throw new Error("The fileInput value of checkErrors is null.");if(s==null)throw new Error("The results value of checkErrors is null.");e=e.filter(n=>n!=""),!(e.length<=0)&&(a.innerText=e.join(" "),a.classList.remove($),t.innerText="",t.classList.add(d),s.classList.add($))}async function L(e,a,t,s){if(e==null)throw new Error("The file value of checkDuplicate is null.");if(a==null)throw new Error("The alert value of checkDuplicate is null.");if(t==null)throw new Error("The fileInput value of checkDuplicate is null.");if(s==null)throw new Error("The results value of checkDuplicate is null.");let n=()=>{a.classList.remove($),t.innerText="",t.classList.add(d),s.classList.add($)},o="";try{let y=await Ht(e);if(y==""){a.innerText="";return}o=y}catch(y){console.log(`${y}`),a.innerText=`${y}`,n();return}a.innerText="The chosen file already exists in the database: ";let i=document.createElement("a");i.href=`/f/${o}`,i.innerText=`${e.name}`,a.appendChild(i),n()}function g(e,a,t){if(e==null)throw new Error("The file1 value of hiddenDetails is null.");if(a==null)throw new Error("The lastMod value of hiddenDetails is null.");if(t==null)throw new Error("The magic value of hiddenDetails is null.");let s=e.lastModified,n=new Date().getTime(),o=60*60*1e3;n-s=400&&s.classList.remove(re)}),document.body.addEventListener("htmx:afterRequest",function(A){if(A.detail.elt===null||A.detail.elt.id!==`${e}`)return;if(A.detail.successful)return Zt(t);let de=A.detail.xhr;if(A.detail.failed&&de)return de.status===404?_t(s,n,a):Qt(s,de);Jt(s)})}function Oe(e,a){e.addEventListener("input",function(){if(!Fe(e.value,a)){e.classList.add(Me);return}e.classList.remove(Me)})}function Wt(e,a){a.innerHTML="",e.innerText="",e.classList.add(re)}function Zt(e){e.focus()}function _t(e,a,t){a.innerText=`Production not found on ${t}.`}function Jt(e){e.innerText="Something with the browser is not working, please refresh the page.",e.classList.remove(re)}function Qt(e,a){e.innerText=`Something went wrong, ${a.status} status: ${a.responseText}.`,e.classList.remove(re)}var er="application/x-freearc",tr="application/x-arj",rr="application/x-bzip",ar="application/x-bzip2",sr="application/gzip",nr="application/vnd.rar",ir="application/x-tar",or="application/zip",lr="application/x-7z-compressed",cr="application/x-msdos-program",ur="image/bmp",dr="image/gif",pr="image/jpeg",fr="image/vnd.zbrush.pcx",mr="image/png",hr="image/tiff",vr="image/webp",Lr="application/x-csh",gr="application/x-chrome-extension",br="text/x-script.perl",wr="application/x-httpd-php",yr="text/x-script.phyton",xr="text/x-script.rexx",kr="application/x-sh",Tr="application/x-shellscript",Er="text/x-script.tcl",Mr="text/x-shellscript",zr="text/x-script.zsh";function Ir(){return[Lr,gr,br,wr,yr,xr,kr,Tr,Er,Mr,zr]}function We(){return[cr]}function fe(){return[er,tr,rr,ar,sr,nr,ir,or,lr]}function Ze(){return["application/octet-stream","application/x-binary","application/x-ms-dos-executable"]}function $r(){return[ur,dr,pr,fr,mr,hr,vr]}function _e(){return["text/plain","text/x-nfo"]}function Je(e){return Ir().includes(e)}function Qe(e){return $r().concat(fe()).includes(e)}function me(e){return We().concat(fe(),Ze()).includes(e)}function et(e){return _e().concat(fe(),We(),Ze()).includes(e)}function tt(e){return _e().concat(fe()).includes(e)}var Dr="uploader-image-form",I="is-invalid",Ie="d-none",Br=r(Dr),K=r("uploader-image-alert"),j=r("uploader-image-file"),rt=r("uploader-image-last-modified"),Sr=r("uploader-image-list-1"),Cr=r("uploader-image-list-2"),at=r("uploader-image-magic"),ae=r("uploader-image-month"),he=r("uploader-image-releaser-1"),D=r("uploader-image-results"),Hr=r("uploader-image-title"),N=r("uploader-image-year");Br.addEventListener("reset",function(){rt.value="",at.value="",nt()});j.addEventListener("change",Fr);Hr.addEventListener("paste",T);he.addEventListener("input",p);N.addEventListener("input",h);ae.addEventListener("input",m);function st(e){r(e).addEventListener("click",function(){let t=!0;if(he.value==""&&(he.classList.add(I),t=!1),c(N.value)==!1&&(N.classList.add(I),t=!1),u(ae.value)==!1&&(ae.classList.add(I),t=!1),ae.value!=""&&N.value==""&&(N.classList.add(I),t=!1),j.value==""&&(j.classList.add(I),t=!1),t==!1)return w(K,D);nt(),D.innerText="...",D.classList.remove(Ie)})}async function Fr(){b(j,K,D);let e=this.files[0],a=[f(e),Ar(e)];v(a,K,j,D),L(e,K,j,D),g(e,rt,at)}function Ar(e){return Qe(e.type)?"":`The chosen file mime type ${e.type} might not be suitable for an image.`}function nt(){Sr.innerHTML="",Cr.innerHTML="",D.innerHTML="",D.classList.add(Ie),K.innerText="",K.classList.add(Ie),N.classList.remove(I),ae.classList.remove(I),he.classList.remove(I),j.classList.remove(I)}var Yr="uploader-intro-form",E="is-invalid",$e="d-none",jr=r(Yr),X=r("uploader-intro-alert"),P=r("uploader-intro-file"),it=r("uploader-intro-last-modified"),Pr=r("uploader-intro-list-1"),Vr=r("uploader-intro-list-2"),ot=r("uploader-intro-magic"),se=r("uploader-intro-month"),ve=r("uploader-intro-releaser-1"),B=r("uploader-intro-results"),Rr=r("uploader-intro-title"),G=r("uploader-intro-year"),lt=r("uploader-intro-youtube");jr.addEventListener("reset",function(){it.value="",ot.value="",ut()});P.addEventListener("change",Ur);Rr.addEventListener("paste",T);ve.addEventListener("input",p);G.addEventListener("input",h);se.addEventListener("input",m);lt.addEventListener("input",je);function ct(e){r(e).addEventListener("click",function(){let t=!0;if(ve.value==""&&(ve.classList.add(E),t=!1),c(G.value)==!1&&(G.classList.add(E),t=!1),u(se.value)==!1&&(se.classList.add(E),t=!1),se.value!=""&&G.value==""&&(G.classList.add(E),t=!1),P.value==""&&(P.classList.add(E),t=!1),t==!1)return w(X,B);ut(),B.innerText="...",B.classList.remove($e)})}async function Ur(){b(P,X,B);let e=this.files[0],a=[f(e),qr(e)];v(a,X,P,B),L(e,X,P,B),g(e,it,ot)}function qr(e){return me(e.type)?"":`The chosen file mime type ${e.type} might not be suitable for an intro.`}function ut(){Pr.innerHTML="",Vr.innerHTML="",B.innerHTML="",B.classList.add($e),X.innerText="",X.classList.add($e),G.classList.remove(E),se.classList.remove(E),ve.classList.remove(E),lt.classList.remove(E),P.classList.remove(E)}var Nr="uploader-magazine-form",x="is-invalid",De="d-none",Kr=r(Nr),W=r("uploader-magazine-alert"),V=r("uploader-magazine-file"),dt=r("uploader-magazine-last-modified"),Gr=r("uploader-magazine-list-1"),pt=r("uploader-magazine-magic"),ne=r("uploader-magazine-month"),Le=r("uploader-magazine-releaser-1"),S=r("uploader-magazine-results"),Be=r("uploader-magazine-title"),O=r("uploader-magazine-year");Kr.addEventListener("reset",function(){dt.value="",pt.value="",mt()});V.addEventListener("change",Xr);Le.addEventListener("input",p);O.addEventListener("input",h);ne.addEventListener("input",m);function ft(e){r(e).addEventListener("click",function(){let t=!0;if(Be.value==""&&(Be.classList.add(x),t=!1),Le.value==""&&(Le.classList.add(x),t=!1),c(O.value)==!1&&(O.classList.add(x),t=!1),u(ne.value)==!1&&(ne.classList.add(x),t=!1),ne.value!=""&&O.value==""&&(O.classList.add(x),t=!1),V.value==""&&(V.classList.add(x),t=!1),t==!1)return w(W,S);mt(),S.innerText="...",S.classList.remove(De)})}async function Xr(){b(V,W,S);let e=this.files[0],a=[f(e),Or(e)];v(a,W,V,S),L(e,W,V,S),g(e,dt,pt)}function Or(e){return et(e.type)?"":`The chosen file mime type ${e.type} might not be suitable for an image.`}function mt(){Gr.innerHTML="",S.innerHTML="",S.classList.add(De),W.innerText="",W.classList.add(De),O.classList.remove(x),ne.classList.remove(x),Le.classList.remove(x),V.classList.remove(x),Be.classList.remove(x)}var Wr="uploader-text-form",M="is-invalid",Se="d-none",Zr=r(Wr),_=r("uploader-text-alert"),R=r("uploader-text-file"),ht=r("uploader-text-last-modified"),_r=r("uploader-text-list-1"),Jr=r("uploader-text-list-2"),vt=r("uploader-text-magic"),ie=r("uploader-text-month"),ge=r("uploader-text-releaser-1"),C=r("uploader-text-results"),Lt=r("uploader-text-title"),Z=r("uploader-text-year");Zr.addEventListener("reset",function(){ht.value="",vt.value="",bt()});R.addEventListener("change",Qr);Lt.addEventListener("paste",T);ge.addEventListener("input",p);Z.addEventListener("input",h);ie.addEventListener("input",m);function gt(e){r(e).addEventListener("click",function(){let t=!0;if(ge.value==""&&(ge.classList.add(M),t=!1),c(Z.value)==!1&&(Z.classList.add(M),t=!1),u(ie.value)==!1&&(ie.classList.add(M),t=!1),ie.value!=""&&Z.value==""&&(Z.classList.add(M),t=!1),R.value==""&&(R.classList.add(M),t=!1),t==!1)return w(_,C);bt(),C.innerText="...",C.classList.remove(Se)})}async function Qr(){b(R,_,C);let e=this.files[0],a=[f(e),ea(e)];v(a,_,R,C),L(e,_,R,C),g(e,ht,vt)}function ea(e){return tt(e.type)?"":`The chosen file mime type ${e.type} might not be suitable for a text.`}function bt(){_r.innerHTML="",Jr.innerHTML="",C.innerHTML="",C.classList.add(Se),_.innerText="",_.classList.add(Se),Z.classList.remove(M),ie.classList.remove(M),ge.classList.remove(M),R.classList.remove(M),Lt.classList.remove(M)}var ta="uploader-trainer-form",k="is-invalid",Ce="d-none",ra=r(ta),Q=r("uploader-trainer-alert"),U=r("uploader-trainer-file"),wt=r("uploader-trainer-last-modified"),aa=r("uploader-trainer-list-1"),sa=r("uploader-trainer-list-2"),yt=r("uploader-trainer-magic"),oe=r("uploader-trainer-month"),be=r("uploader-trainer-releaser-1"),H=r("uploader-trainer-results"),we=r("uploader-trainer-title"),J=r("uploader-trainer-year");ra.addEventListener("reset",function(){wt.value="",yt.value="",kt()});U.addEventListener("change",na);we.addEventListener("paste",T);be.addEventListener("input",p);J.addEventListener("input",h);oe.addEventListener("input",m);function xt(e){r(e).addEventListener("click",function(){let t=!0;if(we.value==""&&(we.classList.add(k),t=!1),be.value==""&&(be.classList.add(k),t=!1),c(J.value)==!1&&(J.classList.add(k),t=!1),u(oe.value)==!1&&(oe.classList.add(k),t=!1),oe.value!=""&&J.value==""&&(J.classList.add(k),t=!1),U.value==""&&(U.classList.add(k),t=!1),t==!1)return w(Q,H);kt(),H.innerText="...",H.classList.remove(Ce)})}async function na(){b(U,Q,H);let e=this.files[0],a=[f(e),ia(e)];v(a,Q,U,H),L(e,Q,U,H),g(e,wt,yt)}function ia(e){return me(e.type)?"":`The chosen file mime type ${e.type} might not be suitable for an intro.`}function kt(){aa.innerHTML="",sa.innerHTML="",H.innerHTML="",H.classList.add(Ce),Q.innerText="",Q.classList.add(Ce),J.classList.remove(k),oe.classList.remove(k),be.classList.remove(k),U.classList.remove(k),we.classList.remove(k)}var oa="uploader-advanced-form",l="is-invalid",He="d-none",la=r(oa),te=r("uploader-advanced-alert"),ye=r("uploader-advanced-category"),ca=r("uploader-advanced-classification-help"),xe=r("uploader-advanced-day"),q=r("uploader-advanced-file"),Tt=r("uploader-advanced-last-modified"),ua=r("uploader-advanced-list-1"),da=r("uploader-advanced-list-2"),Et=r("uploader-advanced-magic"),le=r("uploader-advanced-month"),ke=r("uploader-advanced-operating-system"),Te=r("uploader-advanced-releaser-1"),F=r("uploader-advanced-results"),pa=r("uploader-advanced-title"),ee=r("uploader-advanced-year");la.addEventListener("reset",function(){Tt.value="",Et.value="",zt()});q.addEventListener("change",fa);pa.addEventListener("paste",T);Te.addEventListener("input",p);ee.addEventListener("input",h);le.addEventListener("input",m);xe.addEventListener("input",Ye);ye.addEventListener("change",p);ke.addEventListener("change",p);function Mt(e){r(e).addEventListener("click",function(){let t=!0;if(Te.value==""&&(Te.classList.add(l),t=!1),c(ee.value)==!1&&(ee.classList.add(l),t=!1),u(le.value)==!1&&(le.classList.add(l),t=!1),pe(xe.value)==!1&&(xe.classList.add(l),t=!1),le.value!=""&&ee.value==""&&(ee.classList.add(l),t=!1),q.value==""&&(q.classList.add(l),t=!1),ke.value==""&&(ke.classList.add(l),t=!1),ye.value==""&&(ye.classList.add(l),t=!1),t==!1)return w(te,F);zt(),F.innerText="...",F.classList.remove(He)})}async function fa(){b(q,te,F);let e=this.files[0],a=[f(e),ma(e)];v(a,te,q,F),L(e,te,q,F),g(e,Tt,Et)}function ma(e){return Je(e.type)?`The chosen file mime type ${e.type} might not be suitable for an upload.`:""}function zt(){ua.innerHTML="",da.innerHTML="",F.innerHTML="",ca.innerHTML="",F.classList.add(He),te.innerText="",te.classList.add(He),ee.classList.remove(l),le.classList.remove(l),xe.classList.remove(l),Te.classList.remove(l),q.classList.remove(l),ke.classList.remove(l),ye.classList.remove(l)}(()=>{"use strict";Xe(),ze("demozoo-submission","Demozoo"),ze("pouet-submission","Pou\xEBt"),st("uploader-image-submit"),Y("uploader-image-form","uploader-image-progress"),ct("uploader-intro-submit"),Y("uploader-intro-form","uploader-intro-progress"),xt("uploader-trainer-submit"),Y("uploader-trainer-form","uploader-trainer-progress"),ft("uploader-magazine-submit"),Y("uploader-magazine-form","uploader-magazine-progress"),gt("uploader-text-submit"),Y("uploader-text-form","uploader-text-progress"),Mt("uploader-advanced-submit"),Y("uploader-advanced-form","uploader-advanced-progress")})();})(); diff --git a/public/js/votes-pouet.min.js b/public/js/votes-pouet.min.js index b32f1112..47c399b5 100644 --- a/public/js/votes-pouet.min.js +++ b/public/js/votes-pouet.min.js @@ -1,2 +1,2 @@ -/* votes-pouet.min.js © Defacto2 2024 */ +/* votes-pouet.min.js © Defacto2 2025 */ (()=>{"use strict";const i=t=>`${location.protocol}//${location.host}/pouet/vote/${t}`,r=document.getElementById("pouetVoteID"),n=document.getElementById("pouetRow"),s=document.getElementById("pouetStars"),c=document.getElementById("pouetVotes");if(r===null||n===null||s===null||c===null)return;const u=r.innerHTML.trim();console.info(`Requesting the Pou\xEBt API for production #${u}`),fetch(i(u),{method:"GET",headers:{"Content-Type":"application/json charset=UTF-8"}}).then(t=>{if(!t.ok){const e="A network error occurred requesting API";throw new Error(`${e}: ${t.statusText} ${t.status}`)}return t.json()}).then(t=>{const e=t.votes_up+t.votes_down+t.votes_meh;if(e===0){n.classList.add("d-none");return}let o=`${t.stars} star`;t.stars!==1&&(o+="s"),s.innerHTML=o,o=`${e} vote`,e!==1&&(o+="s"),c.innerHTML=o,n.classList.remove("d-none")}).catch(t=>{console.error(`An error occurred requesting API: ${t}`)})})();