diff --git a/build/app.plist b/build/app.plist index 783798c..48d8c81 100644 --- a/build/app.plist +++ b/build/app.plist @@ -7,6 +7,6 @@ CFBundleIconFile icon.icns CFBundleVersion - 0.10.5 + 0.10.7 \ No newline at end of file diff --git a/build/versioninfo.json b/build/versioninfo.json index fad4ab5..c15e330 100644 --- a/build/versioninfo.json +++ b/build/versioninfo.json @@ -22,14 +22,14 @@ "Comments": "", "CompanyName": "Nuno Cruces", "FileDescription": "", - "FileVersion": "0.10.5.0", + "FileVersion": "0.10.7.0", "InternalName": "rethinkraw", "LegalCopyright": "© 2019-2022 Nuno Cruces", "LegalTrademarks": "", "OriginalFilename": "RethinkRAW.exe", "PrivateBuild": "", "ProductName": "RethinkRAW", - "ProductVersion": "0.10.5", + "ProductVersion": "0.10.7", "SpecialBuild": "" }, "VarFileInfo": { diff --git a/go.mod b/go.mod index 10b684f..8289b70 100644 --- a/go.mod +++ b/go.mod @@ -4,6 +4,7 @@ go 1.19 require ( github.com/gorilla/schema v1.2.0 + github.com/gorilla/websocket v1.5.0 github.com/josephspurrier/goversioninfo v1.4.0 github.com/ncruces/go-exiftool v0.4.0 github.com/ncruces/go-fetch v0.0.0-20201125022143-c61f8921eb46 @@ -12,9 +13,8 @@ require ( github.com/ncruces/jason v0.4.0 github.com/ncruces/keyless v0.0.0-20230223133947-fcba6242c6a3 github.com/ncruces/zenity v0.10.6 - github.com/tetratelabs/wazero v1.0.0-rc.1 - golang.org/x/exp v0.0.0-20230304125523-9ff063c70017 - golang.org/x/net v0.8.0 + github.com/tetratelabs/wazero v1.0.0 + golang.org/x/exp v0.0.0-20230321023759-10a507213a29 golang.org/x/sync v0.1.0 golang.org/x/sys v0.6.0 gonum.org/v1/gonum v0.12.0 @@ -22,6 +22,7 @@ require ( require ( github.com/akavel/rsrc v0.10.2 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f // indirect github.com/gabriel-vasile/mimetype v1.4.1 // indirect github.com/krolaw/zipstream v0.0.0-20180621105154-0a2661891f94 // indirect @@ -29,5 +30,6 @@ require ( github.com/tdewolff/minify/v2 v2.12.4 // indirect github.com/tdewolff/parse/v2 v2.6.4 // indirect golang.org/x/image v0.6.0 // indirect + golang.org/x/net v0.8.0 // indirect golang.org/x/text v0.8.0 // indirect ) diff --git a/go.sum b/go.sum index 31bc2bb..6bda728 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,9 @@ github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw= github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c= github.com/cheekybits/is v0.0.0-20150225183255-68e9c0620927/go.mod h1:h/aW8ynjgkuj+NQRlZcDbAbM1ORAbXjXX77sX7T289U= -github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f h1:OGqDDftRTwrvUoL6pOG7rYTmWsTCvyEWFsMjg+HcOaA= github.com/dchest/jsmin v0.0.0-20220218165748-59f39799265f/go.mod h1:Dv9D0NUlAsaQcGQZa5kc5mqR9ua72SmA8VXi4cd+cBw= github.com/djherbis/atime v1.1.0/go.mod h1:28OF6Y8s3NQWwacXc5eZTsEsiMzp7LF8MbXE+XJPdBE= @@ -14,6 +15,8 @@ github.com/gabriel-vasile/mimetype v1.4.1 h1:TRWk7se+TOjCYgRth7+1/OYLNiRNIotknkF github.com/gabriel-vasile/mimetype v1.4.1/go.mod h1:05Vi0w3Y9c/lNvJOdmIwvrrAhX3rYhfQQCaf9VJcv7M= github.com/gorilla/schema v1.2.0 h1:YufUaxZYCKGFuAq3c96BOhjgd5nmXiOY9NGzF247Tsc= github.com/gorilla/schema v1.2.0/go.mod h1:kgLaKoK1FELgZqMAVxx/5cbj0kT+57qxUrAlIO2eleU= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/josephspurrier/goversioninfo v1.4.0 h1:Puhl12NSHUSALHSuzYwPYQkqa2E1+7SrtAPJorKK0C8= github.com/josephspurrier/goversioninfo v1.4.0/go.mod h1:JWzv5rKQr+MmW+LvM412ToT/IkYDZjaclF2pKDss8IY= github.com/krolaw/zipstream v0.0.0-20180621105154-0a2661891f94 h1:+AIlO01SKT9sfWU5CLWi0cfHc7dQwgGz3FhFRzXLoMg= @@ -50,14 +53,14 @@ github.com/tdewolff/parse/v2 v2.6.4/go.mod h1:woz0cgbLwFdtbjJu8PIKxhW05KplTFQkOd github.com/tdewolff/test v1.0.6/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= github.com/tdewolff/test v1.0.7 h1:8Vs0142DmPFW/bQeHRP3MV19m1gvndjUb1sn8yy74LM= github.com/tdewolff/test v1.0.7/go.mod h1:6DAvZliBAAnD7rhVgwaM7DE5/d9NMOAJ09SqYqeK4QE= -github.com/tetratelabs/wazero v1.0.0-rc.1 h1:ytecMV5Ue0BwezjKh/cM5yv1Mo49ep2R2snSsQUyToc= -github.com/tetratelabs/wazero v1.0.0-rc.1/go.mod h1:wYx2gNRg8/WihJfSDxA1TIL8H+GkfLYm+bIfbblu9VQ= +github.com/tetratelabs/wazero v1.0.0 h1:sCE9+mjFex95Ki6hdqwvhyF25x5WslADjDKIFU5BXzI= +github.com/tetratelabs/wazero v1.0.0/go.mod h1:wYx2gNRg8/WihJfSDxA1TIL8H+GkfLYm+bIfbblu9VQ= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/exp v0.0.0-20230304125523-9ff063c70017 h1:3Ea9SZLCB0aRIhSEjM+iaGIlzzeDJdpi579El/YIhEE= -golang.org/x/exp v0.0.0-20230304125523-9ff063c70017/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.6.0 h1:bR8b5okrPI3g/gyZakLZHeWxAR8Dn5CyxXv1hLH5g/4= golang.org/x/image v0.6.0/go.mod h1:MXLdDR43H7cDJq5GEGXEVeeNhPgi+YYEQ2pC1byI1x0= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= diff --git a/make.cmd b/make.cmd index aa5a4ee..a940848 100644 --- a/make.cmd +++ b/make.cmd @@ -16,8 +16,9 @@ IF NOT EXIST %tgt%\utils\exiftool\exiftool.exe ( IF NOT EXIST %tgt%\utils\dcraw.wasm ( ECHO Download dcraw... - SET "url=https://github.com/ncruces/dcraw/releases/download/v9.28.6-wasm/dcraw.wasm.gz" + SET "url=https://github.com/ncruces/dcraw/releases/download/v9.28.7-wasm/dcraw.wasm.gz" go run github.com/ncruces/go-fetch -unpack !url! %tgt%\utils + COPY /Y %tgt%\utils\dcraw.wasm pkg\dcraw\embed\dcraw.wasm ) IF NOT EXIST assets\normalize.css ( diff --git a/make.sh b/make.sh index d2abf25..d571e23 100755 --- a/make.sh +++ b/make.sh @@ -13,7 +13,7 @@ cp "build/app.plist" "$tgt/Info.plist" cp "build/icon.icns" "$tgt/Resources/" cp "build/icon.icns" "$app/droplet.icns" cp "build/exiftool_config.pl" "$tgt/MacOS/utils" -plutil -replace CFBundleVersion -string "0.10.5" RethinkRAW.app/Contents/Info.plist +plutil -replace CFBundleVersion -string "0.10.7" RethinkRAW.app/Contents/Info.plist plutil -replace CFBundleDocumentTypes -xml "$(cat build/doctypes.plist)" RethinkRAW.app/Contents/Info.plist ln -sf "RethinkRAW.app/Contents/MacOS/rethinkraw" "$app/rethinkraw-server" @@ -25,8 +25,9 @@ fi if [ ! -f "$tgt/MacOS/utils/dcraw.wasm" ]; then echo Download dcraw... - url="https://github.com/ncruces/dcraw/releases/download/v9.28.6-wasm/dcraw.wasm.gz" + url="https://github.com/ncruces/dcraw/releases/download/v9.28.7-wasm/dcraw.wasm.gz" curl -sL "$url" | gzip -dc > "$tgt/MacOS/utils/dcraw.wasm" + cp "$tgt/MacOS/utils/dcraw.wasm" "pkg/dcraw/embed/dcraw.wasm" fi if [ ! -f "assets/normalize.css" ]; then diff --git a/make_wine.sh b/make_wine.sh index aa9353c..0d5c494 100755 --- a/make_wine.sh +++ b/make_wine.sh @@ -17,8 +17,9 @@ fi if [ ! -f "$tgt/utils/dcraw.wasm" ]; then echo Download dcraw... - url="https://github.com/ncruces/dcraw/releases/download/v9.28.6-wasm/dcraw.wasm.gz" + url="https://github.com/ncruces/dcraw/releases/download/v9.28.7-wasm/dcraw.wasm.gz" curl -sL "$url" | gzip -dc > "$tgt/utils/dcraw.wasm" + cp "$tgt/utils/dcraw.wasm" "pkg/dcraw/embed/dcraw.wasm" fi if [ ! -f "assets/normalize.css" ]; then diff --git a/pkg/chrome/chrome.go b/pkg/chrome/chrome.go index 5439b8a..2ec0108 100644 --- a/pkg/chrome/chrome.go +++ b/pkg/chrome/chrome.go @@ -5,7 +5,6 @@ import ( "bufio" "bytes" "errors" - "io" "io/fs" "log" "math/rand" @@ -16,8 +15,8 @@ import ( "sync" "sync/atomic" + "github.com/gorilla/websocket" "github.com/ncruces/jason" - "golang.org/x/net/websocket" ) var once sync.Once @@ -103,7 +102,7 @@ func (c *Cmd) Start() error { line := scan.Bytes() if bytes.HasPrefix(line, []byte(prefix)) { url := line[len(prefix):] - c.ws, err = websocket.Dial(string(url), "", c.url) + c.ws, _, err = websocket.DefaultDialer.Dial(string(url), nil) if err != nil { return err } @@ -131,16 +130,19 @@ func (c *Cmd) Close() error { func (c *Cmd) receiveloop() { var started bool - var targets = set[string]{} + targets := set[string]{} c.send("Target.setDiscoverTargets", "", jason.Object{"discover": true}) for { var msg cdpMessage - err := websocket.JSON.Receive(c.ws, &msg) - if err == io.EOF { - break - } + err := c.ws.ReadJSON(&msg) if err != nil { - log.Print("chrome:", err) + if websocket.IsUnexpectedCloseError(err, + websocket.CloseGoingAway, + websocket.CloseNormalClosure, + websocket.CloseAbnormalClosure) { + log.Println("chrome:", err) + } + break } switch msg.Method { case "Target.targetDestroyed", "Target.targetCrashed": @@ -163,7 +165,7 @@ func (c *Cmd) receiveloop() { } func (c *Cmd) send(method, session string, params any) error { - return websocket.JSON.Send(c.ws, jason.Object{ + return c.ws.WriteJSON(jason.Object{ "id": c.msg.Add(1), "method": method, "params": params, diff --git a/pkg/dcraw/dcraw.go b/pkg/dcraw/dcraw.go index 62f7876..07a4c3e 100644 --- a/pkg/dcraw/dcraw.go +++ b/pkg/dcraw/dcraw.go @@ -26,7 +26,6 @@ import ( "regexp" "strconv" "sync" - "sync/atomic" _ "embed" @@ -49,7 +48,6 @@ var ( sem *semaphore.Weighted orienRegex *regexp.Regexp thumbRegex *regexp.Regexp - counter atomic.Uint64 ) func compile() { @@ -88,8 +86,7 @@ func run(ctx context.Context, root fs.FS, args ...string) ([]byte, error) { var buf bytes.Buffer cfg := wazero.NewModuleConfig(). - WithArgs(args...).WithStdout(&buf).WithFS(root). - WithName("dcraw-" + strconv.FormatUint(counter.Add(1), 10)) + WithArgs(args...).WithStdout(&buf).WithFS(root) module, err := wasm.InstantiateModule(ctx, module, cfg) if err != nil { return nil, err diff --git a/pkg/dcraw/embed/dcraw.wasm b/pkg/dcraw/embed/dcraw.wasm index 11fb4b3..806955a 100644 Binary files a/pkg/dcraw/embed/dcraw.wasm and b/pkg/dcraw/embed/dcraw.wasm differ