Skip to content

Commit

Permalink
Merge branch 'main' of github.com:Defacto2/server
Browse files Browse the repository at this point in the history
  • Loading branch information
bengarrett committed Jan 8, 2025
2 parents 76cad09 + 6f942fd commit fe58c46
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gorelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions assets/js/editor-artifact.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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));
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
27 changes: 14 additions & 13 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand All @@ -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=
Expand Down Expand Up @@ -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=
Expand Down
9 changes: 6 additions & 3 deletions handler/htmx/artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions handler/htmx/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions internal/command/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion public/css/layout.min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions public/js/editor-artifact.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit fe58c46

Please sign in to comment.