Skip to content

Commit a4246fd

Browse files
committed
upgrade dependencies & add filenamify, close #237
1 parent a984902 commit a4246fd

File tree

3 files changed

+83
-71
lines changed

3 files changed

+83
-71
lines changed

app.go

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"errors"
1010
"fmt"
1111
"github.com/PuerkitoBio/goquery"
12+
"github.com/flytam/filenamify"
1213
goversion "github.com/hashicorp/go-version"
1314
"github.com/life4/genesis/slices"
1415
"github.com/microcosm-cc/bluemonday"
@@ -349,14 +350,19 @@ func (a *App) SaveRemoteJPEGImage(url string) error {
349350
return os.WriteFile(filePath, resp.Bytes(), 0644)
350351
}
351352
func (a *App) SaveRemoteFile(extWithoutDot, defaultFilenameWithoutExt, url string) error {
353+
fn, err := filenamify.FilenamifyV2(
354+
lo.Ternary(defaultFilenameWithoutExt != "", defaultFilenameWithoutExt, "file") +
355+
"." + extWithoutDot)
356+
if err != nil {
357+
return err
358+
}
352359
filePath, err := runtime.SaveFileDialog(a.ctx, runtime.SaveDialogOptions{
353360
Title: "Choose a destination to save the file",
354361
Filters: []runtime.FileFilter{{
355362
DisplayName: "*." + extWithoutDot,
356363
Pattern: "*." + extWithoutDot,
357364
}},
358-
DefaultFilename: lo.Ternary(defaultFilenameWithoutExt != "", defaultFilenameWithoutExt, "file") +
359-
"." + extWithoutDot,
365+
DefaultFilename: fn,
360366
CanCreateDirectories: true,
361367
})
362368
if err != nil {
@@ -385,14 +391,18 @@ func (a *App) ExportWorkspace(id int) error {
385391
if !ok {
386392
return errors.New("workspace not exist by id: " + strconv.Itoa(id))
387393
}
394+
fn, err := filenamify.FilenamifyV2(workspace.Title + ".md")
395+
if err != nil {
396+
return err
397+
}
388398
filePath, err := runtime.SaveFileDialog(a.ctx, runtime.SaveDialogOptions{
389399
Title: "Choose a destination to save the chat",
390400
Filters: []runtime.FileFilter{{
391401
DisplayName: "MarkDown Files (*.md)",
392402
Pattern: "*.md",
393403
}},
394404
CanCreateDirectories: true,
395-
DefaultFilename: workspace.Title + ".md",
405+
DefaultFilename: fn,
396406
})
397407
if err != nil {
398408
return err

go.mod

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,28 @@ go 1.21
55
toolchain go1.21.1
66

77
require (
8-
github.com/PuerkitoBio/goquery v1.8.1
9-
github.com/dlclark/regexp2 v1.10.0
10-
github.com/go-chi/chi/v5 v5.0.11
8+
github.com/PuerkitoBio/goquery v1.9.1
9+
github.com/dlclark/regexp2 v1.11.0
10+
github.com/flytam/filenamify v1.2.0
11+
github.com/go-chi/chi/v5 v5.0.12
1112
github.com/go-chi/cors v1.2.1
12-
github.com/go-rod/rod v0.114.7
13+
github.com/go-rod/rod v0.114.8
1314
github.com/go-rod/stealth v0.4.9
1415
github.com/google/uuid v1.6.0
1516
github.com/hashicorp/go-version v1.6.0
1617
github.com/huandu/go-clone/generic v1.7.2
17-
github.com/imroc/req/v3 v3.42.3
18+
github.com/imroc/req/v3 v3.43.1
1819
github.com/klippa-app/go-pdfium v1.11.0
1920
github.com/life4/genesis v1.10.2
2021
github.com/microcosm-cc/bluemonday v1.0.26
21-
github.com/ncruces/zenity v0.10.11
22+
github.com/ncruces/zenity v0.10.12
2223
github.com/pkg/errors v0.9.1
2324
github.com/pkoukk/tiktoken-go v0.1.6
24-
github.com/rapid7/go-get-proxied v0.0.0-20231004143307-7280e84105fa
25+
github.com/rapid7/go-get-proxied v0.0.0-20240311092404-798791728c56
2526
github.com/samber/lo v1.39.0
26-
github.com/sashabaranov/go-openai v1.19.3
27+
github.com/sashabaranov/go-openai v1.20.4
2728
github.com/stretchr/testify v1.8.4
28-
github.com/tidwall/gjson v1.17.0
29+
github.com/tidwall/gjson v1.17.1
2930
github.com/wailsapp/wails/v2 v2.8.0
3031
nhooyr.io/websocket v1.8.10
3132
)
@@ -42,15 +43,15 @@ require (
4243
github.com/go-ole/go-ole v1.3.0 // indirect
4344
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
4445
github.com/godbus/dbus/v5 v5.1.0 // indirect
45-
github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5 // indirect
46+
github.com/google/pprof v0.0.0-20240320155624-b11c3daa6f07 // indirect
4647
github.com/gorilla/css v1.0.1 // indirect
4748
github.com/hashicorp/errwrap v1.1.0 // indirect
4849
github.com/hashicorp/go-multierror v1.1.1 // indirect
4950
github.com/huandu/go-clone v1.7.2 // indirect
5051
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
5152
github.com/jolestar/go-commons-pool/v2 v2.1.2 // indirect
5253
github.com/josephspurrier/goversioninfo v1.4.0 // indirect
53-
github.com/klauspost/compress v1.17.6 // indirect
54+
github.com/klauspost/compress v1.17.7 // indirect
5455
github.com/kr/pretty v0.3.1 // indirect
5556
github.com/labstack/echo/v4 v4.11.4 // indirect
5657
github.com/labstack/gommon v0.4.2 // indirect
@@ -60,16 +61,16 @@ require (
6061
github.com/leaanthony/u v1.1.1 // indirect
6162
github.com/mattn/go-colorable v0.1.13 // indirect
6263
github.com/mattn/go-isatty v0.0.20 // indirect
63-
github.com/onsi/ginkgo/v2 v2.15.0 // indirect
64+
github.com/onsi/ginkgo/v2 v2.17.1 // indirect
6465
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
6566
github.com/pmezard/go-difflib v1.0.0 // indirect
6667
github.com/quic-go/qpack v0.4.0 // indirect
67-
github.com/quic-go/quic-go v0.41.0 // indirect
68+
github.com/quic-go/quic-go v0.42.0 // indirect
6869
github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 // indirect
69-
github.com/refraction-networking/utls v1.6.2 // indirect
70+
github.com/refraction-networking/utls v1.6.3 // indirect
7071
github.com/rivo/uniseg v0.4.7 // indirect
7172
github.com/rogpeppe/go-internal v1.11.0 // indirect
72-
github.com/tetratelabs/wazero v1.6.0 // indirect
73+
github.com/tetratelabs/wazero v1.7.0 // indirect
7374
github.com/tidwall/match v1.1.1 // indirect
7475
github.com/tidwall/pretty v1.2.1 // indirect
7576
github.com/tkrajina/go-reflector v0.5.6 // indirect
@@ -83,13 +84,13 @@ require (
8384
github.com/ysmood/gson v0.7.3 // indirect
8485
github.com/ysmood/leakless v0.8.0 // indirect
8586
go.uber.org/mock v0.4.0 // indirect
86-
golang.org/x/crypto v0.19.0 // indirect
87-
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect
87+
golang.org/x/crypto v0.21.0 // indirect
88+
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
8889
golang.org/x/image v0.15.0 // indirect
89-
golang.org/x/mod v0.15.0 // indirect
90-
golang.org/x/net v0.21.0 // indirect
91-
golang.org/x/sys v0.17.0 // indirect
90+
golang.org/x/mod v0.16.0 // indirect
91+
golang.org/x/net v0.22.0 // indirect
92+
golang.org/x/sys v0.18.0 // indirect
9293
golang.org/x/text v0.14.0 // indirect
93-
golang.org/x/tools v0.18.0 // indirect
94+
golang.org/x/tools v0.19.0 // indirect
9495
gopkg.in/yaml.v3 v3.0.1 // indirect
9596
)

0 commit comments

Comments
 (0)