Skip to content

Commit

Permalink
upgrade dependencies & add filenamify, close #237
Browse files Browse the repository at this point in the history
  • Loading branch information
juzeon committed Mar 26, 2024
1 parent a984902 commit a4246fd
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 71 deletions.
16 changes: 13 additions & 3 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"errors"
"fmt"
"github.com/PuerkitoBio/goquery"
"github.com/flytam/filenamify"
goversion "github.com/hashicorp/go-version"
"github.com/life4/genesis/slices"
"github.com/microcosm-cc/bluemonday"
Expand Down Expand Up @@ -349,14 +350,19 @@ func (a *App) SaveRemoteJPEGImage(url string) error {
return os.WriteFile(filePath, resp.Bytes(), 0644)
}
func (a *App) SaveRemoteFile(extWithoutDot, defaultFilenameWithoutExt, url string) error {
fn, err := filenamify.FilenamifyV2(
lo.Ternary(defaultFilenameWithoutExt != "", defaultFilenameWithoutExt, "file") +
"." + extWithoutDot)
if err != nil {
return err
}
filePath, err := runtime.SaveFileDialog(a.ctx, runtime.SaveDialogOptions{
Title: "Choose a destination to save the file",
Filters: []runtime.FileFilter{{
DisplayName: "*." + extWithoutDot,
Pattern: "*." + extWithoutDot,
}},
DefaultFilename: lo.Ternary(defaultFilenameWithoutExt != "", defaultFilenameWithoutExt, "file") +
"." + extWithoutDot,
DefaultFilename: fn,
CanCreateDirectories: true,
})
if err != nil {
Expand Down Expand Up @@ -385,14 +391,18 @@ func (a *App) ExportWorkspace(id int) error {
if !ok {
return errors.New("workspace not exist by id: " + strconv.Itoa(id))
}
fn, err := filenamify.FilenamifyV2(workspace.Title + ".md")
if err != nil {
return err
}
filePath, err := runtime.SaveFileDialog(a.ctx, runtime.SaveDialogOptions{
Title: "Choose a destination to save the chat",
Filters: []runtime.FileFilter{{
DisplayName: "MarkDown Files (*.md)",
Pattern: "*.md",
}},
CanCreateDirectories: true,
DefaultFilename: workspace.Title + ".md",
DefaultFilename: fn,
})
if err != nil {
return err
Expand Down
43 changes: 22 additions & 21 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,28 @@ go 1.21
toolchain go1.21.1

require (
github.com/PuerkitoBio/goquery v1.8.1
github.com/dlclark/regexp2 v1.10.0
github.com/go-chi/chi/v5 v5.0.11
github.com/PuerkitoBio/goquery v1.9.1
github.com/dlclark/regexp2 v1.11.0
github.com/flytam/filenamify v1.2.0
github.com/go-chi/chi/v5 v5.0.12
github.com/go-chi/cors v1.2.1
github.com/go-rod/rod v0.114.7
github.com/go-rod/rod v0.114.8
github.com/go-rod/stealth v0.4.9
github.com/google/uuid v1.6.0
github.com/hashicorp/go-version v1.6.0
github.com/huandu/go-clone/generic v1.7.2
github.com/imroc/req/v3 v3.42.3
github.com/imroc/req/v3 v3.43.1
github.com/klippa-app/go-pdfium v1.11.0
github.com/life4/genesis v1.10.2
github.com/microcosm-cc/bluemonday v1.0.26
github.com/ncruces/zenity v0.10.11
github.com/ncruces/zenity v0.10.12
github.com/pkg/errors v0.9.1
github.com/pkoukk/tiktoken-go v0.1.6
github.com/rapid7/go-get-proxied v0.0.0-20231004143307-7280e84105fa
github.com/rapid7/go-get-proxied v0.0.0-20240311092404-798791728c56
github.com/samber/lo v1.39.0
github.com/sashabaranov/go-openai v1.19.3
github.com/sashabaranov/go-openai v1.20.4
github.com/stretchr/testify v1.8.4
github.com/tidwall/gjson v1.17.0
github.com/tidwall/gjson v1.17.1
github.com/wailsapp/wails/v2 v2.8.0
nhooyr.io/websocket v1.8.10
)
Expand All @@ -42,15 +43,15 @@ require (
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/google/pprof v0.0.0-20240207164012-fb44976bdcd5 // indirect
github.com/google/pprof v0.0.0-20240320155624-b11c3daa6f07 // indirect
github.com/gorilla/css v1.0.1 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/huandu/go-clone v1.7.2 // indirect
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
github.com/jolestar/go-commons-pool/v2 v2.1.2 // indirect
github.com/josephspurrier/goversioninfo v1.4.0 // indirect
github.com/klauspost/compress v1.17.6 // indirect
github.com/klauspost/compress v1.17.7 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/labstack/echo/v4 v4.11.4 // indirect
github.com/labstack/gommon v0.4.2 // indirect
Expand All @@ -60,16 +61,16 @@ require (
github.com/leaanthony/u v1.1.1 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.20 // indirect
github.com/onsi/ginkgo/v2 v2.15.0 // indirect
github.com/onsi/ginkgo/v2 v2.17.1 // indirect
github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/quic-go/qpack v0.4.0 // indirect
github.com/quic-go/quic-go v0.41.0 // indirect
github.com/quic-go/quic-go v0.42.0 // indirect
github.com/randall77/makefat v0.0.0-20210315173500-7ddd0e42c844 // indirect
github.com/refraction-networking/utls v1.6.2 // indirect
github.com/refraction-networking/utls v1.6.3 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/tetratelabs/wazero v1.6.0 // indirect
github.com/tetratelabs/wazero v1.7.0 // indirect
github.com/tidwall/match v1.1.1 // indirect
github.com/tidwall/pretty v1.2.1 // indirect
github.com/tkrajina/go-reflector v0.5.6 // indirect
Expand All @@ -83,13 +84,13 @@ require (
github.com/ysmood/gson v0.7.3 // indirect
github.com/ysmood/leakless v0.8.0 // indirect
go.uber.org/mock v0.4.0 // indirect
golang.org/x/crypto v0.19.0 // indirect
golang.org/x/exp v0.0.0-20240213143201-ec583247a57a // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/exp v0.0.0-20240325151524-a685a6edb6d8 // indirect
golang.org/x/image v0.15.0 // indirect
golang.org/x/mod v0.15.0 // indirect
golang.org/x/net v0.21.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/tools v0.18.0 // indirect
golang.org/x/tools v0.19.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit a4246fd

Please sign in to comment.