Compare commits

...

347 Commits

Author SHA1 Message Date
Lea Anthony
f6d7ec3d50 Merge pull request #1059 from GargantuaX/master
update zh-hans docs
2022-01-06 06:28:35 +11:00
GargantuaX
d2a116fe55 update zh-hans docs 2022-01-05 16:01:48 +08:00
Lea Anthony
eb3cf9d130 Merge pull request #1058 from yesgs/master
add uos linux distro
2022-01-05 17:13:48 +11:00
king
7e2258be7d add uos linux distro 2022-01-05 11:13:34 +08:00
Lea Anthony
bb5d446001 Merge pull request #1053 from pierrejoye/master
Allow window resizing regardless of frameless or other options (#1049)
2021-12-31 06:58:05 +11:00
Pierre Joye
e9aba4795f Allow window resizing regardless of frameless or other options
Fix bug on Windows where the disableResize option depends on the frameless option.
2021-12-30 16:55:47 +07:00
Lea\Anthony
c16bb9715f Fix for bad default directories in dialog options. Fixes #1052 2021-12-30 17:34:06 +11:00
Lea\Anthony
0f09e8d433 Fix signatures 2021-12-30 11:17:29 +11:00
Lea\Anthony
f338dff171 Fix EventsOff in JS runtime 2021-12-29 09:11:12 +11:00
Lea\Anthony
3c6ed12637 New build flag: -debug 2021-12-29 06:54:52 +11:00
Lea Anthony
e2f3a11a33 [mac] Fix for cancelling Dialogs. Fixes #1047 2021-12-28 20:04:30 +11:00
Lea Anthony
0571deb290 Merge pull request #1046 from buddyabaddon/master
Make linuxdb.yaml an embedded resource
2021-12-28 17:27:59 +11:00
Matt McKenzie
451b357e40 Make linuxdb.yaml an embedded resource 2021-12-27 18:22:03 -08:00
Lea\Anthony
84b67a8f53 Add -u flag to sync project go.mod with CLI version 2021-12-28 06:40:44 +11:00
Lea Anthony
448cf731bb [mac] Fix for Save Dialog 2021-12-27 20:09:03 +11:00
Lea\Anthony
9cb480f0f0 v2.0.0-beta.27 2021-12-27 19:40:56 +11:00
Lea\Anthony
6825a631f5 Commit MicrosoftEdgeWebview2Setup.exe 2021-12-27 19:40:19 +11:00
Lea\Anthony
39f91a030f v2.0.0-beta.26 2021-12-27 18:12:48 +11:00
Lea\Anthony
202e4d5be8 Actually commit sudo_mattn 2021-12-27 18:11:12 +11:00
Lea\Anthony
045e58778a Actually commit webview2runtime 2021-12-27 18:09:41 +11:00
Lea\Anthony
e375d60c67 Updated modules 2021-12-27 05:23:18 +11:00
Lea\Anthony
fcb5499d3a v2.0.0-beta.25 2021-12-27 05:21:17 +11:00
Lea\Anthony
dd5a54a8e0 Remove replace line 2021-12-27 05:21:17 +11:00
Lea Anthony
9f24a46b8a Merge pull request #1042 from flin7/patch-1
Add template for React
2021-12-26 21:19:53 +11:00
flin7
d7eaab97dd Add template for React 2021-12-26 17:21:19 +08:00
Lea\Anthony
a03d1e5ac5 v2.0.0-beta.24 2021-12-26 20:13:42 +11:00
Lea\Anthony
d5d4d88481 [v2] Fix webview2 runtime detection. Fixes #1038 2021-12-26 19:24:59 +11:00
Lea\Anthony
1c823b09c4 [v2] Fix compile issue 2021-12-25 08:54:23 +11:00
Lea\Anthony
e5732bcee1 [v2] Update to webview2runtime v1.3.0 2021-12-25 08:51:43 +11:00
Lea Anthony
c0f283335a [mac] Fix for submenu titles. Fixes #1026. 2021-12-24 08:00:37 +11:00
Lea\Anthony
64cdf64751 [v2] export interfaces in runtime.d.ts 2021-12-23 06:27:49 +11:00
Lea Anthony
609bfc35c0 Update options.mdx 2021-12-22 21:17:46 +11:00
Lea\Anthony
121d11db55 [v2] Update sponsors 2021-12-22 06:36:18 +11:00
Lea\Anthony
5c357f012d [v2] Update context error 2021-12-22 06:28:47 +11:00
Lea\Anthony
56285f8637 [v2] Update docs 2021-12-21 08:53:48 +11:00
Lea Anthony
b61158d329 Merge pull request #1030 from raitonoberu/patch-1
Add Svelte template
2021-12-21 08:04:23 +11:00
Denis
0233197073 Add wails-svelte-template 2021-12-20 20:40:42 +07:00
Lea\Anthony
d883397d75 Update sponsors 2021-12-20 20:24:22 +11:00
Lea\Anthony
5bd82c4637 Update sponsors 2021-12-16 07:41:33 +11:00
Lea\Anthony
e942867635 Update sponsors 2021-12-16 07:41:14 +11:00
Lea Anthony
29749ed7cb Merge pull request #1025 from AlienRecall/patch-1
Added react template
2021-12-16 07:35:22 +11:00
AlienRecall
0288f33556 Added react template 2021-12-15 13:53:25 +01:00
Lea\Anthony
ddeac08991 v2.0.0-beta.23 2021-12-15 19:36:45 +11:00
Lea Anthony
30e12d681c [mac] Fix for save dialog 2021-12-15 19:16:43 +11:00
Lea Anthony
f9fce9f2a7 Merge pull request #1024 from achhabra2/patch-1
Add Riftshare to community showcase
2021-12-15 06:15:16 +11:00
Aman Chhabra
9c5bb8c6eb Add Riftshare to community showcase 2021-12-14 07:22:35 -08:00
Lea Anthony
f2ab409284 Update README.md 2021-12-13 20:40:50 +11:00
Lea\Anthony
7c190810fd Update easyweb logo 2021-12-13 20:40:03 +11:00
Lea\Anthony
2b2cd21674 Update sponsors 2021-12-13 20:32:55 +11:00
Lea Anthony
f025234c85 Merge pull request #1021 from dedo1911/master
[v2] feature / Add flag to skip mod tidy
2021-12-13 05:58:53 +11:00
Dario Emerson
44035637f7 Add flag to skip mod tidy 2021-12-12 15:01:16 +01:00
Lea Anthony
008a5c70b9 [mac] Fix linking issue. Removed warnings. 2021-12-11 20:06:42 +11:00
Lea\Anthony
24eaef1604 [mac] fix dynamically linking UTIFramework during cgo build 2021-12-11 19:43:21 +11:00
Lea\Anthony
62adcab722 [mac] try dynamically linking UTIFramework during cgo build 2021-12-11 19:36:17 +11:00
Lea Anthony
e12b630dfb [mac] Attempt to fix 10.14 compilation issue 2021-12-11 07:29:47 +11:00
Lea\Anthony
81b3ecb056 v1.16.9 2021-12-10 19:04:22 +11:00
Lea\Anthony
b4d14644ee Only generate ico if not there 2021-12-10 19:04:10 +11:00
Lea\Anthony
69fd584c32 Update sponsors 2021-12-10 19:00:26 +11:00
Lea Anthony
3444ec50a7 Merge pull request #1017 from stffabi/feature/add-upx-info-windows
[docs] Add info about upx and antivirus vendors
2021-12-09 21:55:52 +11:00
stffabi
02d4c65e01 [docs] Add info about upx and antivirus vendors 2021-12-09 11:03:53 +01:00
Lea Anthony
efdcfe9985 [v2] Remove AllowFiles & AllowDirectories 2021-12-09 08:16:45 +11:00
Lea Anthony
5884b7a87c Update supported platforms 2021-12-08 19:50:11 +11:00
Lea\Anthony
7229446ce7 v2.0.0-beta.22 2021-12-08 19:17:45 +11:00
Lea Anthony
c355d63768 Update bug_report.md 2021-12-08 18:44:36 +11:00
Lea Anthony
eb0030adeb Merge pull request #1012 from meatherly/fix_for_950
Fix for #950
2021-12-08 07:36:10 +11:00
Lea Anthony
fe224d9ecd Merge pull request #1013 from stffabi/feature/fsfs-docs-improvements
[v2] Update docs with new assetdir management and add reloaddirs
2021-12-07 17:08:45 +11:00
stffabi
a98d55db58 [v2] Update wails.json with updated reloaddirs from wails dev 2021-12-07 03:34:51 +01:00
stffabi
f034163da5 [v2] Update wails.json with updated assetdir from wails dev
Makes the code consistent with the docs
2021-12-07 03:34:51 +01:00
stffabi
d8fe011509 [v2] Update docs with new assetdir management and add reloaddirs 2021-12-07 03:34:19 +01:00
stffabi
e7bb3b3e83 [v2] Omit empty assetdir and reloaddirs in wails.json 2021-12-07 03:26:55 +01:00
meatherly
3201206d4f locking the event manager before mutating it. this should resolve issue #950 2021-12-06 16:21:35 -06:00
Lea Anthony
69c14d2a5d Merge pull request #1001 from stffabi/feature/fsfs-assets
proposal: [v2] Support fs.FS for assets
2021-12-07 06:03:59 +11:00
stffabi
778cbe04d9 [v2] Add reloaddirs flag to add additional reload directories
This is interesting if someone uses an asset FS which is not an embed.FS,
but still has some special handling to include loading data from disk in
dev mode. E.g. one might conditionally use an embed.FS or os.DirFS
depending on the build mode.
2021-12-06 13:47:16 +01:00
stffabi
131a8f421d [v2] Infer assetDir from embed.FS
AssetDir is now inferred from the assets, if the assets is an
embed.FS, by taking the relativ path to the index.html joined with
the project root.

The assetDir flag still exists and can be used if the inferring doesn't
work, because the provided embed.FS wasn't defined in the main
package.
2021-12-06 13:47:16 +01:00
stffabi
6fcd4b7bd4 [v2] Support fs.FS for assets
Reloading changed asset files in dev mode will only work
if an embed.FS has been provided for the assets.
2021-12-06 08:50:39 +01:00
Lea Anthony
f3b2f6ab76 Merge pull request #1011 from misitebao/optimize-documentation
docs: synchronize and optimize documents
2021-12-06 17:37:44 +11:00
misitebao
b556e860c4 docs: fix document translation 2021-12-06 11:10:36 +08:00
misitebao
eb01a005dc docs: fix document translation 2021-12-06 11:09:22 +08:00
misitebao
6dcee51940 docs: optimize english documents 2021-12-06 11:06:08 +08:00
misitebao
4c7a53b72b docs: synchronize chinese documents 2021-12-06 11:05:37 +08:00
Lea\Anthony
73c9fba731 [website] Added Angular router guide 2021-12-05 22:23:02 +11:00
Lea\Anthony
0726ae9e83 [website] Added router guide 2021-12-05 22:18:52 +11:00
Lea\Anthony
9ba4ca10ca [website] Link to Awesome Wails 2021-12-05 19:31:42 +11:00
Lea\Anthony
38caa645e5 [v2] A better approach to delayed IPC 2021-12-05 14:23:48 +11:00
Lea Anthony
41507e966a [linux] Remove signal handlers. Weird errors. 2021-12-04 20:10:37 +11:00
Lea Anthony
3092f04bcf [linux] Clean up signal handlers 2021-12-04 14:35:32 +11:00
Lea\Anthony
ffc0765a2f [website] Add OnBeforeClose docs 2021-12-04 14:31:59 +11:00
Lea Anthony
ac803aa426 Merge pull request #1007 from Ironpark/feature/on_before_close
[v2] feature / on-before-close resolve #978
2021-12-04 14:17:58 +11:00
ironpark
92b63d9fad window delegate modify for onBeforeClose hook 2021-12-04 07:52:34 +09:00
ironpark
fda3323386 basic implement 2021-12-04 04:55:36 +09:00
Lea Anthony
b7a4aba5f3 Merge pull request #1004 from stffabi/feature/improve-processrequest
[v2] Improve processRequest: Handle errors and behave more like a webserver
2021-12-04 05:01:36 +11:00
Lea Anthony
7848a028e3 Merge pull request #1002 from ianmjones/fix-cannot-use-uri-as-string-error
Fix error: cannot use uri (type *_Ctype_char) as type string in argument to common.TranslateUriToFile.
2021-12-04 04:51:09 +11:00
stffabi
d827aafe89 [v2] Improve processRequest: Handle errors and behave more like a webserver
This also fixes that requests remain in "pending" state on
darwin if e.g. a file is not found or an error occurs during
loading of the file.
2021-12-03 16:41:51 +01:00
Ian M. Jones
db8094cd68 Fix error: cannot use uri (type *_Ctype_char) as type string in argument to common.TranslateUriToFile. 2021-12-03 15:25:58 +00:00
Lea Anthony
59d29dc12f Merge pull request #998 from marcio199226/master
added ytd app to showcase
2021-12-03 01:56:53 -08:00
Lea Anthony
7aad934dae Remove yarn.lock 2021-12-03 20:56:30 +11:00
Oskar
0b1e33748a added ytd app to showcase 2021-12-02 21:29:43 +01:00
Lea Anthony
97be694d2a Merge pull request #996 from stffabi/feature/improved-translate-uri
[v2] Improve translation of URI to file to be loaded
2021-12-02 05:38:04 -08:00
Lea Anthony
576e574399 Merge pull request #994 from stffabi/feature/fix-webresourcerequest-memoryleak
[v2] Fix memory leak in processRequest for windows and darwin
2021-12-02 04:01:22 -08:00
Lea Anthony
6d9a195830 Merge pull request #991 from stffabi/feature/windows-frameless-border
[windows] Support drawing a frame for frameless to support hiding the titlebar
2021-12-02 04:00:01 -08:00
stffabi
8107a8bd1e [v2] Improve translation of URI to file to be loaded 2021-12-02 11:53:32 +01:00
stffabi
47d783291d [windows] Support drawing a frame for frameless to support hiding the titlebar 2021-12-02 11:16:13 +01:00
stffabi
0295f8dee2 [v2] Fix memory leak in processRequest for windows and darwin 2021-12-02 11:04:24 +01:00
stffabi
d915f73c6c [v2] Remove replace and bump winc 2021-12-02 11:01:30 +01:00
Lea Anthony
187bf3085c Merge pull request #989 from stffabi/feature/non-blocking-backend-calls
[v2] Do not block during processing of messages
2021-12-02 01:17:03 -08:00
stffabi
a353a653d1 [windows] Replace dispatch with invoke 2021-12-01 13:24:54 +01:00
stffabi
155f1fde49 [v2] Do not block during processing of messages
On windows blocking here results in a blocked main thread
and a blocked webview.
2021-12-01 13:24:19 +01:00
Lea Anthony
ec1a535acb Merge pull request #988 from stffabi/feature/windows-versioninfo
[v2] Windows: Add file information for windows
2021-12-01 03:09:04 -08:00
stffabi
fb5bcdc364 [v2] Windows: Add file information for windows 2021-12-01 11:59:46 +01:00
stffabi
e6f42247e7 [v2] Add missing import 2021-12-01 11:51:43 +01:00
Lea Anthony
4bc0b30231 [linux] Support closing window, hide window on close. 2021-12-01 20:32:23 +11:00
Lea\Anthony
1cd2645b87 [v2] Fix logging in prod builds. Fixes #983 2021-12-01 19:39:00 +11:00
Lea\Anthony
7904d0aadc [v2] Remove export in experimental TS generation for bindings 2021-12-01 19:19:28 +11:00
Lea\Anthony
06fa6850a1 [v2] Update experimental TS generation for bindings 2021-12-01 19:17:57 +11:00
Lea\Anthony
485f5831ac [v2] Experimental TS generation for bindings 2021-11-30 22:14:29 +11:00
Lea Anthony
587bcd8e21 Merge pull request #980 from stffabi/feature/winarm64-port
[v2] windows: Add arm64 support
2021-11-30 01:25:30 -08:00
stffabi
d43b7b1882 [windows] Add arm64 support 2021-11-30 10:07:27 +01:00
Lea\Anthony
ca147143ad [website] Improve binding docs in "how does it work" guide 2021-11-30 19:49:21 +11:00
Lea\Anthony
3371967dad [website] Update bleeding edge guide 2021-11-30 19:15:58 +11:00
Lea\Anthony
b09825ab0f [website] Fix bleeding edge guide 2021-11-30 19:14:48 +11:00
Lea\Anthony
5edf45468c [website] Add bleeding edge guide 2021-11-30 19:14:20 +11:00
Lea\Anthony
507e8d5222 [v2] Fix slash escaping in git username 2021-11-30 19:02:20 +11:00
Lea Anthony
b9283009df Merge pull request #974 from letheanVPN/npm-json-update
Adding name and author, + json handling improvement
2021-11-29 23:48:47 -08:00
Lea Anthony
60ddaf449d Update Sponsors 2021-11-30 18:41:42 +11:00
Lea Anthony
5bad81e182 Merge pull request #982 from stffabi/feature/windows-startstate-only-once
[v2] windows: Do not apply WindowStartState on reloads
2021-11-29 10:55:42 -08:00
stffabi
2e15f22621 [v2] Windows do not apply WindowStartState on reloads 2021-11-29 15:14:03 +01:00
Lea Anthony
6a3a822640 [linux] Fix content length in responses 2021-11-29 20:32:09 +11:00
Lea Anthony
e5057e1627 [linux] Fix installing cli 2021-11-29 20:25:11 +11:00
Lea Anthony
0a8f720586 [linux] Hook up runtime Window methods 2021-11-29 20:19:18 +11:00
Lea Anthony
5dbfb447b1 [linux] Support drag. 2021-11-29 20:04:57 +11:00
Lea Anthony
1f21dfbcfd [v2] Improved runtime builds. 2021-11-29 20:04:38 +11:00
Lea Anthony
53481830a9 [linux] Basic webview working 2021-11-29 08:25:42 +11:00
Lea Anthony
7eb8e6456e [linux] Devtools + dispatch. 2021-11-28 20:35:40 +11:00
Lea Anthony
5f0352404b [linux] Add basic webview. 2021-11-28 14:21:02 +11:00
Lea Anthony
b036b8c547 [linux] Support Window start state. fixed warnings. 2021-11-28 08:40:10 +11:00
Lea Anthony
39ca977b18 [linux] basic windowing pt2 2021-11-27 20:36:48 +11:00
Lea Anthony
abc078fb1b Merge pull request #976 from misitebao/optimize-documentation
docs: optimize document
2021-11-25 03:54:55 -08:00
misitebao
166490845c docs: fix translation 2021-11-25 19:34:53 +08:00
misitebao
c2399e3620 docs: optimize document content links 2021-11-25 19:26:31 +08:00
Lea Anthony
a2890b6d0d Merge pull request #956 from wailsapp/dependabot/npm_and_yarn/v2/internal/runtime/js/ssri-6.0.2
Bump ssri from 6.0.1 to 6.0.2 in /v2/internal/runtime/js
2021-11-25 00:00:05 -08:00
Lea Anthony
a1dee989c7 Merge pull request #957 from wailsapp/dependabot/npm_and_yarn/v2/internal/runtime/js/browserslist-4.18.1
Bump browserslist from 4.11.1 to 4.18.1 in /v2/internal/runtime/js
2021-11-24 23:59:42 -08:00
Lea Anthony
6ff1dac925 Merge pull request #958 from wailsapp/dependabot/npm_and_yarn/v2/internal/runtime/js/path-parse-1.0.7
Bump path-parse from 1.0.6 to 1.0.7 in /v2/internal/runtime/js
2021-11-24 23:59:26 -08:00
Lea Anthony
0b011929bf Merge pull request #959 from wailsapp/dependabot/npm_and_yarn/v2/internal/runtime/js/y18n-4.0.3
Bump y18n from 4.0.0 to 4.0.3 in /v2/internal/runtime/js
2021-11-24 23:59:08 -08:00
Lea Anthony
be3d1ff9e1 Merge pull request #960 from wailsapp/dependabot/npm_and_yarn/v2/internal/runtime/js/lodash-4.17.21
Bump lodash from 4.17.15 to 4.17.21 in /v2/internal/runtime/js
2021-11-24 23:58:48 -08:00
Lea Anthony
9c73b7285f Merge pull request #975 from Juneezee/deprecate-ioutil
refactor: move from io/ioutil to io and os packages
2021-11-24 23:57:51 -08:00
Lea Anthony
810793aba7 Merge pull request #973 from misitebao/fix-image-path
docs: fix image path errors and optimize assets paths
2021-11-24 23:40:29 -08:00
Eng Zer Jun
ef8d7d2fd7 refactor: move from io/ioutil to io and os packages
The io/ioutil package has been deprecated as of Go 1.16, see
https://golang.org/doc/go1.16#ioutil. This commit replaces the existing
io/ioutil functions with their new definitions in io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-11-25 12:15:43 +08:00
Eng Zer Jun
ae341be638 chore: run go fmt ./... and go mod tidy
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-11-25 12:14:27 +08:00
Snider
dcef8679d2 Adding name and author, also found out while trying to find options for value escaping the string conversion isnt needed :)
Signed-off-by: Snider <snider@lt.hn>
2021-11-24 18:50:26 +00:00
misitebao
0bb09a53ea docs: fix image path errors and optimize assets paths 2021-11-25 02:13:56 +08:00
Lea Anthony
deb1156916 Merge pull request #970 from stffabi/feature/use-winc-invoke
[v2] Use invoke to dispatch callbacks on windows
2021-11-24 04:21:39 -08:00
stffabi
1d87a81f63 [v2] Use invoke to dispatch callbacks on windows 2021-11-24 13:05:31 +01:00
stffabi
8ef8b2528b [v2] Bump winc to 0330cfc6d50c 2021-11-24 13:05:30 +01:00
Lea Anthony
f05109232e Merge pull request #961 from wailsapp/dependabot/npm_and_yarn/v2/internal/runtime/js/elliptic-6.5.4
Bump elliptic from 6.5.2 to 6.5.4 in /v2/internal/runtime/js
2021-11-24 03:06:21 -08:00
Lea Anthony
cf1001bffc Merge pull request #962 from wailsapp/dependabot/npm_and_yarn/v2/internal/runtime/js/ini-1.3.8
Bump ini from 1.3.5 to 1.3.8 in /v2/internal/runtime/js
2021-11-24 03:06:01 -08:00
Lea Anthony
7bf2218c36 Merge pull request #967 from misitebao/synchronize-documents
docs: synchronize and optimize chinese documents
2021-11-24 03:05:21 -08:00
Lea Anthony
48c9879bc4 Merge pull request #966 from wailsapp/dependabot/npm_and_yarn/website/algoliasearch-helper-3.6.2
Bump algoliasearch-helper from 3.5.5 to 3.6.2 in /website
2021-11-24 03:02:41 -08:00
Lea Anthony
2fe5e5ed01 Merge pull request #971 from letheanVPN/npm-workspace
Adding workspace to npm which better integrates wails and frontend npm.
2021-11-24 03:01:43 -08:00
Snider
38fd09bd9a Adding workspace to npm which better integrates wails and frontend npm.
Running `npm install` will now run on the top level of a generated project and additionally the "frontend" workspace (we can add plugins for wails like this, auto update, package, sign, etc, etc)

Other commands that use workspaces (including pre/post hooks mostly) and might be helpful to Wails are `docs`, `install`, `rebuild`, `publish`, `pkg`, `pack`, `ci`

For example, during wails build, you could ask for data from the frontend/package.json to get version, title, etc with.

`npm pkg get name version --workspace=frontend`

Signed-off-by: Snider <snider@lt.hn>
2021-11-24 10:34:29 +00:00
misitebao
4c5a81782b docs: sync the latest blog content 2021-11-24 13:28:35 +08:00
misitebao
ace3122e07 docs: optimize blog content 2021-11-24 13:27:41 +08:00
misitebao
f5c35487d9 docs: synchronize and optimize chinese documents 2021-11-24 12:52:36 +08:00
dependabot[bot]
06df0e1ee4 Bump algoliasearch-helper from 3.5.5 to 3.6.2 in /website
Bumps [algoliasearch-helper](https://github.com/algolia/algoliasearch-helper-js) from 3.5.5 to 3.6.2.
- [Release notes](https://github.com/algolia/algoliasearch-helper-js/releases)
- [Changelog](https://github.com/algolia/algoliasearch-helper-js/blob/develop/CHANGELOG)
- [Commits](https://github.com/algolia/algoliasearch-helper-js/compare/3.5.5...3.6.2)

---
updated-dependencies:
- dependency-name: algoliasearch-helper
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-23 21:42:58 +00:00
Lea Anthony
9735bd1b01 [website] v2.0.0-beta.21 2021-11-24 06:58:09 +11:00
Lea Anthony
cd8bad58cd [v] v2.0.0-beta.21 2021-11-24 06:42:34 +11:00
Lea Anthony
53a3cd9422 Merge pull request #965 from stffabi/feature/winguildflag-crosscompile
[v2] Add windowsgui ldflag when crosscompiling for windows
2021-11-23 10:39:10 -08:00
stffabi
5e2f25af9b [v2] Add windowsgui ldflag when crosscompiling for windows 2021-11-23 14:16:50 +01:00
dependabot[bot]
865d118651 Bump ini from 1.3.5 to 1.3.8 in /v2/internal/runtime/js
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.8.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.8)

---
updated-dependencies:
- dependency-name: ini
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-23 11:51:06 +00:00
dependabot[bot]
6ea6bfeed0 Bump y18n from 4.0.0 to 4.0.3 in /v2/internal/runtime/js
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.3.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/y18n-v4.0.3/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/compare/v4.0.0...y18n-v4.0.3)

---
updated-dependencies:
- dependency-name: y18n
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-23 11:51:05 +00:00
dependabot[bot]
48527eb90a Bump lodash from 4.17.15 to 4.17.21 in /v2/internal/runtime/js
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.21)

---
updated-dependencies:
- dependency-name: lodash
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-23 11:51:05 +00:00
dependabot[bot]
33d8f98da9 Bump elliptic from 6.5.2 to 6.5.4 in /v2/internal/runtime/js
Bumps [elliptic](https://github.com/indutny/elliptic) from 6.5.2 to 6.5.4.
- [Release notes](https://github.com/indutny/elliptic/releases)
- [Commits](https://github.com/indutny/elliptic/compare/v6.5.2...v6.5.4)

---
updated-dependencies:
- dependency-name: elliptic
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-23 11:51:05 +00:00
dependabot[bot]
658a30d16a Bump path-parse from 1.0.6 to 1.0.7 in /v2/internal/runtime/js
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-23 11:51:04 +00:00
dependabot[bot]
0189d1cb55 Bump browserslist from 4.11.1 to 4.18.1 in /v2/internal/runtime/js
Bumps [browserslist](https://github.com/browserslist/browserslist) from 4.11.1 to 4.18.1.
- [Release notes](https://github.com/browserslist/browserslist/releases)
- [Changelog](https://github.com/browserslist/browserslist/blob/main/CHANGELOG.md)
- [Commits](https://github.com/browserslist/browserslist/compare/4.11.1...4.18.1)

---
updated-dependencies:
- dependency-name: browserslist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-23 11:51:01 +00:00
dependabot[bot]
8df94fa02b Bump ssri from 6.0.1 to 6.0.2 in /v2/internal/runtime/js
Bumps [ssri](https://github.com/npm/ssri) from 6.0.1 to 6.0.2.
- [Release notes](https://github.com/npm/ssri/releases)
- [Changelog](https://github.com/npm/ssri/blob/v6.0.2/CHANGELOG.md)
- [Commits](https://github.com/npm/ssri/compare/v6.0.1...v6.0.2)

---
updated-dependencies:
- dependency-name: ssri
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-11-23 11:51:00 +00:00
Lea Anthony
f5f89c31eb Merge pull request #955 from letheanVPN/generated-project-helper
Helper NPM scripts for developers working on a Wails GUI project
2021-11-23 03:50:29 -08:00
Snider
46cb34f2ec Adds a package.json with basic start / setup npm scripts to assist non golang developers working on an end project. 2021-11-23 11:22:25 +00:00
Lea Anthony
f6f13540c8 Merge pull request #954 from stffabi/feature/fix-mac-bgcolor
[macOS] Fix background color
2021-11-23 03:06:33 -08:00
stffabi
21ce7709ab [macOS] Fix background color 2021-11-23 11:18:00 +01:00
Lea Anthony
d569e37b81 [mac] Fix open panel in dev 2021-11-23 21:04:01 +11:00
Lea Anthony
c9c6edeb84 [mac] Fix fullscreen / start fullscreen 2021-11-23 20:06:56 +11:00
Lea Anthony
9525667ebd [windows] Add Frameless resize 2021-11-22 06:47:09 +11:00
Lea Anthony
28a3d86348 Merge pull request #951 from letheanVPN/snider-patch-1
Update Lethean project url
2021-11-20 01:07:43 -08:00
Snider
fc8aa58e62 Update Lethean project url 2021-11-20 07:10:41 +00:00
Lea Anthony
cb2bbacae8 Fix website 2021-11-20 18:02:23 +11:00
Lea Anthony
c3c6261a2d Update sponsors 2021-11-20 17:55:17 +11:00
Lea Anthony
8bfec24108 Support slices + out params in Models.ts generation. Update website with runtime info 2021-11-18 17:54:09 +11:00
Lea Anthony
9ad2665ad8 [mac] Conditionally import UTType header 2021-11-17 21:13:25 +11:00
Lea Anthony
28894868e3 [mac] Fix for file filters MacOS 11+. Some memory leak fixes. 2021-11-17 21:03:40 +11:00
Lea Anthony
a8fcd994c9 Merge branch '930_-_default_window_state' 2021-11-16 18:23:43 +11:00
Lea Anthony
c678ab7d01 [mac] Potential file dialog fix. Fix for starthidden. Partial WindowStartState 2021-11-16 18:20:41 +11:00
Lea Anthony
3a93c08813 [linux] basic windowing 2021-11-14 22:40:37 +11:00
Lea Anthony
ab1469638f [linux] get compiling working 2021-11-13 17:06:48 -08:00
Lea Anthony
9073caf287 Add build flag 2021-11-13 16:31:57 -08:00
Lea Anthony
1bed8234c9 [v2] Fix OnShutdown for production build 2021-11-11 06:05:50 +11:00
Lea Anthony
621c70253d [v2] Remove build constraint for DesktopIPC 2021-11-10 18:12:46 +11:00
Lea Anthony
56ef4ddd47 [v2] Add WindowStartState. Fix startHidden option. Only windows supported atm 2021-11-10 18:11:54 +11:00
Lea Anthony
bad9ad3dd7 [v2] Refactor app options 2021-11-10 08:42:04 +11:00
Lea Anthony
36570645ff [v2] v2.0.0-beta.20 2021-11-09 20:37:44 +11:00
Lea Anthony
3711bdc41e [v2] Add default wailsjsdir when generating module 2021-11-09 20:31:51 +11:00
Lea Anthony
cbdcd9f63e [v2] Add default wailsjsdir to templates 2021-11-09 20:31:31 +11:00
Lea Anthony
a9268bc56e [v2] Re-enable cli flags for assetdir if needed. Fixes debugging from IDE. 2021-11-09 20:11:34 +11:00
Lea Anthony
f489347fca [website] Update sponsors 2021-11-09 06:39:36 +11:00
Lea Anthony
663925f9e8 [v2] v2.0.0-beta.19 2021-11-08 21:03:42 +11:00
Lea Anthony
cc2651c377 [v2] Tidy up 2021-11-08 21:02:54 +11:00
Lea Anthony
e651b9c7ff [v2] Fix dev build when no dev command in project 2021-11-08 21:01:42 +11:00
Lea Anthony
bcad236fb6 [v2] Revert svelte template changes 2021-11-08 20:53:13 +11:00
Lea Anthony
0af8d506c1 [v2] v2.0.0-beta.18 2021-11-08 20:28:04 +11:00
Lea Anthony
0b65a0f508 [v2] Fix svelte template 2021-11-08 20:27:28 +11:00
Lea Anthony
b03a758747 [v2] v2.0.0-beta.17 2021-11-08 20:13:29 +11:00
Lea Anthony
44597f2fbc [v2] Fix svelte template 2021-11-08 20:12:29 +11:00
Lea Anthony
0844113f3a [v2] Fix vanilla template 2021-11-08 20:08:41 +11:00
Lea Anthony
79e99b68d6 [v2] Fix css in templates 2021-11-08 19:23:28 +11:00
Lea Anthony
c64b7bb79c [v2] v2.0.0-beta.16 2021-11-08 19:15:07 +11:00
Lea Anthony
e72b438ad2 [website] Fix blog 2021-11-08 19:13:54 +11:00
Lea Anthony
3e4a112a3d Merge pull request #922 from wailsapp/v2-mac-docs
V2 Mac updates
2021-11-08 08:12:07 +00:00
Lea Anthony
a020b67f67 [website] Fix desktop icon 2021-11-08 19:10:31 +11:00
Lea Anthony
fa958e7a07 [website] assetdir clarification 2021-11-08 17:38:30 +11:00
Lea Anthony
1a3e81a3f8 [website] Misc updates 2021-11-08 17:36:08 +11:00
Lea Anthony
0eb7a8a771 [v2] Update svelte template 2021-11-08 07:00:01 +11:00
Lea Anthony
2fa004808f [website] Update options example 2021-11-08 06:31:34 +11:00
Lea Anthony
cc5fd30256 [v2] Update vanilla template 2021-11-08 06:31:13 +11:00
Lea Anthony
c90bfc310a [mac] Fix lifecycle hooks 2021-11-06 10:40:02 +11:00
Lea Anthony
62d1d621aa [mac] Tidy up 2021-11-04 20:58:08 +11:00
Lea Anthony
6e8cbb8e8f [mac] Ensure minimum osx version 2021-11-04 20:45:22 +11:00
Lea Anthony
32fa543164 [website] Update docs 2021-11-03 19:25:42 +11:00
Lea Anthony
04f93ac54e [v2] Update go.mod 2021-11-03 19:24:12 +11:00
Lea Anthony
3c87d13b21 [mac] Fix fullscreen 2021-11-03 19:23:23 +11:00
Lea Anthony
0949eab72e [linux] add flag 2021-11-03 19:22:59 +11:00
Lea Anthony
aab67b416f [mac] add default menu 2021-11-03 19:22:38 +11:00
Lea Anthony
83a575e43f [v2] warn if wails version out of sync during build 2021-11-02 22:33:34 +11:00
Lea Anthony
333949ee53 [mac] better output text on build 2021-11-02 22:20:44 +11:00
Lea Anthony
1d1238cea3 [website] add cross compile 2021-11-02 22:19:59 +11:00
Lea Anthony
bd7b436631 [mac] Add fallback for app name 2021-11-02 22:05:42 +11:00
Lea Anthony
c136df48b9 [mac] Fix App Name in app menu 2021-11-02 22:04:06 +11:00
Lea Anthony
a090a689cf [mac] Fix plist generation 2021-11-02 21:56:35 +11:00
Lea Anthony
5ef2448a0c [website] updates 2021-11-02 21:00:56 +11:00
Lea Anthony
06ab4c88ad [website] updates 2021-11-02 20:54:42 +11:00
Lea Anthony
48efdea11a [website] updates 2021-11-02 20:54:13 +11:00
Lea Anthony
43cc55cb0a [mac] Small tweaks 2021-11-02 20:06:59 +11:00
Lea Anthony
71f2436562 [website] Add Mac options 2021-11-02 08:31:21 +11:00
Lea Anthony
4653c77a81 Merge branch 'master' into v2-mac-docs 2021-11-02 08:20:20 +11:00
Lea Anthony
72b05c6b44 Merge pull request #907 from phoenix147/appargs
Appargs
2021-11-02 07:23:00 +11:00
Lukas Crepaz
b5f68e24d6 added appargs for application arguments in dev mode 2021-11-01 08:57:10 +01:00
Lukas Crepaz
3948c8ca61 use environment variables to supply the development binary with flags to support CLI arguments in the app 2021-10-31 09:12:22 +01:00
Lea Anthony
cf3a868e3a [mac] Support MenuUpdateApplicationMenu 2021-10-31 15:09:50 +11:00
Lea Anthony
43c29abb23 Merge pull request #901 from misitebao/synchronize-chinese-documents
docs: synchronize chinese documents
2021-10-31 08:55:22 +11:00
Lea Anthony
7ef445f526 [mac] Improve string/memory handling, dialog icon -> []byte 2021-10-31 08:50:14 +11:00
misitebao
f6c2d4ae6b docs: synchronize all chinese documents 2021-10-31 04:32:38 +08:00
misitebao
8f9fae6ad9 docs: synchronize chinese readme logo size 2021-10-31 03:02:00 +08:00
misitebao
b45f264e2a docs: synchronize chinese readme 2021-10-31 02:55:01 +08:00
misitebao
986f8f48c7 docs: organize the readme 2021-10-31 02:54:22 +08:00
misitebao
bbc2e86286 docs: update chinese readme 2021-10-31 02:27:47 +08:00
Lea Anthony
2dc126bf19 [mac] Fix ExecJS 2021-10-30 19:28:25 +11:00
Lea Anthony
86cbcdc089 [mac] Move ops to main thread 2021-10-30 17:19:58 +11:00
Lea Anthony
1dd957f461 [mac] Fix SetPosition 2021-10-30 16:31:06 +11:00
Lea Anthony
4be4946756 [mac] Fix SetMaxSize 2021-10-30 11:07:07 +11:00
Lea Anthony
65979cbc75 Merge pull request #900 from misitebao/synchronize-chinese-documents
docs: synchronize chinese documents
2021-10-30 10:57:05 +11:00
Lea Anthony
6a7118ff6d [mac] Support cross compiling to windows 2021-10-30 10:44:22 +11:00
Lea Anthony
a88b3553ba [mac] Support min/max 2021-10-30 10:34:55 +11:00
Lea Anthony
fd5348d26d [v2] Fix build output 2021-10-30 10:33:30 +11:00
Lea Anthony
569569f1fc [mac] support amd/arm/universal 2021-10-30 10:19:49 +11:00
Lea Anthony
489b9b358b [mac] menu support 2021-10-30 09:51:46 +11:00
misitebao
71cfdfc7c8 feat: increase synchronized content 2021-10-29 03:15:42 +08:00
misitebao
6ebf4ed428 feat: synchronize some chinese documents 2021-10-29 03:15:04 +08:00
misitebao
5be0739c5d feat(website): synchronize chinese credits 2021-10-28 18:45:45 +08:00
Lea Anthony
6721e59277 [v2] Fix build command for dev mode 2021-10-28 19:24:05 +11:00
Lea Anthony
77775d85ab v1.16.8 2021-10-26 19:38:53 +11:00
Lea Anthony
6de0865c3e Merge pull request #896 from wailsapp/develop
Develop
2021-10-26 19:36:48 +11:00
Lea Anthony
f9e559f069 Merge branch 'master' into develop 2021-10-26 19:35:18 +11:00
Lea Anthony
9a4c603001 [v1] Update logrus to v1.8.1 2021-10-26 19:32:53 +11:00
Lea Anthony
98a95e99a5 [mac] Fixes #879 2021-10-26 19:28:15 +11:00
Lea Anthony
d19c982eed v2.0.0-beta.15 2021-10-26 19:21:41 +11:00
Lea Anthony
a963836e75 [v2] fix: check process exists before killing 2021-10-26 19:20:39 +11:00
Lea Anthony
00e9eb4b0b [v2] fix: run frontend:dev when using wails dev 2021-10-26 19:20:09 +11:00
Lea Anthony
262b6281e1 Update sponsors. Cheers DonTomato! 2021-10-26 19:05:07 +11:00
Lea Anthony
f66c70f0be Merge pull request #893 from Wakeful-Cloud/master
Fixed WindowGetSize
2021-10-25 19:20:47 +11:00
Wakeful-Cloud
717d373668 Fixed WindowGetSize 2021-10-24 18:00:47 -06:00
Lea Anthony
d29fa94aa4 Merge pull request #891 from Wakeful-Cloud/master
Fix TypeScript runtime declaration
2021-10-24 19:11:11 +11:00
Wakeful-Cloud
01dd0cd0b2 Fix TypeScript runtime declaration 2021-10-24 04:05:47 +00:00
Lea Anthony
126cc78d1a [v2] add overscroll-behavior 2021-10-24 09:03:05 +11:00
Lea Anthony
5703d465fc [v2] v2.0.0-beta.14 2021-10-23 08:52:02 +11:00
Lea Anthony
0c2963cf53 [windows] Add webview2 permissions 2021-10-23 07:17:58 +11:00
Lea Anthony
b61fd16936 [windows] Disable swipe navigation 2021-10-23 05:50:39 +11:00
Lea Anthony
3a8ba96cb3 [windows] Update webview2 to 91.0.992.28 2021-10-23 05:50:39 +11:00
Lea Anthony
3b1d74cf84 Merge pull request #886 from TAINCER/patch-1
Added Angular template to Community templates list
2021-10-22 17:11:50 +11:00
Lea Anthony
2e0a6f95a0 [website] Update dialog docs 2021-10-22 16:59:44 +11:00
Timm Ortloff
8470bfb26b Added Angular template to Community templates list 2021-10-22 06:47:03 +02:00
Lea Anthony
bea0c1446a [mac] dialog support 2021-10-22 08:42:36 +11:00
Lea Anthony
35ebbdfa12 [v2] Fix typo in templates 2021-10-22 08:42:35 +11:00
Lea Anthony
bb25b3f42f Update events.mdx 2021-10-20 20:31:58 +11:00
Lea Anthony
4a11f9bb20 Update sponsors 2021-10-20 17:40:57 +11:00
Lea Anthony
c1a20d0509 [mac] Fix SetRGBA and disabling context menus in prod build 2021-10-19 20:08:43 +11:00
Lea Anthony
32c3721b1b [mac] Fix webviewistransparent and debug flag 2021-10-19 20:07:36 +11:00
Lea Anthony
913cc56adf [v2] Add flag to remove default context menu 2021-10-19 20:06:18 +11:00
Lea Anthony
38f37e817b [mac] Get asset server hooked up, window drag, Window runtime. 2021-10-18 22:02:23 +11:00
Lea Anthony
4e68f92083 [v2] Add WindowGetPos & WindowGetSize 2021-10-18 21:42:02 +11:00
Lea Anthony
3edbda313e [mac] add SetRGBA and basic hooks for asset serving 2021-10-17 21:50:15 +11:00
Lea Anthony
04cde94c96 [windows] add build tags to browser runtime 2021-10-17 21:50:15 +11:00
Lea Anthony
1faa962cf5 Update README.md 2021-10-16 15:47:02 +11:00
Lea Anthony
94a74520be Update logo 2021-10-16 15:45:59 +11:00
Lea Anthony
27dd40fd29 Update logos 2021-10-16 08:57:28 +11:00
Lea Anthony
616ecabb41 [mac] migrated colour code 2021-10-14 20:38:11 +11:00
Lea Anthony
15cd325034 [mac] experimental 2021-10-14 20:35:45 +11:00
Lea Anthony
450eb2e7ae [mac] message passing, quit 2021-10-14 20:34:47 +11:00
Lea Anthony
84622b829c [website] Fix build 2021-10-14 17:55:01 +11:00
Lea Anthony
a1323ce5e9 [mac] experimental 2021-10-13 22:01:35 +11:00
Lea Anthony
49629f6dc6 [mac] Fix build tags 2021-10-13 21:16:07 +11:00
Lea Anthony
231848cb9e [mac] Don't create .app in dev 2021-10-13 21:16:06 +11:00
Lea Anthony
a51d8bb47d [v2] Move "AlwaysOnTop" option 2021-10-13 08:05:31 +11:00
Lea Anthony
e0e4c0ae11 [v2] Add "AlwaysOnTop" option 2021-10-13 08:02:35 +11:00
Lea Anthony
d47b3734af [v2] v2.0.0-beta.13 2021-10-12 20:47:03 +11:00
Lea Anthony
26d248a4b6 [v2] Add flag to disable scrollbar drag 2021-10-12 20:45:53 +11:00
Lea Anthony
6413a6fb4d Update Sponsors 2021-10-12 20:35:38 +11:00
Lea Anthony
5e36f4fc7f [v2] Remove chromium message on shutdown 2021-10-12 08:58:33 +11:00
Lea Anthony
b47c278c95 Merge pull request #868 from stankovic98/add-artix-linux
add artix linux distro
2021-10-12 08:54:16 +11:00
Lea Anthony
81a9619fd7 [v2] v2.0.0-beta.12 2021-10-12 06:53:35 +11:00
Lea Anthony
ce103af77b [v2] Update 'replace' line in go.mod 2021-10-12 06:51:22 +11:00
Lea Anthony
2649c3d17d [v2] Fix bindings.js 2021-10-12 06:34:01 +11:00
Lea Anthony
a35cc035b0 Merge pull request #867 from marktohark/master
add locker for websocket.WriteMessage
2021-10-12 06:21:53 +11:00
Antonio
a94a720a68 add artix linux distro 2021-10-11 17:16:24 +02:00
unknown
995fe38ee4 add locker for websocket.WriteMessage 2021-10-11 21:10:55 +08:00
Lea Anthony
7fd311f7a6 Merge pull request #865 from marktohark/master
add \r\n for awaitIPC callback
2021-10-11 22:50:47 +11:00
unknown
356774e3f7 use backtick with return 2021-10-11 19:41:45 +08:00
unknown
5d8653be83 add \r\n for awaitIPC callback 2021-10-11 16:41:11 +08:00
Lea Anthony
8b5bcdfeff [v2] v2.0.0-beta.11 2021-10-11 19:24:04 +11:00
Lea Anthony
f6655d019f [v2] Better errors 2021-10-11 19:23:31 +11:00
Lea Anthony
8f31183fa8 [v2] Fix client timeouts 2021-10-11 19:23:31 +11:00
Lea Anthony
64528b4f02 Merge pull request #863 from marcus-crane/master
Correct help text for enabling Debug log level
2021-10-11 17:56:25 +11:00
Marcus Crane
7945853294 Correct help text for enabling Debug log level
All in forms of documentation, the correct name for the second most verbose log level is "Debug" but under `wails dev --help`, it's called Dev

Trying to use it throws an error as well so correcting the name to be Debug
2021-10-11 13:31:28 +13:00
Lea Anthony
b0df3f5c39 [v2] v2.0.0-beta.10 2021-10-10 15:46:04 +11:00
Lea Anthony
7caf6af91d [v2] Fix websocket ipc timing bug. Use proper HTML parsing for injection. 2021-10-10 15:43:01 +11:00
Lea Anthony
dd7c6a3d58 [v2] v2.0.0-beta.9 2021-10-10 11:20:20 +11:00
Lea Anthony
cfbeb1efd1 [v2] Fix parsing multiline require in go.mod 2021-10-10 11:18:52 +11:00
Lea Anthony
3022b0bf3f [mac] Fix binary path in dev 2021-10-09 17:43:34 +11:00
Lea Anthony
3723c41d15 [mac] Fix binary path in build. Remove apple identity 2021-10-09 17:39:51 +11:00
Lea Anthony
2729081f2c [v2] v2.0.0-beta.8 2021-10-09 07:57:23 +11:00
Lea Anthony
cad1317fc8 [v2] Tags passthrough for wails generate module 2021-10-09 07:56:19 +11:00
Lea Anthony
1368c20029 [website] v2.0.0-beta.7 2021-10-09 00:06:39 +11:00
Lea Anthony
0acfdd1516 [website] v2.0.0-beta.6 2021-10-09 00:03:35 +11:00
Lea Anthony
212a20626a [website] Update go webview 2021-10-09 00:02:53 +11:00
Lea Anthony
722ecc969b [website] Update docs to v2.0.0-beta.5 2021-10-08 20:27:10 +11:00
Lea Anthony
3caa0f1438 v1.16.7 2021-09-03 19:15:37 +10:00
Florian Didron
b8ef90cb41 fix: prevent hidden files to show on gtk host when opening a file dialog 2021-09-03 19:12:47 +10:00
Lea Anthony
9efc648e3d Merge pull request #789 from diogox/develop
Add NixOS support
2021-09-03 18:55:53 +10:00
Diogo Xavier
baa96f47d8 Add NixOS support 2021-08-30 19:15:10 +01:00
Lea Anthony
184ce763c1 v1.16.6 2021-08-14 19:02:16 +10:00
Lea Anthony
229ee95f91 Don't build project by default. Added -build flag to wails init to mimic old behaviour 2021-08-14 19:00:35 +10:00
274 changed files with 11868 additions and 18578 deletions

View File

@@ -8,7 +8,7 @@ assignees: ''
---
#####################################################
**If you have a technical issue, please do not open a bug this way!**
**V1 users: If you have a technical issue, please do not open a bug this way!**
Please use the `wails issue` command!
If you do not do this then the issue may be closed automatically.
@@ -33,7 +33,7 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
**System Details**
Please provide your platform, GO version and variables, etc
V2 users: Please add the output of `wails doctor`.
**Additional context**
Add any other context about the problem here.

255
README.md
View File

@@ -1,59 +1,92 @@
<p align="center" style="text-align: center">
<img src="logo_cropped.png" width="40%"><br/>
<img src="logo.png" width="55%"><br/>
</p>
<p align="center">
Build desktop applications using Go & Web Technologies.<br/><br/>
<a href="https://github.com/wailsapp/wails/blob/master/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg"></a>
<a href="https://goreportcard.com/report/github.com/wailsapp/wails"><img src="https://goreportcard.com/badge/github.com/wailsapp/wails"/></a>
<a href="http://godoc.org/github.com/wailsapp/wails"><img src="https://img.shields.io/badge/godoc-reference-blue.svg"/></a>
<a href="https://www.codefactor.io/repository/github/wailsapp/wails"><img src="https://www.codefactor.io/repository/github/wailsapp/wails/badge" alt="CodeFactor" /></a>
<a href="https://github.com/wailsapp/wails/issues"><img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="CodeFactor" /></a>
<a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fwailsapp%2Fwails?ref=badge_shield" alt="FOSSA Status"><img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fwailsapp%2Fwails.svg?type=shield"/></a>
<a href="https://houndci.com"><img src="https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg"/></a>
<a href="https://github.com/avelino/awesome-go" rel="nofollow"><img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome"></a>
<a href="https://github.com/wailsapp/wails/workflows/release/badge.svg?branch=master" rel="nofollow"><img src="https://github.com/wailsapp/wails/workflows/release/badge.svg?branch=master" alt="Release Pipelines"></a>
Build desktop applications using Go & Web Technologies.<br/><br/>
<a href="https://github.com/wailsapp/wails/blob/master/LICENSE">
<img src="https://img.shields.io/badge/License-MIT-blue.svg">
</a>
<a href="https://goreportcard.com/report/github.com/wailsapp/wails">
<img src="https://goreportcard.com/badge/github.com/wailsapp/wails"/>
</a>
<a href="http://godoc.org/github.com/wailsapp/wails">
<img src="https://img.shields.io/badge/godoc-reference-blue.svg"/>
</a>
<a href="https://www.codefactor.io/repository/github/wailsapp/wails">
<img src="https://www.codefactor.io/repository/github/wailsapp/wails/badge" alt="CodeFactor" />
</a>
<a href="https://github.com/wailsapp/wails/issues">
<img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="CodeFactor" />
</a>
<a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fwailsapp%2Fwails?ref=badge_shield" alt="FOSSA Status">
<img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fwailsapp%2Fwails.svg?type=shield"/>
</a>
<a href="https://houndci.com">
<img src="https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg"/>
</a>
<a href="https://github.com/avelino/awesome-go" rel="nofollow">
<img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome"/>
</a>
<a href="https://github.com/wailsapp/wails/workflows/release/badge.svg?branch=master" rel="nofollow">
<img src="https://github.com/wailsapp/wails/workflows/release/badge.svg?branch=master" alt="Release Pipelines"/>
</a>
</p>
<span id="nav-1"></span>
## Internationalization
English | [简体中文](README.zh-Hans.md)
[English](README.md) | [简体中文](README.zh-Hans.md)
<span id="nav-2"></span>
## Table of Contents
<details>
<summary>Click me to Open/Close the directory listing</summary>
- [1. Internationalization](#nav-1)
- [2. Table of Contents](#nav-2)
- [3. Introduction](#nav-3)
- [3.1 Official Website](#nav-3-1)
- [4. Features](#nav-4)
- [5. Sponsors](#nav-5)
- [6. Installation](#nav-6)
- [6.1 MacOS](#nav-6-1)
- [6.2 Linux](#nav-6-2)
- [6.2.1 Debian/Ubuntu](#nav-6-2-1)
- [6.2.2 Arch Linux / ArchLabs / Ctlos Linux](#nav-6-2-2)
- [6.2.3 Centos](#nav-6-2-3)
- [6.2.4 Fedora](#nav-6-2-4)
- [6.2.5 VoidLinux & VoidLinux-musl](#nav-6-2-5)
- [6.2.6 Gentoo](#nav-6-2-6)
- [6.3 Windows](#nav-6-3)
- [7. Usage](#nav-7)
- [7.1 Next Steps](#nav-7-1)
- [8. FAQ](#nav-8)
- [9. Contributors](#nav-9)
- [10. Special Mentions](#nav-10)
- [12. Special Thanks](#nav-11)
</details>
<span id="nav-3"></span>
## Introductions
The traditional method of providing web interfaces to Go programs is via a built-in web server. Wails offers a different
approach: it provides the ability to wrap both Go code and a web frontend into a single binary. Tools are provided to
make this easy for you by handling project creation, compilation and bundling. All you have to do is get creative!
<span id="nav-3-1"></span>
### Official Website
The official docs can be found at [https://wails.app](https://wails.app).
Click [here](https://wails.io) if you are interested in trying out v2 Beta for Windows.
<span id="nav-2"></span>
## Contents
- [1. Internationalization](#nav-1)
- [2. Contents](#nav-2)
- [3. Features](#nav-3)
- [4. Sponsors](#nav-4)
- [5. Installation](#nav-5)
- [5.1 MacOS](#nav-5-1)
- [5.2 Linux](#nav-5-2)
- [5.2.1 Debian/Ubuntu](#nav-5-2-1)
- [5.2.2 Arch Linux / ArchLabs / Ctlos Linux](#nav-5-2-2)
- [5.2.3 Centos](#nav-5-2-3)
- [5.2.4 Fedora](#nav-5-2-4)
- [5.2.5 VoidLinux & VoidLinux-musl](#nav-5-2-5)
- [5.2.6 Gentoo](#nav-5-2-6)
- [5.3 Windows](#nav-5-3)
- [6. Installation](#nav-6)
- [7. Next Steps](#nav-7)
- [8. FAQ](#nav-8)
- [9. Contributors](#nav-9)
- [10. Special Mentions](#nav-10)
- [11. Special Thanks](#nav-11)
<span id="nav-3"></span>
<span id="nav-4"></span>
## Features
@@ -67,60 +100,79 @@ Click [here](https://wails.io) if you are interested in trying out v2 Beta for W
- Powerful cli tool
- Multiplatform
<span id="nav-4"></span>
<span id="nav-5"></span>
## Sponsors
This project is supported by these kind people / companies:
<p align="center">
<a href="https://www.easywebadv.it/" style="width:150px;">
<img src="website/static/img/easyweb.png" width="150"/>
</a>
</p>
<br/>
<br/>
<a href="https://github.com/sponsors/leaanthony" style="width:100px;">
<img src="sponsors/silver%20sponsor.png" width="100"/>
</a>
<a href="https://github.com/letheanVPN" style="width:100px;">
<img src="https://github.com/letheanVPN.png?size=100" width="100"/>
</a>
<br/>
<br/>
<a href="https://github.com/sponsors/leaanthony" style="width:100px;">
<img src="sponsors/bronze%20sponsor.png" width="100"/>
</a>
<a href="https://github.com/snider" style="width:100px;">
<img src="https://github.com/snider.png?size=100" width="100"/>
</a>
<a href="https://github.com/codydbentley" style="width:100px">
<img src="https://github.com/codydbentley.png?size=100" width="100"/>
</a>
<a href="https://github.com/CrackDavid" style="width:100px">
<img src="https://github.com/CrackDavid.png?size=100" width="100"/>
</a>
<br/>
<br/>
<a href="https://github.com/matryer" style="width:100px">
<img src="https://github.com/matryer.png" width="100"/>
</a>
<a href="https://www.jetbrains.com?from=Wails" style="width:100px">
<img src="jetbrains-grayscale.png" width="100"/>
<img src="/assets/images/jetbrains-grayscale.png" width="100"/>
</a>
<a href="https://github.com/tc-hib" style="width:55px;border-radius: 50%">
<img src="https://github.com/tc-hib.png?size=55" width="55" style="border-radius: 50%"/>
<a href="https://github.com/tc-hib" style="width:55px">
<img src="https://github.com/tc-hib.png?size=55" width="55"/>
</a>
<a href="https://github.com/picatz" style="width:50px;border-radius: 50%">
<img src="https://github.com/picatz.png?size=50" width="50" style="border-radius: 50%"/>
<a href="https://github.com/picatz" style="width:50px">
<img src="https://github.com/picatz.png?size=50" width="50"/>
</a>
<a href="https://github.com/tylertravisty" style="width:50px;border-radius: 50%">
<img src="https://github.com/tylertravisty.png?size=50" width="50" style="border-radius: 50%"/>
<a href="https://github.com/tylertravisty" style="width:50px">
<img src="https://github.com/tylertravisty.png?size=50" width="50"/>
</a>
<a href="https://github.com/akhudek" style="width:50px;border-radius: 50%">
<img src="https://github.com/akhudek.png?size=50" width="50" style="border-radius: 50%"/>
<a href="https://github.com/akhudek" style="width:50px">
<img src="https://github.com/akhudek.png?size=50" width="50"/>
</a>
<a href="https://github.com/trea" style="width:50px;border-radius: 50%">
<img src="https://github.com/trea.png?size=50" width="50" style="border-radius: 50%"/>
<a href="https://github.com/trea" style="width:50px">
<img src="https://github.com/trea.png?size=50" width="50"/>
</a>
<a href="https://github.com/LanguageAgnostic" style="width:55px;border-radius: 50%">
<img src="https://github.com/LanguageAgnostic.png?size=55" width="55" style="border-radius: 50%"/>
<a href="https://github.com/LanguageAgnostic" style="width:55px">
<img src="https://github.com/LanguageAgnostic.png?size=55" width="55"/>
</a>
<a href="https://github.com/fcjr" style="width:55px;border-radius: 50%">
<img src="https://github.com/fcjr.png?size=55" width="55" style="border-radius: 50%"/>
<a href="https://github.com/fcjr" style="width:55px">
<img src="https://github.com/fcjr.png?size=55" width="55"/>
</a>
<a href="https://github.com/nickarellano" style="width:60px;border-radius: 50%">
<img src="https://github.com/nickarellano.png?size=60" width="60" style="border-radius: 50%"/>
<a href="https://github.com/nickarellano" style="width:60px">
<img src="https://github.com/nickarellano.png?size=60" width="60"/>
</a>
<a href="https://github.com/bglw" style="width:65px;border-radius: 50%">
<img src="https://github.com/bglw.png?size=65" width="65" style="border-radius: 50%"/>
<a href="https://github.com/bglw" style="width:65px">
<img src="https://github.com/bglw.png?size=65" width="65"/>
</a>
<a href="https://github.com/jugglingjsons" style="width:50px;border-radius: 50%">
<img src="https://github.com/jugglingjsons.png?size=50" width="50" style="border-radius: 50%"/>
<a href="https://github.com/jugglingjsons" style="width:50px">
<img src="https://github.com/jugglingjsons.png?size=50" width="50"/>
</a>
<a href="https://github.com/marcus-crane" style="width:50px;border-radius: 50%">
<img src="https://github.com/marcus-crane.png?size=50" width="50" style="border-radius: 50%"/>
</a>
<a href="https://github.com/codydbentley" style="width:65px">
<img src="https://github.com/codydbentley.png?size=65" width="65"/>
<a href="https://github.com/marcus-crane" style="width:65px">
<img src="https://github.com/marcus-crane.png?size=65" width="65"/>
</a>
<a href="https://github.com/bbergshaven" style="width:45px">
<img src="https://github.com/bbergshaven.png?size=45" width="45"/>
@@ -128,9 +180,32 @@ This project is supported by these kind people / companies:
<a href="https://github.com/Gilgames000" style="width:45px">
<img src="https://github.com/Gilgames000.png?size=45" width="45"/>
</a>
<a href="https://github.com/ilgityildirim" style="width:50px">
<img src="https://github.com/ilgityildirim.png?size=50" width="50"/>
</a>
<a href="https://github.com/questrail" style="width:50px">
<img src="https://github.com/questrail.png?size=50" width="50"/>
</a>
<a href="https://github.com/DonTomato" style="width:45px">
<img src="https://github.com/DonTomato.png?size=45" width="45"/>
</a>
<a href="https://github.com/taigrr" style="width:45px">
<img src="https://github.com/taigrr.png?size=45" width="45"/>
</a>
<a href="https://github.com/charlie-dee" style="width:55px">
<img src="https://github.com/charlie-dee.png?size=55" width="55"/>
</a>
<a href="https://github.com/EdenNetworkItalia" style="width:65px">
<img src="https://github.com/EdenNetworkItalia.png?size=65" width="65"/>
</a>
<a href="https://github.com/michaelolson1996" style="width:55px">
<img src="https://github.com/michaelolson1996.png?size=55" width="55"/>
</a>
<a href="https://github.com/GargantuaX" style="width:45px">
<img src="https://github.com/GargantuaX.png?size=45" width="45"/>
</a>
<span id="nav-5"></span>
<span id="nav-6"></span>
## Installation
@@ -140,7 +215,7 @@ an installation of Go. The basic requirements are:
- Go 1.16
- npm
<span id="nav-5-1"></span>
<span id="nav-6-1"></span>
### MacOS
@@ -148,11 +223,11 @@ Make sure you have the xcode command line tools installed. This can be done by r
`xcode-select --install`
<span id="nav-5-2"></span>
<span id="nav-6-2"></span>
### Linux
<span id="nav-5-2-1"></span>
<span id="nav-6-2-1"></span>
#### Debian/Ubuntu
@@ -164,7 +239,7 @@ _Ubuntu: 16.04, 18.04, 19.04_
_Also succesfully tested on: Zorin 15, Parrot 4.7, Linuxmint 19, Elementary 5, Kali, Neon_, Pop!\_OS
<span id="nav-5-2-2"></span>
<span id="nav-6-2-2"></span>
#### Arch Linux / ArchLabs / Ctlos Linux
@@ -172,7 +247,7 @@ _Also succesfully tested on: Zorin 15, Parrot 4.7, Linuxmint 19, Elementary 5, K
_Also succesfully test on: Manjaro & ArcoLinux_
<span id="nav-5-2-3"></span>
<span id="nav-6-2-3"></span>
#### Centos
@@ -180,7 +255,7 @@ _Also succesfully test on: Manjaro & ArcoLinux_
_CentOS 6, 7_
<span id="nav-5-2-4"></span>
<span id="nav-6-2-4"></span>
#### Fedora
@@ -188,19 +263,19 @@ _CentOS 6, 7_
_Fedora 29, 30_
<span id="nav-5-2-5"></span>
<span id="nav-6-2-5"></span>
#### VoidLinux & VoidLinux-musl
`xbps-install gtk+3-devel webkit2gtk-devel`
<span id="nav-5-2-6"></span>
<span id="nav-6-2-6"></span>
#### Gentoo
`sudo emerge gtk+:3 webkit-gtk`
<span id="nav-5-3"></span>
<span id="nav-6-3"></span>
### Windows
@@ -208,21 +283,21 @@ Windows requires gcc and related tooling. The recommended download is
from [http://tdm-gcc.tdragon.net/download](http://tdm-gcc.tdragon.net/download). Once this is installed, you are good to
go.
<span id="nav-6"></span>
<span id="nav-7"></span>
## Installation
## Usage
**Ensure Go modules are enabled: GO111MODULE=on and go/bin is in your PATH variable.**
Installation is as simple as running the following command:
<pre style='color:white'>
```
go get -u github.com/wailsapp/wails/cmd/wails
</pre>
```
<span id="nav-7"></span>
<span id="nav-7-1"></span>
## Next Steps
### Next Steps
It is recommended at this stage to read the comprehensive documentation at [https://wails.app](https://wails.app).
@@ -292,11 +367,11 @@ It is recommended at this stage to read the comprehensive documentation at [http
<a href="https://github.com/SophieAu"><img src="https://github.com/SophieAu.png?size=40" width="40"/></a>
<a href="https://github.com/alexmat"><img src="https://github.com/alexmat.png?size=40" width="40"/></a>
<a href="https://github.com/RH12503"><img src="https://github.com/RH12503.png?size=40" width="40"/></a>
<a href="https://github.com/hi019"><img src="https://github.com/hi019.png?size=40" width="40"/></a></a>
<a href="https://github.com/Igogrek"><img src="https://github.com/Igogrek.png?size=40" width="40"/></a></a>
<a href="https://github.com/aschey"><img src="https://github.com/aschey.png?size=40" width="40"/></a></a>
<a href="https://github.com/akhudek"><img src="https://github.com/akhudek.png?size=40" width="40"/></a></a>
<a href="https://github.com/s12chung"><img src="https://github.com/s12chung.png?size=40" width="40"/></a></a>
<a href="https://github.com/hi019"><img src="https://github.com/hi019.png?size=40" width="40"/></a>
<a href="https://github.com/Igogrek"><img src="https://github.com/Igogrek.png?size=40" width="40"/></a>
<a href="https://github.com/aschey"><img src="https://github.com/aschey.png?size=40" width="40"/></a>
<a href="https://github.com/akhudek"><img src="https://github.com/akhudek.png?size=40" width="40"/></a>
<a href="https://github.com/s12chung"><img src="https://github.com/s12chung.png?size=40" width="40"/></a>
<span id="nav-10"></span>
@@ -332,13 +407,13 @@ This project was mainly coded to the following albums:
## Special Thanks
<p align="center" style="text-align: center">
<a href="https://pace.dev"><img src="pace.jpeg"/></a><br/>
A <i>huge<i/> thanks to <a href="https://pace.dev">Pace</a> for sponsoring the project and helping the efforts to get Wails ported to Apple Silicon!<br/><br/>
<a href="https://pace.dev"><img src="/assets/images/pace.jpeg"/></a><br/>
A <i>huge</i> thanks to <a href="https://pace.dev">Pace</a> for sponsoring the project and helping the efforts to get Wails ported to Apple Silicon!<br/><br/>
If you are looking for a Project Management tool that's powerful but quick and easy to use, check them out!<br/><br/>
</p>
<p align="center" style="text-align: center">
A special thank you to JetBrains for donating licenses to us!<br/><br/>
Please click the logo to let them know your appreciation!<br/><br/>
<a href="https://www.jetbrains.com?from=Wails"><img src="jetbrains-grayscale.png" width="30%"></a>
<a href="https://www.jetbrains.com?from=Wails"><img src="/assets/images/jetbrains-grayscale.png" width="30%"></a>
</p>

View File

@@ -1,61 +1,97 @@
<p align="center" style="text-align: center">
<img src="logo_cropped.png" width="40%"><br/>
<img src="logo.png" width="55%"><br/>
</p>
<p align="center">
使用 Go 和 Web 技术构建桌面应用程序。<br/><br/>
<a href="https://github.com/wailsapp/wails/blob/master/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg"></a>
<a href="https://goreportcard.com/report/github.com/wailsapp/wails"><img src="https://goreportcard.com/badge/github.com/wailsapp/wails"/></a>
<a href="http://godoc.org/github.com/wailsapp/wails"><img src="https://img.shields.io/badge/godoc-reference-blue.svg"/></a>
<a href="https://www.codefactor.io/repository/github/wailsapp/wails"><img src="https://www.codefactor.io/repository/github/wailsapp/wails/badge" alt="CodeFactor" /></a>
<a href="https://github.com/wailsapp/wails/issues"><img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="CodeFactor" /></a>
<a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fwailsapp%2Fwails?ref=badge_shield" alt="FOSSA Status"><img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fwailsapp%2Fwails.svg?type=shield"/></a>
<a href="https://houndci.com"><img src="https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg"/></a>
<a href="https://github.com/avelino/awesome-go" rel="nofollow"><img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome"></a>
<a href="https://github.com/wailsapp/wails/workflows/release/badge.svg?branch=master" rel="nofollow"><img src="https://github.com/wailsapp/wails/workflows/release/badge.svg?branch=master" alt="Release Pipelines"></a>
使用 Go 和 Web 技术构建桌面应用程序。<br/><br/>
<a href="https://github.com/wailsapp/wails/blob/master/LICENSE">
<img src="https://img.shields.io/badge/License-MIT-blue.svg">
</a>
<a href="https://goreportcard.com/report/github.com/wailsapp/wails">
<img src="https://goreportcard.com/badge/github.com/wailsapp/wails"/>
</a>
<a href="http://godoc.org/github.com/wailsapp/wails">
<img src="https://img.shields.io/badge/godoc-reference-blue.svg"/>
</a>
<a href="https://www.codefactor.io/repository/github/wailsapp/wails">
<img src="https://www.codefactor.io/repository/github/wailsapp/wails/badge" alt="CodeFactor" />
</a>
<a href="https://github.com/wailsapp/wails/issues">
<img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="CodeFactor" />
</a>
<a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fwailsapp%2Fwails?ref=badge_shield" alt="FOSSA Status">
<img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fwailsapp%2Fwails.svg?type=shield"/>
</a>
<a href="https://houndci.com">
<img src="https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg"/>
</a>
<a href="https://github.com/avelino/awesome-go" rel="nofollow">
<img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome"/>
</a>
<a href="https://github.com/wailsapp/wails/workflows/release/badge.svg?branch=master" rel="nofollow">
<img src="https://github.com/wailsapp/wails/workflows/release/badge.svg?branch=master" alt="Release Pipelines"/>
</a>
</p>
<span id="nav-1"></span>
## 国际化
[English](README.md) | 简体中文
向 Go 程序提供 Web 接口的传统方法是通过内置 Web 服务器。Wails 提供了一种不同的方法:它提供了将 Go 代码和 Web
前端都包装成单个二进制文件的能力。通过提供工具,可以很轻松的完成项目的创建、编译和打包。你所要做的就是发挥创意!
官方文档可以在 [https://wails.app](https://wails.app) 中找到。
国内镜像站点 [https://wails.top](https://wails.top)。
[English](README.md) | [简体中文](README.zh-Hans.md)
<span id="nav-2"></span>
## 内容目录
<details>
<summary>点我 打开/关闭 目录列表</summary>
- [1. 国际化](#nav-1)
- [2. 内容目录](#nav-2)
- [3. 特征](#nav-3)
- [4. 赞助商](#nav-4)
- [5. 安装](#nav-5)
- [5.1 MacOS](#nav-5-1)
- [5.2 Linux](#nav-5-2)
- [5.2.1 Debian/Ubuntu](#nav-5-2-1)
- [5.2.2 Arch Linux / ArchLabs / Ctlos Linux](#nav-5-2-2)
- [5.2.3 Centos](#nav-5-2-3)
- [5.2.4 Fedora](#nav-5-2-4)
- [5.2.5 VoidLinux & VoidLinux-musl](#nav-5-2-5)
- [5.2.6 Gentoo](#nav-5-2-6)
- [5.3 Windows](#nav-5-3)
- [3. 项目介绍](#nav-3)
- [3.1 官方网站](#nav-3-1)
- [4. 功能](#nav-4)
- [5. 赞助商](#nav-5)
- [6. 安装](#nav-6)
- [7. 下一步](#nav-7)
- [6.1 MacOS](#nav-6-1)
- [6.2 Linux](#nav-6-2)
- [6.2.1 Debian/Ubuntu](#nav-6-2-1)
- [6.2.2 Arch Linux / ArchLabs / Ctlos Linux](#nav-6-2-2)
- [6.2.3 Centos](#nav-6-2-3)
- [6.2.4 Fedora](#nav-6-2-4)
- [6.2.5 VoidLinux & VoidLinux-musl](#nav-6-2-5)
- [6.2.6 Gentoo](#nav-6-2-6)
- [6.3 Windows](#nav-6-3)
- [7. 使用方法](#nav-7)
- [7.1 下一步](#nav-7-1)
- [8. 常见问题](#nav-8)
- [9. 贡献者](#nav-9)
- [10. 特别提及](#nav-10)
- [11. 许可协议](#nav-11)
- [12. 特别感谢](#nav-12)
- [12. 特别感谢](#nav-11)
</details>
<span id="nav-3"></span>
## 特征
## 项目介绍
为 Go 程序提供 Web 界面的传统方法是通过内置 Web 服务器。Wails 提供了一种不同的方法:它提供了将 Go 代码和 Web
前端一起打包成单个二进制文件的能力。通过提供的工具,可以很轻松的完成项目的创建、编译和打包。你所要做的就是发挥想象力!
<span id="nav-3-1"></span>
### 官方网站
官方文档可以在 [https://wails.app](https://wails.app) 中找到。
如果您对适用于 Windows 的 v2 测试版感兴趣,可以点击[此处](https://wails.io)查看。
镜像网站:
- [中国大陆镜像站点 - https://wails.top](https://wails.top)
<span id="nav-4"></span>
## 功能
- 后端使用标准 Go
- 使用任意前端技术构建 UI 界面
@@ -67,56 +103,112 @@
- 强大的命令行工具
- 跨多个平台
<span id="nav-4"></span>
<span id="nav-5"></span>
## 赞助商
这个项目由以下这些人或者公司支持:
<p align="center">
<a href="https://www.easywebadv.it/" style="width:100px;">
<img src="website/static/img/easyweb.png" width="120"/>
</a>
</p>
<br/>
<br/>
<a href="https://github.com/sponsors/leaanthony" style="width:100px;">
<img src="sponsors/silver%20sponsor.png" width="100"/>
</a>
<a href="https://github.com/letheanVPN" style="width:100px;">
<img src="https://github.com/letheanVPN.png?size=100" width="100"/>
</a>
<br/>
<br/>
<a href="https://github.com/sponsors/leaanthony" style="width:100px;">
<img src="sponsors/bronze%20sponsor.png" width="100"/>
</a>
<a href="https://github.com/snider" style="width:100px;">
<img src="https://github.com/snider.png?size=100" width="100"/>
</a>
<a href="https://github.com/codydbentley" style="width:100px">
<img src="https://github.com/codydbentley.png?size=100" width="100"/>
</a>
<a href="https://github.com/CrackDavid" style="width:100px">
<img src="https://github.com/CrackDavid.png?size=100" width="100"/>
</a>
<br/>
<br/>
<a href="https://github.com/matryer" style="width:100px">
<img src="https://github.com/matryer.png" width="100"/>
</a>
<a href="https://www.jetbrains.com?from=Wails" style="width:100px">
<img src="jetbrains-grayscale.png" width="100"/>
<img src="/assets/images/jetbrains-grayscale.png" width="100"/>
</a>
<a href="https://github.com/tc-hib" style="width:55px;border-radius: 50%">
<img src="https://github.com/tc-hib.png?size=55" width="55" style="border-radius: 50%"/>
<a href="https://github.com/tc-hib" style="width:55px">
<img src="https://github.com/tc-hib.png?size=55" width="55"/>
</a>
<a href="https://github.com/picatz" style="width:50px;border-radius: 50%">
<img src="https://github.com/picatz.png?size=50" width="50" style="border-radius: 50%"/>
<a href="https://github.com/picatz" style="width:50px">
<img src="https://github.com/picatz.png?size=50" width="50"/>
</a>
<a href="https://github.com/tylertravisty" style="width:50px;border-radius: 50%">
<img src="https://github.com/tylertravisty.png?size=50" width="50" style="border-radius: 50%"/>
<a href="https://github.com/tylertravisty" style="width:50px">
<img src="https://github.com/tylertravisty.png?size=50" width="50"/>
</a>
<a href="https://github.com/akhudek" style="width:50px;border-radius: 50%">
<img src="https://github.com/akhudek.png?size=50" width="50" style="border-radius: 50%"/>
<a href="https://github.com/akhudek" style="width:50px">
<img src="https://github.com/akhudek.png?size=50" width="50"/>
</a>
<a href="https://github.com/trea" style="width:50px;border-radius: 50%">
<img src="https://github.com/trea.png?size=50" width="50" style="border-radius: 50%"/>
<a href="https://github.com/trea" style="width:50px">
<img src="https://github.com/trea.png?size=50" width="50"/>
</a>
<a href="https://github.com/LanguageAgnostic" style="width:55px;border-radius: 50%">
<img src="https://github.com/LanguageAgnostic.png?size=55" width="55" style="border-radius: 50%"/>
<a href="https://github.com/LanguageAgnostic" style="width:55px">
<img src="https://github.com/LanguageAgnostic.png?size=55" width="55"/>
</a>
<a href="https://github.com/snider" style="width:60px;border-radius: 50%">
<img src="https://github.com/snider.png?size=60" width="60" style="border-radius: 50%"/>
<a href="https://github.com/fcjr" style="width:55px">
<img src="https://github.com/fcjr.png?size=55" width="55"/>
</a>
<a href="https://github.com/fcjr" style="width:55px;border-radius: 50%">
<img src="https://github.com/fcjr.png?size=55" width="55" style="border-radius: 50%"/>
<a href="https://github.com/nickarellano" style="width:60px">
<img src="https://github.com/nickarellano.png?size=60" width="60"/>
</a>
<a href="https://github.com/nickarellano" style="width:60px;border-radius: 50%">
<img src="https://github.com/nickarellano.png?size=60" width="60" style="border-radius: 50%"/>
<a href="https://github.com/bglw" style="width:65px">
<img src="https://github.com/bglw.png?size=65" width="65"/>
</a>
<a href="https://github.com/bglw" style="width:65px;border-radius: 50%">
<img src="https://github.com/bglw.png?size=65" width="65" style="border-radius: 50%"/>
<a href="https://github.com/jugglingjsons" style="width:50px">
<img src="https://github.com/jugglingjsons.png?size=50" width="50"/>
</a>
<a href="https://github.com/jugglingjsons" style="width:50px;border-radius: 50%">
<img src="https://github.com/jugglingjsons.png?size=50" width="50" style="border-radius: 50%"/>
<a href="https://github.com/marcus-crane" style="width:65px">
<img src="https://github.com/marcus-crane.png?size=65" width="65"/>
</a>
<a href="https://github.com/marcus-crane" style="width:50px;border-radius: 50%">
<img src="https://github.com/marcus-crane.png?size=50" width="50" style="border-radius: 50%"/>
<a href="https://github.com/bbergshaven" style="width:45px">
<img src="https://github.com/bbergshaven.png?size=45" width="45"/>
</a>
<a href="https://github.com/Gilgames000" style="width:45px">
<img src="https://github.com/Gilgames000.png?size=45" width="45"/>
</a>
<a href="https://github.com/ilgityildirim" style="width:50px">
<img src="https://github.com/ilgityildirim.png?size=50" width="50"/>
</a>
<a href="https://github.com/questrail" style="width:50px">
<img src="https://github.com/questrail.png?size=50" width="50"/>
</a>
<a href="https://github.com/DonTomato" style="width:45px">
<img src="https://github.com/DonTomato.png?size=45" width="45"/>
</a>
<a href="https://github.com/taigrr" style="width:45px">
<img src="https://github.com/taigrr.png?size=45" width="45"/>
</a>
<a href="https://github.com/charlie-dee" style="width:55px">
<img src="https://github.com/charlie-dee.png?size=55" width="55"/>
</a>
<a href="https://github.com/EdenNetworkItalia" style="width:65px">
<img src="https://github.com/EdenNetworkItalia.png?size=65" width="65"/>
</a>
<a href="https://github.com/michaelolson1996" style="width:55px">
<img src="https://github.com/michaelolson1996.png?size=55" width="55"/>
</a>
<a href="https://github.com/GargantuaX" style="width:45px">
<img src="https://github.com/GargantuaX.png?size=45" width="45"/>
</a>
<span id="nav-5"></span>
<span id="nav-6"></span>
## 安装
@@ -125,7 +217,7 @@ Wails 使用 cgo 与原生渲染引擎结合,因此需要依赖一些平台的
- Go 1.16
- npm
<span id="nav-5-1"></span>
<span id="nav-6-1"></span>
### MacOS
@@ -133,11 +225,11 @@ Wails 使用 cgo 与原生渲染引擎结合,因此需要依赖一些平台的
`xcode-select --install`
<span id="nav-5-2"></span>
<span id="nav-6-2"></span>
### Linux
<span id="nav-5-2-1"></span>
<span id="nav-6-2-1"></span>
#### Debian/Ubuntu
@@ -149,7 +241,7 @@ _Ubuntu: 16.04, 18.04, 19.04_
_也成功测试了: Zorin 15, Parrot 4.7, Linuxmint 19, Elementary 5, Kali, Neon_, Pop!\_OS
<span id="nav-5-2-2"></span>
<span id="nav-6-2-2"></span>
#### Arch Linux / ArchLabs / Ctlos Linux
@@ -157,7 +249,7 @@ _也成功测试了: Zorin 15, Parrot 4.7, Linuxmint 19, Elementary 5, Kali, Neo
_也成功测试了: Manjaro & ArcoLinux_
<span id="nav-5-2-3"></span>
<span id="nav-6-2-3"></span>
#### Centos
@@ -165,7 +257,7 @@ _也成功测试了: Manjaro & ArcoLinux_
_CentOS 6, 7_
<span id="nav-5-2-4"></span>
<span id="nav-6-2-4"></span>
#### Fedora
@@ -173,39 +265,39 @@ _CentOS 6, 7_
_Fedora 29, 30_
<span id="nav-5-2-5"></span>
<span id="nav-6-2-5"></span>
#### VoidLinux & VoidLinux-musl
`xbps-install gtk+3-devel webkit2gtk-devel`
<span id="nav-5-2-6"></span>
<span id="nav-6-2-6"></span>
#### Gentoo
`sudo emerge gtk+:3 webkit-gtk`
<span id="nav-5-3"></span>
<span id="nav-6-3"></span>
### Windows
Windows 需要 GCC 和相关工具。 建议从 [http://tdm-gcc.tdragon.net/download](http://tdm-gcc.tdragon.net/download) 下载, 安装完成,您就可以开始了。
<span id="nav-6"></span>
<span id="nav-7"></span>
## 安装
## 使用方法
**确保 Go modules 是开启的GO111MODULE=on 并且 go/bin 在您的 PATH 变量中。**
安装很简单,运行以下命令:
<pre style='color:white'>
```
go get -u github.com/wailsapp/wails/cmd/wails
</pre>
```
<span id="nav-7"></span>
<span id="nav-7-1"></span>
## 下一步
### 下一步
建议在此时阅读 [https://wails.app](https://wails.app) 上面的文档.
@@ -217,14 +309,14 @@ go get -u github.com/wailsapp/wails/cmd/wails
取决于您的要求。它旨在使 Go 程序员可以轻松制作轻量级桌面应用程序或在其现有应用程序中添加前端。尽管 Wails 当前不提供对诸如菜单之类的原生元素的钩子,但将来可能会改变。
- 这个项目针对的是?
- 这个项目针对的是哪些人?
希望将 HTML / JS / CSS 前端与其应用程序捆绑在一起的程序员,而不是借助创建服务并打开浏览器进行查看的方式。
- 名字怎么来的?
当我看到 WebView 时,我想"我真正想要的是围绕构建 WebView 应用程序工作,有点像 Rails 对于 Ruby"。因此最初它是一个文字游戏Webview on
Rails。碰巧也是我来自的 [国家](https://en.wikipedia.org/wiki/Wales) 的英文名字的同音。所以就是了。
Rails。碰巧也是我来自的 [国家](https://en.wikipedia.org/wiki/Wales) 的英文名字的同音。所以就是了。
<span id="nav-9"></span>
@@ -271,10 +363,11 @@ go get -u github.com/wailsapp/wails/cmd/wails
<a href="https://github.com/SophieAu"><img src="https://github.com/SophieAu.png?size=40" width="40"/></a>
<a href="https://github.com/alexmat"><img src="https://github.com/alexmat.png?size=40" width="40"/></a>
<a href="https://github.com/RH12503"><img src="https://github.com/RH12503.png?size=40" width="40"/></a>
<a href="https://github.com/hi019"><img src="https://github.com/hi019.png?size=40" width="40"/></a></a>
<a href="https://github.com/Igogrek"><img src="https://github.com/Igogrek.png?size=40" width="40"/></a></a>
<a href="https://github.com/aschey"><img src="https://github.com/aschey.png?size=40" width="40"/></a></a>
<a href="https://github.com/akhudek"><img src="https://github.com/akhudek.png?size=40" width="40"/></a></a>
<a href="https://github.com/hi019"><img src="https://github.com/hi019.png?size=40" width="40"/></a>
<a href="https://github.com/Igogrek"><img src="https://github.com/Igogrek.png?size=40" width="40"/></a>
<a href="https://github.com/aschey"><img src="https://github.com/aschey.png?size=40" width="40"/></a>
<a href="https://github.com/akhudek"><img src="https://github.com/akhudek.png?size=40" width="40"/></a>
<a href="https://github.com/s12chung"><img src="https://github.com/s12chung.png?size=40" width="40"/></a>
<span id="nav-10"></span>
@@ -284,9 +377,9 @@ go get -u github.com/wailsapp/wails/cmd/wails
- [Dustin Krysak](https://wiki.ubuntu.com/bashfulrobot) - 他的支持和反馈是巨大的。
- [Serge Zaitsev](https://github.com/zserge) - Wails 窗口所使用的 [Webview](https://github.com/zserge/webview) 的作者。
- [Byron](https://github.com/bh90210) - 有时Byron 单枪匹马地保持这个项目活着。没有他令人难以置信的投入,我们永远不会得到 v1 。
- [Byron](https://github.com/bh90210) - 有时Byron 一个人保持这个项目活着。没有他令人难以置信的投入,我们永远不会得到 v1 。
This project was mainly coded to the following albums:
编写项目代码时伴随着以下专辑:
- [Manic Street Preachers - Resistance Is Futile](https://open.spotify.com/album/1R2rsEUqXjIvAbzM0yHrxA)
- [Manic Street Preachers - This Is My Truth, Tell Me Yours](https://open.spotify.com/album/4VzCL9kjhgGQeKCiojK1YN)
@@ -304,22 +397,16 @@ This project was mainly coded to the following albums:
<span id="nav-11"></span>
## 许可协议
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fwailsapp%2Fwails.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fwailsapp%2Fwails?ref=badge_large)
<span id="nav-12"></span>
## 特别感谢
<p align="center" style="text-align: center">
<a href="https://pace.dev"><img src="pace.jpeg"/></a><br/>
<i>非常<i/>感谢<a href="https://pace.dev">Pace</a>对项目的赞助,并帮助将 Wails 移植到 Apple Silicon !<br/><br/>
<a href="https://pace.dev"><img src="/assets/images/pace.jpeg"/></a><br/>
<i>非常</i> 感谢<a href="https://pace.dev">Pace</a>对项目的赞助,并帮助将 Wails 移植到 Apple Silicon !<br/><br/>
如果您正在寻找一个强大并且快速和易于使用的项目管理工具,可以看看他们!<br/><br/>
</p>
<p align="center" style="text-align: center">
特别感谢 JetBrains 向我们捐赠许可!<br/><br/>
请点击 logo 让他们知道你的感激之情!<br/><br/>
<a href="https://www.jetbrains.com?from=Wails"><img src="jetbrains-grayscale.png" width="30%"></a>
<a href="https://www.jetbrains.com?from=Wails"><img src="/assets/images/jetbrains-grayscale.png" width="30%"></a>
</p>

View File

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -6,7 +6,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"os"
"path"
@@ -50,7 +49,7 @@ func (fs *FSHelper) FileExists(path string) bool {
// FindFile returns the first occurrence of match inside path.
func (fs *FSHelper) FindFile(path, match string) (string, error) {
files, err := ioutil.ReadDir(path)
files, err := os.ReadDir(path)
if err != nil {
return "", err
}
@@ -69,7 +68,7 @@ func (fs *FSHelper) FindFile(path, match string) (string, error) {
func (fs *FSHelper) CreateFile(filename string, data []byte) error {
// Ensure directory exists
fs.MkDirs(filepath.Dir(filename))
return ioutil.WriteFile(filename, data, 0644)
return os.WriteFile(filename, data, 0644)
}
// MkDirs creates the given nested directories.
@@ -149,21 +148,11 @@ func (fs *FSHelper) LocalDir(dir string) (*Dir, error) {
}, err
}
// LoadRelativeFile loads the given file relative to the caller's directory
func (fs *FSHelper) LoadRelativeFile(relativePath string) ([]byte, error) {
_, filename, _, _ := runtime.Caller(0)
fullPath, err := filepath.Abs(filepath.Join(path.Dir(filename), relativePath))
if err != nil {
return nil, err
}
return ioutil.ReadFile(fullPath)
}
// GetSubdirs will return a list of FQPs to subdirectories in the given directory
func (d *Dir) GetSubdirs() (map[string]string, error) {
// Read in the directory information
fileInfo, err := ioutil.ReadDir(d.fullPath)
fileInfo, err := os.ReadDir(d.fullPath)
if err != nil {
return nil, err
}
@@ -215,7 +204,7 @@ func (fs *FSHelper) SaveAsJSON(data interface{}, filename string) error {
e.SetIndent("", " ")
e.Encode(data)
err := ioutil.WriteFile(filename, buf.Bytes(), 0755)
err := os.WriteFile(filename, buf.Bytes(), 0755)
if err != nil {
return err
}
@@ -231,7 +220,7 @@ func (fs *FSHelper) LoadAsString(filename string) (string, error) {
// LoadAsBytes returns the contents of the file as a byte slice
func (fs *FSHelper) LoadAsBytes(filename string) ([]byte, error) {
return ioutil.ReadFile(filename)
return os.ReadFile(filename)
}
// FileMD5 returns the md5sum of the given file

View File

@@ -3,7 +3,7 @@ package cmd
import (
"encoding/json"
"fmt"
"io/ioutil"
"io"
"net/http"
"sort"
)
@@ -28,7 +28,7 @@ func (g *GitHubHelper) GetVersionTags() ([]*SemanticVersion, error) {
if err != nil {
return result, err
}
body, err := ioutil.ReadAll(resp.Body)
body, err := io.ReadAll(resp.Body)
if err != nil {
return result, err
}

View File

@@ -2,7 +2,6 @@ package cmd
import (
"fmt"
"io/ioutil"
"net/url"
"os"
"runtime"
@@ -71,6 +70,12 @@ const (
Crux
// RHEL distribution
RHEL
// NixOS distribution
NixOS
// Artix linux distribution
ArtixLinux
//Uos distribution
Uos
)
// DistroInfo contains all the information relating to a linux distribution
@@ -91,7 +96,7 @@ func GetLinuxDistroInfo() *DistroInfo {
}
_, err := os.Stat("/etc/os-release")
if !os.IsNotExist(err) {
osRelease, _ := ioutil.ReadFile("/etc/os-release")
osRelease, _ := os.ReadFile("/etc/os-release")
result = parseOsRelease(string(osRelease))
}
return result
@@ -183,6 +188,12 @@ func parseOsRelease(osRelease string) *DistroInfo {
result.Distribution = EndeavourOS
case "crux":
result.Distribution = Crux
case "nixos":
result.Distribution = NixOS
case "artix":
result.Distribution = ArtixLinux
case "uos":
result.Distribution = Uos
default:
result.Distribution = Unknown
}
@@ -274,6 +285,18 @@ func PrtGetInstalled(packageName string) (bool, error) {
return exitCode == 0, nil
}
// NixEnvInstalled uses nix-env to see if a package is installed
func NixEnvInstalled(packageName string) (bool, error) {
program := NewProgramHelper()
nixEnv := program.FindProgram("nix-env")
if nixEnv == nil {
return false, fmt.Errorf("cannot check dependencies: nix-env not found")
}
packageName = strings.ReplaceAll(packageName, "+", `\+`)
_, _, exitCode, _ := nixEnv.Run("-q", packageName)
return exitCode == 0, nil
}
// RequestSupportForDistribution promts the user to submit a request to support their
// currently unsupported distribution
func RequestSupportForDistribution(distroInfo *DistroInfo) error {

View File

@@ -1,11 +1,15 @@
package cmd
import (
_ "embed"
"log"
"gopkg.in/yaml.v3"
)
//go:embed linuxdb.yaml
var LinuxDBYaml []byte
// LinuxDB is the database for linux distribution data.
type LinuxDB struct {
Distributions map[string]*Distribution `yaml:"distributions"`
@@ -78,14 +82,10 @@ func (l *LinuxDB) GetDistro(distro string) *Distribution {
// NewLinuxDB creates a new LinuxDB instance from the bundled
// linuxdb.yaml file.
func NewLinuxDB() *LinuxDB {
data, err := fs.LoadRelativeFile("./linuxdb.yaml")
if err != nil {
log.Fatal("Could not load linuxdb.yaml")
}
result := LinuxDB{
Distributions: make(map[string]*Distribution),
}
err = result.ImportData(data)
err := result.ImportData(LinuxDBYaml)
if err != nil {
log.Fatal(err)
}

View File

@@ -100,6 +100,15 @@ distributions:
gccversioncommand: *gccdumpfullversion
programs: *debiandefaultprograms
libraries: *debiandefaultlibraries
uos:
id: uos
releases:
default:
version: default
name: Uos
gccversioncommand: *gccdumpfullversion
programs: *debiandefaultprograms
libraries: *debiandefaultlibraries
void:
id: void
releases:
@@ -213,6 +222,15 @@ distributions:
gccversioncommand: *gccdumpversion
programs: *archdefaultprograms
libraries: *archdefaultlibraries
artix:
id: artix
releases:
default:
version: default
name: Artix Linux
gccversioncommand: *gccdumpversion
programs: *archdefaultprograms
libraries: *archdefaultlibraries
ctlos:
id: ctlos
releases:
@@ -345,3 +363,22 @@ distributions:
help: Please install with `sudo prt-get depinst gtk3` and try again
- name: webkitgtk
help: Please install with `sudo prt-get depinst webkitgtk` and try again
nixos:
id: nixos
releases:
default:
version: default
name: NixOS
gccversioncommand: *gccdumpversion
programs:
- name: gcc
help: Please install with `nix-env -iA nixos.gcc`
- name: pkg-config
help: Please install with `nix-env -iA nixos.pkg-config`
- name: npm
help: Please install with `nix-env -iA nixos.nodejs`
libraries:
- name: gtk+3
help: Please install with `nix-env -iA nixos.gtk3`
- name: webkitgtk
help: Please install with `nix-env -iA nixos.nodePackages.webkitgtk`

View File

@@ -7,7 +7,6 @@ import (
"fmt"
"image"
"image/png"
"io/ioutil"
"os"
"path"
"path/filepath"
@@ -244,7 +243,7 @@ func (b *PackageHelper) packageOSX(po *ProjectOptions) error {
// No - create a new plist from our defaults
tmpl := template.New("infoPlist")
plistFile := filepath.Join(b.getPackageFileBaseDir(), "info.plist")
infoPlist, err := ioutil.ReadFile(plistFile)
infoPlist, err := os.ReadFile(plistFile)
if err != nil {
return err
}
@@ -258,13 +257,13 @@ func (b *PackageHelper) packageOSX(po *ProjectOptions) error {
}
// Save to the package
err = ioutil.WriteFile(plistFilename, tpl.Bytes(), 0644)
err = os.WriteFile(plistFilename, tpl.Bytes(), 0644)
if err != nil {
return err
}
// Also write to project directory for customisation
err = ioutil.WriteFile(customPlist, tpl.Bytes(), 0644)
err = os.WriteFile(customPlist, tpl.Bytes(), 0644)
if err != nil {
return err
}
@@ -314,10 +313,12 @@ func (b *PackageHelper) PackageWindows(po *ProjectOptions, cleanUp bool) error {
return err
}
// Generate icon from PNG
err = generateWindowsIcon(icon, basename+".ico")
if err != nil {
return err
// Generate icon from PNG if it doesn't exist
if !fs.FileExists(basename + ".ico") {
err = generateWindowsIcon(icon, basename+".ico")
if err != nil {
return err
}
}
// Copy manifest
@@ -334,12 +335,12 @@ func (b *PackageHelper) PackageWindows(po *ProjectOptions, cleanUp bool) error {
tgtRCFile := filepath.Join(outputDir, basename+".rc")
if !b.fs.FileExists(tgtRCFile) {
srcRCfile := filepath.Join(b.getPackageFileBaseDir(), "wails.rc")
rcfilebytes, err := ioutil.ReadFile(srcRCfile)
rcfilebytes, err := os.ReadFile(srcRCfile)
if err != nil {
return err
}
rcfiledata := strings.Replace(string(rcfilebytes), "$NAME$", basename, -1)
err = ioutil.WriteFile(tgtRCFile, []byte(rcfiledata), 0755)
err = os.WriteFile(tgtRCFile, []byte(rcfiledata), 0755)
if err != nil {
return err
}
@@ -387,11 +388,11 @@ func (b *PackageHelper) copyIcon() (string, error) {
// Install default icon
iconfile := filepath.Join(b.getPackageFileBaseDir(), "icon.png")
iconData, err := ioutil.ReadFile(iconfile)
iconData, err := os.ReadFile(iconfile)
if err != nil {
return "", err
}
err = ioutil.WriteFile(srcIcon, iconData, 0644)
err = os.WriteFile(srcIcon, iconData, 0644)
if err != nil {
return "", err
}

View File

@@ -3,7 +3,6 @@ package cmd
import (
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"runtime"
@@ -310,14 +309,14 @@ func (po *ProjectOptions) WriteProjectConfig() error {
return err
}
return ioutil.WriteFile(targetFile, filedata, 0600)
return os.WriteFile(targetFile, filedata, 0600)
}
// LoadConfig loads the project configuration file from the
// given directory
func (po *ProjectOptions) LoadConfig(projectDir string) error {
targetFile := filepath.Join(projectDir, "project.json")
rawBytes, err := ioutil.ReadFile(targetFile)
rawBytes, err := os.ReadFile(targetFile)
if err != nil {
return err
}

View File

@@ -3,7 +3,6 @@ package cmd
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
@@ -124,7 +123,7 @@ func (s *SystemHelper) setup() error {
if err != nil {
return err
}
err = ioutil.WriteFile(s.wailsSystemConfig, configData, 0755)
err = os.WriteFile(s.wailsSystemConfig, configData, 0755)
if err != nil {
return err
}
@@ -207,11 +206,11 @@ func (sc *SystemConfig) Save(filename string) error {
}
// Write it out to the config file
return ioutil.WriteFile(filename, theJSON, 0644)
return os.WriteFile(filename, theJSON, 0644)
}
func (sc *SystemConfig) load(filename string) error {
configData, err := ioutil.ReadFile(filename)
configData, err := os.ReadFile(filename)
if err != nil {
return err
}
@@ -279,9 +278,9 @@ func CheckDependencies(logger *Logger) (bool, error) {
distroInfo := GetLinuxDistroInfo()
switch distroInfo.Distribution {
case Ubuntu, Debian, Zorin, Parrot, Linuxmint, Elementary, Kali, Neon, Deepin, Raspbian, PopOS:
case Ubuntu, Debian, Zorin, Parrot, Linuxmint, Elementary, Kali, Neon, Deepin, Raspbian, PopOS, Uos:
libraryChecker = DpkgInstalled
case Arch, ArcoLinux, ArchLabs, Ctlos, Manjaro, ManjaroARM, EndeavourOS:
case Arch, ArcoLinux, ArchLabs, Ctlos, Manjaro, ManjaroARM, EndeavourOS, ArtixLinux:
libraryChecker = PacmanInstalled
case CentOS, Fedora, Tumbleweed, Leap, RHEL:
libraryChecker = RpmInstalled
@@ -293,6 +292,8 @@ func CheckDependencies(logger *Logger) (bool, error) {
libraryChecker = EOpkgInstalled
case Crux:
libraryChecker = PrtGetInstalled
case NixOS:
libraryChecker = NixEnvInstalled
default:
return false, RequestSupportForDistribution(distroInfo)
}

View File

@@ -4,8 +4,8 @@ import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"runtime"
"strings"
@@ -125,7 +125,7 @@ func (t *TemplateHelper) LoadMetadata(dir string) (*TemplateMetadata, error) {
if !t.fs.FileExists(templateFile) {
return nil, nil
}
rawJSON, err := ioutil.ReadFile(templateFile)
rawJSON, err := os.ReadFile(templateFile)
if err != nil {
return nil, err
}

View File

@@ -1,4 +1,4 @@
package cmd
// Version - Wails version
const Version = "v1.16.5"
const Version = "v1.16.9"

View File

@@ -3,7 +3,6 @@ package main
import (
"bufio"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
@@ -305,7 +304,7 @@ func updateWailsVersion(currentVersion, latestVersion *semver.Version) error {
new := fmt.Sprintf("%s v%s", wailsModule, latestVersion)
goMod = strings.Replace(goMod, old, new, -1)
err := ioutil.WriteFile(goModFile, []byte(goMod), 0600)
err := os.WriteFile(goModFile, []byte(goMod), 0600)
if err != nil {
checkSpinner.Error()
return err
@@ -343,7 +342,7 @@ func patchMainJS() error {
newStartLine := `Wails.Init`
mainJSContents = strings.Replace(mainJSContents, oldStartLine, newStartLine, -1)
err := ioutil.WriteFile(mainJSFile, []byte(mainJSContents), 0600)
err := os.WriteFile(mainJSFile, []byte(mainJSContents), 0600)
if err != nil {
checkSpinner.Error()
return err

View File

@@ -15,6 +15,7 @@ func init() {
projectOptions := projectHelper.NewProjectOptions()
commandDescription := `Generates a new Wails project using the given flags.
Any flags that are required and not given will be prompted for.`
build := false
initCommand := app.Command("init", "Initialises a new Wails project").
LongDescription(commandDescription).
@@ -23,7 +24,8 @@ Any flags that are required and not given will be prompted for.`
StringFlag("template", "Template name", &projectOptions.Template).
StringFlag("name", "Project name", &projectOptions.Name).
StringFlag("description", "Project description", &projectOptions.Description).
StringFlag("output", "Output binary name", &projectOptions.BinaryName)
StringFlag("output", "Output binary name", &projectOptions.BinaryName).
BoolFlag("build", "Build project after generating", &build)
initCommand.Action(func() error {
@@ -64,6 +66,10 @@ Any flags that are required and not given will be prompted for.`
return err
}
genSpinner.Success()
if !build {
logger.Yellow("Project '%s' initialised. Run `wails build` to build it.", projectOptions.Name)
return nil
}
// Build the project
cwd, _ := os.Getwd()

View File

@@ -2,7 +2,7 @@ package main
import (
"fmt"
"io/ioutil"
"io"
"net/http"
"net/url"
"os"
@@ -112,7 +112,7 @@ To help you in this process, we will ask for some information, add Go/Wails deta
os.Exit(1)
}
defer resp.Body.Close()
template, _ := ioutil.ReadAll(resp.Body)
template, _ := io.ReadAll(resp.Body)
body := string(template)
body = "**Description**\n" + (strings.Split(body, "**Description**")[1])
fullURL := "https://github.com/wailsapp/wails/issues/new?"

5
go.mod
View File

@@ -8,7 +8,6 @@ require (
github.com/gorilla/websocket v1.4.1
github.com/jackmordaunt/icns v1.0.0
github.com/kennygrant/sanitize v1.2.4
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/leaanthony/slicer v1.4.0
github.com/leaanthony/spinner v0.5.3
github.com/mattn/go-colorable v0.1.1 // indirect
@@ -16,12 +15,12 @@ require (
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4
github.com/pkg/errors v0.8.1 // indirect
github.com/sirupsen/logrus v1.4.1
github.com/sirupsen/logrus v1.8.1
github.com/stretchr/testify v1.3.0 // indirect
github.com/syossan27/tebata v0.0.0-20180602121909-b283fe4bc5ba
golang.org/x/image v0.0.0-20200430140353-33d19683fad8
golang.org/x/net v0.0.0-20200625001655-4c5254603344 // indirect
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359
golang.org/x/text v0.3.0
gopkg.in/AlecAivazis/survey.v1 v1.8.4
gopkg.in/yaml.v3 v3.0.0-20190709130402-674ba3eaed22

14
go.sum
View File

@@ -21,9 +21,6 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNU
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
github.com/kennygrant/sanitize v1.2.4 h1:gN25/otpP5vAsO2djbMhF/LQX6R7+O1TB4yv8NzpJ3o=
github.com/kennygrant/sanitize v1.2.4/go.mod h1:LGsjYYtgxbetdg5owWB2mpgUL6e2nfw2eObZ0u0qvak=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/leaanthony/slicer v1.4.0 h1:Q9u4w+UBU4WHjXnEDdz+eRLMKF/rnyosRBiqULnc1J8=
@@ -52,10 +49,9 @@ github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k=
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
@@ -71,14 +67,14 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4=
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
golang.org/x/sys v0.0.0-20180606202747-9527bec2660b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c h1:UIcGWL6/wpCfyGuJnRFJRurA+yj8RrW7Q6x2YMCXt6c=
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 h1:2B5p2L5IfGiD7+b9BOoRMC6DgObAVZV+Fsp050NqXik=
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
gopkg.in/AlecAivazis/survey.v1 v1.8.4 h1:10xXXN3wgIhPheb5NI58zFgZv32Ana7P3Tl4shW+0Qc=

View File

@@ -2,7 +2,6 @@ package binding
import (
"fmt"
"io/ioutil"
"os"
"path/filepath"
"reflect"
@@ -144,7 +143,7 @@ export {};`
dir := filepath.Dir(typescriptDefinitionFilename)
os.MkdirAll(dir, 0755)
return ioutil.WriteFile(typescriptDefinitionFilename, []byte(output.String()), 0755)
return os.WriteFile(typescriptDefinitionFilename, []byte(output.String()), 0755)
}
// bind the given struct method

View File

@@ -55,20 +55,20 @@ func (e *Manager) addEventListener(eventName string, callback func(...interface{
return fmt.Errorf("nil callback bassed to addEventListener")
}
// Check event has been registered before
if e.listeners[eventName] == nil {
e.listeners[eventName] = []*eventListener{}
}
// Create the callback
listener := &eventListener{
callback: callback,
counter: counter,
}
e.mu.Lock()
// Check event has been registered before
if e.listeners[eventName] == nil {
e.listeners[eventName] = []*eventListener{}
}
// Register listener
e.listeners[eventName] = append(e.listeners[eventName], listener)
e.mu.Unlock()
// All good mate
return nil
}

View File

@@ -54,7 +54,7 @@ extern "C"
int ready;
int js_busy;
int should_exit;
int min_width;
int min_height;
int max_width;
@@ -179,7 +179,7 @@ struct webview_priv
WEBVIEW_API int webview_inject_css(struct webview *w, const char *css);
WEBVIEW_API void webview_set_title(struct webview *w, const char *title);
WEBVIEW_API void webview_focus(struct webview *w);
WEBVIEW_API void webview_minsize(struct webview *w, int width, int height);
WEBVIEW_API void webview_minsize(struct webview *w, int width, int height);
WEBVIEW_API void webview_maxsize(struct webview *w, int width, int height);
WEBVIEW_API void webview_set_fullscreen(struct webview *w, int fullscreen);
WEBVIEW_API void webview_set_color(struct webview *w, uint8_t r, uint8_t g,
@@ -342,12 +342,12 @@ struct webview_priv
w->priv.should_exit = 0;
w->priv.queue = g_async_queue_new();
w->priv.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
w->priv.min_width = -1;
w->priv.min_height = -1;
w->priv.max_width = -1;
w->priv.max_height = -1;
gtk_window_set_title(GTK_WINDOW(w->priv.window), w->title);
if (w->resizable)
@@ -421,13 +421,13 @@ struct webview_priv
}
WEBVIEW_API void webview_minsize(struct webview *w, int width, int height) {
w->priv.min_width = width;
w->priv.min_height = height;
GdkGeometry hints;
GdkWindowHints usedHints = (GdkWindowHints) GDK_HINT_MIN_SIZE;
hints.min_width = w->priv.min_width;
hints.min_height = w->priv.min_height;
if (w->priv.max_width != -1) {
@@ -435,18 +435,18 @@ struct webview_priv
hints.max_height = w->priv.max_height;
usedHints = (GdkWindowHints)(GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
}
gtk_window_set_geometry_hints(GTK_WINDOW(w->priv.window), w->priv.window, &hints, usedHints);
}
WEBVIEW_API void webview_maxsize(struct webview *w, int width, int height) {
w->priv.max_width = width;
w->priv.max_height = height;
GdkGeometry hints;
GdkWindowHints usedHints = (GdkWindowHints) GDK_HINT_MAX_SIZE;
if (w->priv.min_width != -1) {
hints.min_width = w->priv.min_width;
hints.min_height = w->priv.min_height;
@@ -454,7 +454,7 @@ struct webview_priv
}
hints.max_width = w->priv.max_width;
hints.max_height = w->priv.max_height;
gtk_window_set_geometry_hints(GTK_WINDOW(w->priv.window), w->priv.window, &hints, usedHints);
}
@@ -514,7 +514,6 @@ struct webview_priv
}
gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dlg), FALSE);
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dlg), FALSE);
gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(dlg), TRUE);
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dlg), TRUE);
gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(dlg), TRUE);
gint response = gtk_dialog_run(GTK_DIALOG(dlg));
@@ -1398,12 +1397,12 @@ struct webview_priv
case WM_GETMINMAXINFO:
{
if (w != NULL) {
// get pixel density
// get pixel density
HDC hDC = GetDC(NULL);
double DPIScaleX = GetDeviceCaps(hDC, 88)/96.0;
double DPIScaleY = GetDeviceCaps(hDC, 90)/96.0;
ReleaseDC(NULL, hDC);
RECT rcClient, rcWind;
POINT ptDiff;
GetClientRect(hwnd, &rcClient);
@@ -1413,7 +1412,7 @@ struct webview_priv
int heightExtra = (rcWind.bottom - rcWind.top) - rcClient.bottom;
LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam;
if (w->priv.min_width != -1) {
lpMMI->ptMinTrackSize.x = w->priv.min_width * DPIScaleX + widthExtra;
lpMMI->ptMinTrackSize.y = w->priv.min_height * DPIScaleY + heightExtra;
@@ -1423,7 +1422,7 @@ struct webview_priv
lpMMI->ptMaxTrackSize.y = w->priv.max_height * DPIScaleY + heightExtra;
}
}
return 0;
}
case WM_DESTROY:
@@ -2328,14 +2327,14 @@ struct webview_priv
{
[w->priv.window makeKeyWindow];
}
WEBVIEW_API void webview_minsize(struct webview *w, int width, int height) {
NSSize size;
size.width = width;
size.height = height;
[w->priv.window setMinSize:size];
}
WEBVIEW_API void webview_maxsize(struct webview *w, int width, int height) {
NSSize size;
size.width = width;
@@ -2346,7 +2345,7 @@ struct webview_priv
[button performSelectorOnMainThread:@selector(setEnabled:) withObject:NO
waitUntilDone:NO];
}
WEBVIEW_API void webview_set_fullscreen(struct webview *w, int fullscreen)
{
int b = ((([w->priv.window styleMask] & NSWindowStyleMaskFullScreen) ==
@@ -2503,4 +2502,4 @@ struct webview_priv
}
#endif
#endif /* WEBVIEW_H */
#endif /* WEBVIEW_H */

BIN
logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 162 KiB

BIN
sponsors/silver sponsor.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

View File

@@ -15,8 +15,6 @@ The build command processes the Wails project and generates an application binar
| -ldflags "custom ld flags" | Use given ldflags | |
| -o path/to/binary | Compile to given path/filename | |
| -k | Keep generated assets | |
| -package | Create a platform specific package | |
| -production | Compile in production mode: -ldflags="-w -s" + "-h windows" on Windows | |
| -tags | Build tags to pass to Go compiler (quoted and space separated) | |
| -upx | Compress final binary with UPX (if installed) | |
| -upxflags "custom flags" | Flags to pass to upx | |
@@ -36,13 +34,13 @@ The build process is as follows:
- The frontend is then built. This command is read from the project file `wails.json` under the key `frontend:install` and executed in the `frontend` directory. If this is not defined, it is ignored.
- The project directory is checked to see if the `build` directory exists. If not, it is created and default project assets are copied to it.
- An asset bundle is then created by reading the `html` key from `wails.json` and loading the referenced file. This is then parsed, looking for local Javascript and CSS references. Those files are in turn loaded into memory, converted to C data and saved into the asset bundle located at `build/assets.h`, which also includes the original HTML.
- The application icon is then processed: if there is no `build/appicon.png`, a default icon is copied. On Windows, an `app.ico` file is generated from this png. On Mac, `icons.icns` is generated.
- If there are icons in the `build/tray` directory, these are processed, converted to C data and saved as `build/trayicons.h`, ready for the compilation step.
- If there are icons in the `build/dialog` directory, these are processed, converted to C data and saved as `build/userdialogicons.h`, ready for the compilation step.
- If the `-package` flag is given for a Windows target, the Windows assets in the `build/windows` directory are processed: manifest + icons compiled to a `.syso` file (deleted after compilation).
- If we are building a universal binary for Mac, the application is compiled for both `arm64` and `amd64`. The `lipo` tool is then executed to create the universal binary.
- The application icon is then processed: if there is no `build/appicon.png`, a default icon is copied. On Windows,
an `app.ico` file is generated from this png. On Mac, `icons.icns` is generated.
- The platform assets in the `build/<platform>` directory are processed: manifest + icons compiled to a `.syso` file (
deleted after compilation), `info.plist` copied to `.app` on Mac.
- If we are building a universal binary for Mac, the application is compiled for both `arm64` and `amd64`. The `lipo`
tool is then executed to create the universal binary.
- If we are not building a universal binary for Mac, the application is built using `go build`, using build tags to indicate type of application and build mode (debug/production).
- If the `-upx` flag was provided, `upx` is invoked to compress the binary. Custom flags may be provided using the `-upxflags` flag.
- If the `package` flag is given for a non Windows target, the application is bundled for the platform. On Mac, this creates a `.app` with the processed icons, the `Info.plist` in `build/darwin` and the compiled binary.

View File

@@ -2,14 +2,19 @@ package build
import (
"fmt"
"github.com/wailsapp/wails/v2/internal/colour"
"io"
"os"
"os/exec"
"path/filepath"
"runtime"
"strings"
"text/tabwriter"
"time"
"github.com/wailsapp/wails/v2/cmd/wails/internal"
"github.com/wailsapp/wails/v2/internal/gomod"
"github.com/wailsapp/wails/v2/internal/system"
"github.com/leaanthony/clir"
@@ -34,6 +39,9 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
compilerCommand := "go"
command.StringFlag("compiler", "Use a different go compiler to build, eg go1.15beta1", &compilerCommand)
skipModTidy := false
command.BoolFlag("m", "Skip mod tidy before compile", &skipModTidy)
compress := false
command.BoolFlag("upx", "Compress final binary with UPX (if installed)", &compress)
@@ -42,7 +50,7 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
// Setup Platform flag
platform := runtime.GOOS
//command.StringFlag("platform", "Platform to target", &platform)
command.StringFlag("platform", "Platform to target", &platform)
// Verbosity
verbosity := 1
@@ -72,6 +80,12 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
forceBuild := false
command.BoolFlag("f", "Force build application", &forceBuild)
updateGoMod := false
command.BoolFlag("u", "Updates go.mod to use the same Wails version as the CLI", &updateGoMod)
debug := false
command.BoolFlag("debug", "Retains debug data in the compiled application", &debug)
command.Action(func() error {
quiet := verbosity == 0
@@ -100,9 +114,10 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
//"linux/arm-7",
"windows",
"windows/amd64",
"windows/arm64",
})
if !validPlatformArch.Contains(platform) {
return fmt.Errorf("platform %s is not supported", platform)
return fmt.Errorf("platform %s is not supported. Platforms supported: %s", platform, validPlatformArch.Join(","))
}
if compress && platform == "darwin/universal" {
@@ -117,12 +132,20 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
}
// Tags
experimental := false
userTags := []string{}
for _, tag := range strings.Split(tags, " ") {
thisTag := strings.TrimSpace(tag)
if thisTag != "" {
userTags = append(userTags, thisTag)
}
if thisTag == "exp" {
experimental = true
}
}
if runtime.GOOS == "linux" && !experimental {
return fmt.Errorf("Linux version coming soon!")
}
// Webview2 installer strategy (download by default)
@@ -144,16 +167,24 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
}
}
mode := build.Production
modeString := "Production"
if debug {
mode = build.Debug
modeString = "Debug"
}
// Create BuildOptions
buildOptions := &build.Options{
Logger: logger,
OutputType: outputType,
OutputFile: outputFilename,
CleanBuildDirectory: cleanBuildDirectory,
Mode: build.Production,
Mode: mode,
Pack: !noPackage,
LDFlags: ldflags,
Compiler: compilerCommand,
SkipModTidy: skipModTidy,
Verbosity: verbosity,
ForceBuild: forceBuild,
IgnoreFrontend: skipFrontend,
@@ -185,6 +216,7 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
fmt.Fprintf(w, "Platform: \t%s\n", buildOptions.Platform)
fmt.Fprintf(w, "Arch: \t%s\n", buildOptions.Arch)
fmt.Fprintf(w, "Compiler: \t%s\n", compilerPath)
fmt.Fprintf(w, "Build Mode: \t%s\n", modeString)
fmt.Fprintf(w, "Skip Frontend: \t%t\n", skipFrontend)
fmt.Fprintf(w, "Compress: \t%t\n", buildOptions.Compress)
fmt.Fprintf(w, "Package: \t%t\n", buildOptions.Pack)
@@ -197,6 +229,11 @@ func AddBuildSubcommand(app *clir.Cli, w io.Writer) {
fmt.Fprintf(w, "\n")
w.Flush()
err = checkGoModVersion(logger, updateGoMod)
if err != nil {
return err
}
return doBuild(buildOptions)
})
}
@@ -220,3 +257,59 @@ func doBuild(buildOptions *build.Options) error {
return nil
}
func checkGoModVersion(logger *clilogger.CLILogger, updateGoMod bool) error {
cwd, err := os.Getwd()
if err != nil {
return err
}
gomodFilename := filepath.Join(cwd, "go.mod")
gomodData, err := os.ReadFile(gomodFilename)
if err != nil {
return err
}
outOfSync, err := gomod.GoModOutOfSync(gomodData, internal.Version)
if err != nil {
return err
}
if !outOfSync {
return nil
}
gomodversion, err := gomod.GetWailsVersionFromModFile(gomodData)
if err != nil {
return err
}
if updateGoMod {
return syncGoModVersion(cwd)
}
logger.Println("Warning: go.mod is using Wails '%s' but the CLI is '%s'. Consider updating your project's `go.mod` file.\n", gomodversion.String(), internal.Version)
return nil
}
func LogGreen(message string, args ...interface{}) {
text := fmt.Sprintf(message, args...)
println(colour.Green(text))
}
func syncGoModVersion(cwd string) error {
gomodFilename := filepath.Join(cwd, "go.mod")
gomodData, err := os.ReadFile(gomodFilename)
if err != nil {
return err
}
outOfSync, err := gomod.GoModOutOfSync(gomodData, internal.Version)
if err != nil {
return err
}
if !outOfSync {
return nil
}
LogGreen("Updating go.mod to use Wails '%s'", internal.Version)
newGoData, err := gomod.UpdateGoModVersion(gomodData, internal.Version)
if err != nil {
return err
}
return os.WriteFile(gomodFilename, newGoData, 0755)
}

View File

@@ -3,8 +3,6 @@ package dev
import (
"context"
"fmt"
"github.com/wailsapp/wails/v2/cmd/wails/internal"
"github.com/wailsapp/wails/v2/internal/gomod"
"io"
"net/http"
"os"
@@ -18,7 +16,10 @@ import (
"syscall"
"time"
"github.com/leaanthony/slicer"
"github.com/google/shlex"
"github.com/wailsapp/wails/v2/cmd/wails/internal"
"github.com/wailsapp/wails/v2/internal/gomod"
"github.com/wailsapp/wails/v2/internal/project"
"github.com/pkg/browser"
@@ -62,6 +63,7 @@ type devFlags struct {
compilerCommand string
assetDir string
extensions string
reloadDirs string
openBrowser bool
noReload bool
wailsjsdir string
@@ -71,6 +73,7 @@ type devFlags struct {
forceBuild bool
debounceMS int
devServerURL string
appargs string
}
// AddSubcommand adds the `dev` command for the Wails application
@@ -81,23 +84,41 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
flags := defaultDevFlags()
command.StringFlag("ldflags", "optional ldflags", &flags.ldflags)
command.StringFlag("compiler", "Use a different go compiler to build, eg go1.15beta1", &flags.compilerCommand)
command.StringFlag("assetdir", "Serve assets from the given directory", &flags.assetDir)
command.StringFlag("assetdir", "Serve assets from the given directory instead of using the provided asset FS", &flags.assetDir)
command.StringFlag("e", "Extensions to trigger rebuilds (comma separated) eg go", &flags.extensions)
command.StringFlag("reloaddirs", "Additional directories to trigger reloads (comma separated)", &flags.reloadDirs)
command.BoolFlag("browser", "Open application in browser", &flags.openBrowser)
command.BoolFlag("noreload", "Disable reload on asset change", &flags.noReload)
command.StringFlag("wailsjsdir", "Directory to generate the Wails JS modules", &flags.wailsjsdir)
command.StringFlag("tags", "tags to pass to Go compiler (quoted and space separated)", &flags.tags)
command.IntFlag("v", "Verbosity level (0 - silent, 1 - standard, 2 - verbose)", &flags.verbosity)
command.StringFlag("loglevel", "Loglevel to use - Trace, Dev, Info, Warning, Error", &flags.loglevel)
command.StringFlag("loglevel", "Loglevel to use - Trace, Debug, Info, Warning, Error", &flags.loglevel)
command.BoolFlag("f", "Force build application", &flags.forceBuild)
command.IntFlag("debounce", "The amount of time to wait to trigger a reload on change", &flags.debounceMS)
command.StringFlag("devserverurl", "The url of the dev server to use", &flags.devServerURL)
command.StringFlag("appargs", "arguments to pass to the underlying app (quoted and space searated)", &flags.appargs)
command.Action(func() error {
// Create logger
logger := clilogger.New(w)
app.PrintBanner()
experimental := false
userTags := []string{}
for _, tag := range strings.Split(flags.tags, " ") {
thisTag := strings.TrimSpace(tag)
if thisTag != "" {
userTags = append(userTags, thisTag)
}
if thisTag == "exp" {
experimental = true
}
}
if runtime.GOOS == "linux" && !experimental {
return fmt.Errorf("Linux version coming soon!")
}
cwd, err := os.Getwd()
if err != nil {
return err
@@ -120,7 +141,11 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
return err
}
err = runCommand(cwd, true, "wails", "generate", "module")
if flags.tags != "" {
err = runCommand(cwd, true, "wails", "generate", "module", "-tags", flags.tags)
} else {
err = runCommand(cwd, true, "wails", "generate", "module")
}
if err != nil {
return err
}
@@ -134,7 +159,7 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
buildOptions := generateBuildOptions(flags)
buildOptions.Logger = logger
buildOptions.UserTags = parseUserTags(flags.tags)
buildOptions.UserTags = internal.ParseUserTags(flags.tags)
var debugBinaryProcess *process.Process = nil
@@ -251,7 +276,7 @@ func defaultDevFlags() devFlags {
// generateBuildOptions creates a build.Options using the flags
func generateBuildOptions(flags devFlags) *build.Options {
return &build.Options{
result := &build.Options{
OutputType: "dev",
Mode: build.Dev,
Arch: runtime.GOARCH,
@@ -264,18 +289,8 @@ func generateBuildOptions(flags devFlags) *build.Options {
Verbosity: flags.verbosity,
WailsJSDir: flags.wailsjsdir,
}
}
// parseUserTags takes the string form of tags and converts to a slice of strings
func parseUserTags(tagString string) []string {
userTags := make([]string, 0)
for _, tag := range strings.Split(tagString, " ") {
thisTag := strings.TrimSpace(tag)
if thisTag != "" {
userTags = append(userTags, thisTag)
}
}
return userTags
return result
}
// loadAndMergeProjectConfig reconciles flags passed to the CLI with project config settings and updates
@@ -288,21 +303,29 @@ func loadAndMergeProjectConfig(cwd string, flags *devFlags) (*project.Project, e
var shouldSaveConfig bool
if projectConfig.AssetDirectory == "" && flags.assetDir == "" {
return nil, fmt.Errorf("No asset directory provided. Please use -assetdir to indicate which directory contains your built assets.")
}
if flags.assetDir == "" && projectConfig.AssetDirectory != "" {
flags.assetDir = projectConfig.AssetDirectory
}
if flags.assetDir != projectConfig.AssetDirectory {
projectConfig.AssetDirectory = filepath.ToSlash(flags.assetDir)
shouldSaveConfig = true
}
flags.assetDir, err = filepath.Abs(flags.assetDir)
if err != nil {
return nil, err
if flags.assetDir != "" {
flags.assetDir, err = filepath.Abs(flags.assetDir)
if err != nil {
return nil, err
}
}
if flags.reloadDirs == "" && projectConfig.ReloadDirectories != "" {
flags.reloadDirs = projectConfig.ReloadDirectories
}
if flags.reloadDirs != projectConfig.ReloadDirectories {
projectConfig.ReloadDirectories = filepath.ToSlash(flags.reloadDirs)
shouldSaveConfig = true
}
if flags.devServerURL == defaultDevServerURL && projectConfig.DevServerURL != defaultDevServerURL && projectConfig.DevServerURL != "" {
@@ -339,6 +362,10 @@ func loadAndMergeProjectConfig(cwd string, flags *devFlags) (*project.Project, e
shouldSaveConfig = true
}
if flags.appargs == "" && projectConfig.AppArgs != "" {
flags.appargs = projectConfig.AppArgs
}
if shouldSaveConfig {
err = projectConfig.Save()
if err != nil {
@@ -375,13 +402,15 @@ func runFrontendDevCommand(cwd string, devCommand string, wg *sync.WaitGroup) fu
if runtime.GOOS == "windows" {
// Credit: https://stackoverflow.com/a/44551450
// For whatever reason, killing an npm script on windows just doesn't exit properly with cancel
kill := exec.Command("TASKKILL", "/T", "/F", "/PID", strconv.Itoa(cmd.Process.Pid))
kill.Stderr = os.Stderr
kill.Stdout = os.Stdout
err := kill.Run()
if err != nil {
if err.Error() != "exit status 1" {
LogRed("Error from '%s': %s", devCommand, err.Error())
if cmd != nil && cmd.Process != nil {
kill := exec.Command("TASKKILL", "/T", "/F", "/PID", strconv.Itoa(cmd.Process.Pid))
kill.Stderr = os.Stderr
kill.Stdout = os.Stdout
err := kill.Run()
if err != nil {
if err.Error() != "exit status 1" {
LogRed("Error from '%s': %s", devCommand, err.Error())
}
}
}
} else {
@@ -447,16 +476,20 @@ func restartApp(buildOptions *build.Options, debugBinaryProcess *process.Process
debugBinaryProcess = nil
}
// parse appargs if any
args, err := shlex.Split(flags.appargs)
if err != nil {
buildOptions.Logger.Fatal("Unable to parse appargs: %s", err.Error())
}
// Set environment variables accordingly
os.Setenv("loglevel", flags.loglevel)
os.Setenv("assetdir", flags.assetDir)
os.Setenv("devserverurl", flags.devServerURL)
// Start up new binary with correct args
args := slicer.StringSlicer{}
args.Add("-loglevel", flags.loglevel)
if flags.assetDir != "" {
args.Add("-assetdir", flags.assetDir)
}
if flags.devServerURL != "" {
args.Add("-devserverurl", flags.devServerURL)
}
newProcess := process.NewProcess(appBinary, args.AsSlice()...)
newProcess := process.NewProcess(appBinary, args...)
err = newProcess.Start(exitCodeChannel)
if err != nil {
// Remove binary
@@ -480,11 +513,26 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
newBinaryProcess *process.Process
)
var extensionsThatTriggerARebuild = sliceToMap(strings.Split(flags.extensions, ","))
var dirsThatTriggerAReload []string
for _, dir := range strings.Split(flags.reloadDirs, ",") {
if dir == "" {
continue
}
path, err := filepath.Abs(dir)
if err != nil {
LogRed("Unable to expand reloadDir '%s': %s", dir, err)
continue
}
dirsThatTriggerAReload = append(dirsThatTriggerAReload, path)
}
quit := false
interval := time.Duration(flags.debounceMS) * time.Millisecond
timer := time.NewTimer(interval)
rebuild := false
reload := false
assetDir := ""
changedPaths := map[string]struct{}{}
for quit == false {
//reload := false
select {
@@ -496,12 +544,13 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
// Check for file writes
if item.Op&fsnotify.Write == fsnotify.Write {
// Ignore directories
if fs.DirExists(item.Name) {
itemName := item.Name
if fs.DirExists(itemName) {
continue
}
// Iterate all file patterns
ext := filepath.Ext(item.Name)
ext := filepath.Ext(itemName)
if ext != "" {
ext = ext[1:]
if _, exists := extensionsThatTriggerARebuild[ext]; exists {
@@ -511,9 +560,17 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
}
}
if strings.HasPrefix(item.Name, flags.assetDir) {
reload = true
for _, reloadDir := range dirsThatTriggerAReload {
if strings.HasPrefix(itemName, reloadDir) {
reload = true
break
}
}
if !reload {
changedPaths[filepath.Dir(itemName)] = struct{}{}
}
timer.Reset(interval)
}
// Check for new directories
@@ -545,6 +602,35 @@ func doWatcherLoop(buildOptions *build.Options, debugBinaryProcess *process.Proc
debugBinaryProcess = newBinaryProcess
}
}
if len(changedPaths) != 0 {
if assetDir == "" {
resp, err := http.Get("http://localhost:34115/wails/assetdir")
if err != nil {
LogRed("Error during retrieving assetdir: %s", err.Error())
} else {
content, err := io.ReadAll(resp.Body)
if err != nil {
LogRed("Error reading assetdir from devserver: %s", err.Error())
} else {
assetDir = string(content)
}
resp.Body.Close()
}
}
if assetDir != "" {
for path := range changedPaths {
if strings.HasPrefix(path, assetDir) {
reload = true
break
}
}
} else if len(dirsThatTriggerAReload) == 0 {
LogRed("Reloading couldn't be triggered: Please specify -assetdir or -reloaddirs")
}
changedPaths = map[string]struct{}{}
}
if reload {
reload = false
_, err = http.Get("http://localhost:34115/wails/reload")

View File

@@ -1,9 +1,8 @@
package generate
import (
"io"
"github.com/wailsapp/wails/v2/cmd/wails/internal/commands/generate/template"
"io"
"github.com/leaanthony/clir"
)
@@ -17,6 +16,7 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
if err != nil {
return err
}
template.AddSubCommand(app, command, w)
return nil

View File

@@ -1,18 +1,23 @@
package generate
import (
"fmt"
"github.com/leaanthony/clir"
"github.com/wailsapp/wails/v2/cmd/wails/internal"
"github.com/wailsapp/wails/v2/internal/shell"
"io"
"os"
"path/filepath"
"runtime"
"strings"
)
// AddModuleCommand adds the `module` subcommand for the `generate` command
func AddModuleCommand(app *clir.Cli, parent *clir.Command, w io.Writer) error {
command := parent.NewSubCommand("module", "Generate wailsjs modules")
var tags string
command.StringFlag("tags", "tags to pass to Go compiler (quoted and space separated)", &tags)
command.Action(func() error {
@@ -29,14 +34,17 @@ func AddModuleCommand(app *clir.Cli, parent *clir.Command, w io.Writer) error {
return err
}
_, _, err = shell.RunCommand(cwd, "go", "build", "-tags", "bindings", "-o", filename)
tagList := internal.ParseUserTags(tags)
tagList = append(tagList, "bindings")
stdout, stderr, err := shell.RunCommand(cwd, "go", "build", "-tags", strings.Join(tagList, ","), "-o", filename)
if err != nil {
return err
return fmt.Errorf("%s\n%s\n%s", stdout, stderr, err)
}
_, _, err = shell.RunCommand(cwd, filename)
stdout, stderr, err = shell.RunCommand(cwd, filename)
if err != nil {
return err
return fmt.Errorf("%s\n%s\n%s", stdout, stderr, err)
}
err = os.Remove(filename)

View File

@@ -10,7 +10,6 @@ The next steps to complete the template are:
- It is really important to ensure `helpurl` is valid as this is where users of the template will be directed for help.
2. Update `README.md`.
3. Edit `wails.json` and ensure all fields are correct, especially:
- `assetdir` - path to your assets
- `wailsjsdir` - path to generate wailsjs modules
- `frontend:install` - The command to install your frontend dependencies
- `frontend:build` - The command to build your frontend

View File

@@ -4,13 +4,12 @@
About your template
## Building
To build this project in debug mode, use `wails build`. For production, use `wails build -production`.
To generate a platform native package, add the `-package` flag.
## Live Development
To run in live development mode, run `wails dev` in the project directory. In another terminal, go into the `frontend`
directory and run `npm run dev`. The frontend dev server will run on http://localhost:34115. Connect to this
in your browser and connect to your application.
To run in live development mode, run `wails dev` in the project directory. In another terminal, go into the `frontend`
directory and run `npm run dev`. The frontend dev server will run on http://localhost:34115. Connect to this in your
browser and connect to your application.
## Building
To build a redistributable, production mode package, use `wails build`.

View File

@@ -22,7 +22,6 @@ github.com/leaanthony/go-common-file-dialog v1.0.3 // indirect
github.com/leaanthony/go-webview2 v0.0.0-20210914103035-f00aa774a934 // indirect
github.com/leaanthony/slicer v1.5.0 // indirect
github.com/leaanthony/typescriptify-golang-structs v0.1.7 // indirect
github.com/leaanthony/webview2runtime v1.1.0 // indirect
github.com/leaanthony/winc v0.0.0-20210921073452-54963136bf18 // indirect
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2 // indirect
github.com/pkg/errors v0.9.1 // indirect

View File

@@ -90,8 +90,6 @@ github.com/leaanthony/slicer v1.5.0 h1:aHYTN8xbCCLxJmkNKiLB6tgcMARl4eWmH9/F+S/0H
github.com/leaanthony/slicer v1.5.0/go.mod h1:FwrApmf8gOrpzEWM2J/9Lh79tyq8KTX5AzRtwV7m4AY=
github.com/leaanthony/typescriptify-golang-structs v0.1.7 h1:yoznzWzyxkO/iWdlpq+aPcuJ5Y/hpjq/lmgMFmpjwl0=
github.com/leaanthony/typescriptify-golang-structs v0.1.7/go.mod h1:cWtOkiVhMF77e6phAXUcfNwYmMwCJ67Sij24lfvi9Js=
github.com/leaanthony/webview2runtime v1.1.0 h1:N0pv55ift8XtqozIp4PNOtRCJ/Qdd/qzx80lUpalS4c=
github.com/leaanthony/webview2runtime v1.1.0/go.mod h1:hH9GnWCve3DYzNaPOcPbhHQ7fodXR1QJNsnwixid4Tk=
github.com/leaanthony/winc v0.0.0-20210921073452-54963136bf18 h1:5iOd93PZbpH4Iir8QkC4coFD+zEQEZSIRcjwjTFZkr0=
github.com/leaanthony/winc v0.0.0-20210921073452-54963136bf18/go.mod h1:KEbMsKoznsebyGHwLk5LqkFOxL5uXSRdvpP4+avmAMs=
github.com/leaanthony/winicon v1.0.0/go.mod h1:en5xhijl92aphrJdmRPlh4NI1L6wq3gEm0LpXAPghjU=

View File

@@ -33,10 +33,10 @@ func main() {
HideWindowOnClose: false,
RGBA: &options.RGBA{255, 255, 255, 255},
Assets: assets,
LogLevel: logger.DEBUG,
OnStartup: app.startup,
OnDomReady: app.domReady,
OnShutdown: app.shutdown,
LogLevel: logger.DEBUG,
OnStartup: app.startup,
OnDomReady: app.domReady,
OnShutdown: app.shutdown,
Bind: []interface{}{
app,
},

View File

@@ -0,0 +1,16 @@
{
"name": "{{.ProjectName}}",
"author": "",
"private": true,
"scripts": {
"install": "go install github.com/wailsapp/wails/v2/cmd/wails@latest",
"build": "wails build --clean",
"build:macos": "npm run build -- --platform darwin/universal",
"build:macos-arm": "npm run build -- --platform darwin/arm64",
"build:macos-intel": "npm run build -- --platform darwin",
"build:windows": "npm run build -- --platform windows/amd64"
},
"workspaces": [
"frontend"
]
}

View File

@@ -1,7 +1,6 @@
{
"name": "{{.ProjectName}}",
"outputfilename": "{{.BinaryName}}",
"assetdir": "frontend/dist",
"frontend:install": "npm install",
"frontend:build": "npm run build",
"author": {

View File

@@ -158,18 +158,17 @@ func processPackageJSON(frontendDir string) error {
return nil
}
data, err := os.ReadFile(packageJSON)
json, err := os.ReadFile(packageJSON)
if err != nil {
return err
}
json := string(data)
// We will ignore these errors - it's not critical
println("Updating package.json data...")
json, _ = sjson.Set(json, "name", "{{.ProjectName}}")
json, _ = sjson.Set(json, "author", "{{.AuthorName}}")
json, _ = sjson.SetBytes(json, "name", "{{.ProjectName}}")
json, _ = sjson.SetBytes(json, "author", "{{.AuthorName}}")
err = os.WriteFile(packageJSON, []byte(json), 0644)
err = os.WriteFile(packageJSON, json, 0644)
if err != nil {
return err
}

View File

@@ -36,7 +36,6 @@
<working_directory value="$PROJECT_DIR$"/>
<go_parameters value="-gcflags &quot;all=-N -l&quot; -tags dev -o {{.PathToDesktopBinary}}"/>
<useCustomBuildTags value="true"/>
<parameters value="-assetdir {{.AssetDir}}"/>
<envs>
<env name="CGO_ENABLED" value="&quot;{{.CGOEnabled}}&quot;"/>
</envs>

View File

@@ -9,11 +9,7 @@
"program": "${workspaceFolder}/{{.PathToDesktopBinary}}",
"preLaunchTask": "build",
"cwd": "${workspaceFolder}",
"env": {},
"args": [
"-assetdir",
"{{.AssetDir}}"
]
"env": {}
}
]
}

View File

@@ -4,15 +4,14 @@ import (
"embed"
"encoding/json"
"fmt"
"github.com/go-git/go-git/v5"
gofs "io/fs"
"io/ioutil"
"log"
"os"
"path/filepath"
"runtime"
"strings"
"github.com/go-git/go-git/v5"
"github.com/pkg/errors"
"github.com/leaanthony/debme"
@@ -43,7 +42,6 @@ type Data struct {
AuthorNameAndEmail string
WailsDirectory string
GoSDKPath string
AssetDir string
WindowsFlags string
CGOEnabled string
OutputFile string
@@ -61,7 +59,6 @@ type Options struct {
InitGit bool
AuthorName string
AuthorEmail string
AssetDir string
IDE string
ProjectNameFilename string // The project name but as a valid filename
WailsVersion string
@@ -262,7 +259,6 @@ func Install(options *Options) (bool, *Template, error) {
AuthorName: options.AuthorName,
WailsVersion: options.WailsVersion,
GoSDKPath: options.GoSDKPath,
AssetDir: options.AssetDir,
}
// Create a formatted name and email combo.
@@ -295,7 +291,7 @@ func Install(options *Options) (bool, *Template, error) {
// Clones the given uri and returns the temporary cloned directory
func gitclone(options *Options) (string, error) {
// Create temporary directory
dirname, err := ioutil.TempDir("", "wails-template-*")
dirname, err := os.MkdirTemp("", "wails-template-*")
if err != nil {
return "", err
}
@@ -409,22 +405,6 @@ func installIDEFiles(o ideOptions) error {
binaryName += ".exe"
}
// Parse wails.json for assetdir
wailsJSONBytes, err := os.ReadFile(filepath.Join(o.options.TargetDir, "wails.json"))
if err != nil {
return err
}
var wailsJSON map[string]interface{}
err = json.Unmarshal(wailsJSONBytes, &wailsJSON)
if err != nil {
return err
}
assetDir := wailsJSON["assetdir"]
if assetDir == "" {
return fmt.Errorf("Unable to find 'assetdir' in 'wails.json' ")
}
o.options.AssetDir = assetDir.(string)
o.options.PathToDesktopBinary = filepath.ToSlash(filepath.Join("build", "bin", binaryName))
o.options.WindowsFlags = ""

View File

@@ -22,7 +22,7 @@ func (b *App) startup(ctx context.Context) {
}
// domReady is called after the front-end dom has been loaded
func (b App) domReady(ctx context.Context) {
func (b *App) domReady(ctx context.Context) {
// Add your action here
}

View File

@@ -2,7 +2,7 @@
html {
text-align: center;
color: white;
background-color: rgba(0, 0, 0, 255);
background-color: rgba(33, 37, 43, 0.2);
width: 100%;
height: 100%;
}
@@ -13,6 +13,7 @@ body {
margin: 0;
width: 100%;
height: 100%;
overscroll-behavior: none;
}
@font-face {

View File

@@ -22,7 +22,6 @@ github.com/leaanthony/go-common-file-dialog v1.0.3 // indirect
github.com/leaanthony/go-webview2 v0.0.0-20210914103035-f00aa774a934 // indirect
github.com/leaanthony/slicer v1.5.0 // indirect
github.com/leaanthony/typescriptify-golang-structs v0.1.7 // indirect
github.com/leaanthony/webview2runtime v1.1.0 // indirect
github.com/leaanthony/winc v0.0.0-20210921073452-54963136bf18 // indirect
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2 // indirect
github.com/pkg/errors v0.9.1 // indirect

View File

@@ -91,8 +91,6 @@ github.com/leaanthony/slicer v1.5.0 h1:aHYTN8xbCCLxJmkNKiLB6tgcMARl4eWmH9/F+S/0H
github.com/leaanthony/slicer v1.5.0/go.mod h1:FwrApmf8gOrpzEWM2J/9Lh79tyq8KTX5AzRtwV7m4AY=
github.com/leaanthony/typescriptify-golang-structs v0.1.7 h1:yoznzWzyxkO/iWdlpq+aPcuJ5Y/hpjq/lmgMFmpjwl0=
github.com/leaanthony/typescriptify-golang-structs v0.1.7/go.mod h1:cWtOkiVhMF77e6phAXUcfNwYmMwCJ67Sij24lfvi9Js=
github.com/leaanthony/webview2runtime v1.1.0 h1:N0pv55ift8XtqozIp4PNOtRCJ/Qdd/qzx80lUpalS4c=
github.com/leaanthony/webview2runtime v1.1.0/go.mod h1:hH9GnWCve3DYzNaPOcPbhHQ7fodXR1QJNsnwixid4Tk=
github.com/leaanthony/winc v0.0.0-20210921073452-54963136bf18 h1:5iOd93PZbpH4Iir8QkC4coFD+zEQEZSIRcjwjTFZkr0=
github.com/leaanthony/winc v0.0.0-20210921073452-54963136bf18/go.mod h1:KEbMsKoznsebyGHwLk5LqkFOxL5uXSRdvpP4+avmAMs=
github.com/leaanthony/winicon v1.0.0/go.mod h1:en5xhijl92aphrJdmRPlh4NI1L6wq3gEm0LpXAPghjU=

View File

@@ -4,6 +4,8 @@ import (
"embed"
"log"
"github.com/wailsapp/wails/v2/pkg/options/mac"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/logger"
"github.com/wailsapp/wails/v2/pkg/options"
@@ -13,6 +15,9 @@ import (
//go:embed frontend/dist
var assets embed.FS
//go:embed build/appicon.png
var icon []byte
func main() {
// Create an instance of the app structure
app := NewApp()
@@ -31,7 +36,7 @@ func main() {
Frameless: false,
StartHidden: false,
HideWindowOnClose: false,
RGBA: &options.RGBA{R: 255, G: 255, B: 255, A: 255},
RGBA: &options.RGBA{R: 33, G: 37, B: 43, A: 255},
Assets: assets,
LogLevel: logger.DEBUG,
OnStartup: app.startup,
@@ -46,6 +51,17 @@ func main() {
WindowIsTranslucent: false,
DisableWindowIcon: false,
},
Mac: &mac.Options{
TitleBar: mac.TitleBarHiddenInset(),
Appearance: mac.NSAppearanceNameDarkAqua,
WebviewIsTransparent: true,
WindowIsTranslucent: true,
About: &mac.AboutInfo{
Title: "My Application",
Message: "© 2021 Me",
Icon: icon,
},
},
})
if err != nil {

View File

@@ -1,9 +1,9 @@
{
"name": "{{.ProjectName}}",
"outputfilename": "{{.BinaryName}}",
"assetdir": "frontend/dist",
"frontend:install": "npm install",
"frontend:build": "npm run build",
"wailsjsdir": "./frontend",
"author": {
"name": "{{.AuthorName}}",
"email": "{{.AuthorEmail}}"

View File

@@ -22,7 +22,7 @@ func (b *App) startup(ctx context.Context) {
}
// domReady is called after the front-end dom has been loaded
func (b App) domReady(ctx context.Context) {
func (b *App) domReady(ctx context.Context) {
// Add your action here
}

View File

@@ -1,15 +1,15 @@
html {
background-color: rgba(33, 37, 43, 1);
background-color: rgba(33, 37, 43, 0.2);
text-align: center;
color: white;
}
body {
margin: 0;
color: white;
font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto",
"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
"Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
sans-serif;
overscroll-behavior: none;
}
@font-face {

View File

@@ -22,7 +22,6 @@ github.com/leaanthony/go-common-file-dialog v1.0.3 // indirect
github.com/leaanthony/go-webview2 v0.0.0-20210914103035-f00aa774a934 // indirect
github.com/leaanthony/slicer v1.5.0 // indirect
github.com/leaanthony/typescriptify-golang-structs v0.1.7 // indirect
github.com/leaanthony/webview2runtime v1.1.0 // indirect
github.com/leaanthony/winc v0.0.0-20210921073452-54963136bf18 // indirect
github.com/pkg/browser v0.0.0-20210706143420-7d21f8c997e2 // indirect
github.com/pkg/errors v0.9.1 // indirect

View File

@@ -91,8 +91,6 @@ github.com/leaanthony/slicer v1.5.0 h1:aHYTN8xbCCLxJmkNKiLB6tgcMARl4eWmH9/F+S/0H
github.com/leaanthony/slicer v1.5.0/go.mod h1:FwrApmf8gOrpzEWM2J/9Lh79tyq8KTX5AzRtwV7m4AY=
github.com/leaanthony/typescriptify-golang-structs v0.1.7 h1:yoznzWzyxkO/iWdlpq+aPcuJ5Y/hpjq/lmgMFmpjwl0=
github.com/leaanthony/typescriptify-golang-structs v0.1.7/go.mod h1:cWtOkiVhMF77e6phAXUcfNwYmMwCJ67Sij24lfvi9Js=
github.com/leaanthony/webview2runtime v1.1.0 h1:N0pv55ift8XtqozIp4PNOtRCJ/Qdd/qzx80lUpalS4c=
github.com/leaanthony/webview2runtime v1.1.0/go.mod h1:hH9GnWCve3DYzNaPOcPbhHQ7fodXR1QJNsnwixid4Tk=
github.com/leaanthony/winc v0.0.0-20210921073452-54963136bf18 h1:5iOd93PZbpH4Iir8QkC4coFD+zEQEZSIRcjwjTFZkr0=
github.com/leaanthony/winc v0.0.0-20210921073452-54963136bf18/go.mod h1:KEbMsKoznsebyGHwLk5LqkFOxL5uXSRdvpP4+avmAMs=
github.com/leaanthony/winicon v1.0.0/go.mod h1:en5xhijl92aphrJdmRPlh4NI1L6wq3gEm0LpXAPghjU=

View File

@@ -4,6 +4,8 @@ import (
"embed"
"log"
"github.com/wailsapp/wails/v2/pkg/options/mac"
"github.com/wailsapp/wails/v2"
"github.com/wailsapp/wails/v2/pkg/logger"
"github.com/wailsapp/wails/v2/pkg/options"
@@ -13,6 +15,9 @@ import (
//go:embed frontend/src
var assets embed.FS
//go:embed build/appicon.png
var icon []byte
func main() {
// Create an instance of the app structure
app := NewApp()
@@ -31,7 +36,7 @@ func main() {
Frameless: false,
StartHidden: false,
HideWindowOnClose: false,
RGBA: &options.RGBA{R: 255, G: 255, B: 255, A: 255},
RGBA: &options.RGBA{R: 33, G: 37, B: 43, A: 255},
Assets: assets,
LogLevel: logger.DEBUG,
OnStartup: app.startup,
@@ -46,6 +51,16 @@ func main() {
WindowIsTranslucent: false,
DisableWindowIcon: false,
},
Mac: &mac.Options{
TitleBar: mac.TitleBarHiddenInset(),
WebviewIsTransparent: true,
WindowIsTranslucent: true,
About: &mac.AboutInfo{
Title: "Vanilla Template",
Message: "Part of the Wails projects",
Icon: icon,
},
},
})
if err != nil {

View File

@@ -1,7 +1,7 @@
{
"name": "{{.ProjectName}}",
"outputfilename": "{{.BinaryName}}",
"assetdir": "frontend/src",
"wailsjsdir": "./frontend",
"author": {
"name": "{{.AuthorName}}",
"email": "{{.AuthorEmail}}"

View File

@@ -0,0 +1,15 @@
package internal
import "strings"
// ParseUserTags takes the string form of tags and converts to a slice of strings
func ParseUserTags(tagString string) []string {
userTags := make([]string, 0)
for _, tag := range strings.Split(tagString, " ") {
thisTag := strings.TrimSpace(tag)
if thisTag != "" {
userTags = append(userTags, thisTag)
}
}
return userTags
}

View File

@@ -1,3 +1,3 @@
package internal
var Version = "v2.0.0-beta.5"
var Version = "v2.0.0-beta.27"

View File

@@ -13,6 +13,7 @@ require (
github.com/gofiber/fiber/v2 v2.17.0
github.com/gofiber/websocket/v2 v2.0.8
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510
github.com/google/uuid v1.1.2 // indirect
github.com/gorilla/websocket v1.4.1
github.com/imdario/mergo v0.3.12
@@ -21,13 +22,12 @@ require (
github.com/leaanthony/debme v1.2.1
github.com/leaanthony/go-ansi-parser v1.0.1
github.com/leaanthony/go-common-file-dialog v1.0.3
github.com/leaanthony/go-webview2 v0.0.0-20210928094513-a94a08b538bd
github.com/leaanthony/go-webview2 v1.0.2
github.com/leaanthony/gosod v1.0.3
github.com/leaanthony/idgen v1.0.0
github.com/leaanthony/slicer v1.5.0
github.com/leaanthony/typescriptify-golang-structs v0.1.7
github.com/leaanthony/webview2runtime v1.1.0
github.com/leaanthony/winc v0.0.0-20210921073452-54963136bf18
github.com/leaanthony/winc v0.0.0-20211202091710-9931d43181ff
github.com/leaanthony/winicon v1.0.0
github.com/matryer/is v1.4.0
github.com/olekukonko/tablewriter v0.0.4
@@ -39,11 +39,10 @@ require (
github.com/tdewolff/test v1.0.6 // indirect
github.com/tidwall/sjson v1.1.7
github.com/wzshiming/ctc v1.2.3
github.com/xyproto/xpm v1.2.1
github.com/ztrue/tracerr v0.3.0
golang.org/x/mod v0.4.1
golang.org/x/net v0.0.0-20210510120150-4163338589ed
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e
golang.org/x/tools v0.1.0
nhooyr.io/websocket v1.8.6
)
@@ -54,12 +53,13 @@ require (
github.com/emirpasic/gods v1.12.0 // indirect
github.com/fasthttp/websocket v0.0.0-20200320073529-1554a54587ab // indirect
github.com/go-git/gcfg v1.5.0 // indirect
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/klauspost/compress v1.12.2 // indirect
github.com/kr/pretty v0.3.0 // indirect
github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e // indirect
github.com/mattn/go-runewidth v0.0.7 // indirect
github.com/mitchellh/go-homedir v1.1.0 // indirect

View File

@@ -45,8 +45,8 @@ github.com/go-git/go-git-fixtures/v4 v4.0.2-0.20200613231340-f56387b50c12/go.mod
github.com/go-git/go-git/v5 v5.3.0 h1:8WKMtJR2j8RntEXR/uvTKagfEt4GYlwQ7mntE4+0GWc=
github.com/go-git/go-git/v5 v5.3.0/go.mod h1:xdX4bWJ48aOrdhnl2XqHYstHbbp6+LFS4r4X+lNVprw=
github.com/go-ole/go-ole v1.2.4/go.mod h1:XCwSNxSkXRo4vlyPy93sltvi/qJq0jqQhjqQNIwKuxM=
github.com/go-ole/go-ole v1.2.5 h1:t4MGB5xEDZvXI+0rMjjsfBsD7yAgp/s9ZDkL1JndXwY=
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4=
github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q=
github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8=
@@ -75,6 +75,8 @@ github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 h1:El6M4kTTCOh6aBiKaUGG7oYTSPP8MxqL4YI3kZKwcP4=
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510/go.mod h1:pupxD2MaaD3pAXIBCelhxNneeOaAeabZDe5s4K6zSpQ=
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y=
github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
@@ -101,8 +103,9 @@ github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8
github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0=
github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
@@ -115,8 +118,8 @@ github.com/leaanthony/go-ansi-parser v1.0.1 h1:97v6c5kYppVsbScf4r/VZdXyQ21KQIfeQ
github.com/leaanthony/go-ansi-parser v1.0.1/go.mod h1:7arTzgVI47srICYhvgUV4CGd063sGEeoSlych5yeSPM=
github.com/leaanthony/go-common-file-dialog v1.0.3 h1:O0uGjKnWtdEADGrkg+TyAAbZylykMwwx/MNEXn9fp+Y=
github.com/leaanthony/go-common-file-dialog v1.0.3/go.mod h1:TGhEc9eSJgRsupZ+iH1ZgAOnEo9zp05cRH2j08RPrF0=
github.com/leaanthony/go-webview2 v0.0.0-20210928094513-a94a08b538bd h1:6m4zZ/esiByaDbzgdvDxjsOaIDgtuG1q2cyhjAi6uAg=
github.com/leaanthony/go-webview2 v0.0.0-20210928094513-a94a08b538bd/go.mod h1:lS5ds4bruPk9d7lzdF/OH31Z0YCerI6MmHNFGsWoUnM=
github.com/leaanthony/go-webview2 v1.0.2 h1:IjTbpAXUig33G3LUqf+8EClZutg2Z/C1cbxqhHKPxbU=
github.com/leaanthony/go-webview2 v1.0.2/go.mod h1:iX54IaVk1FnDqMuHJ47VYLPQOcVqQiOe9SJACt9CAbU=
github.com/leaanthony/gosod v1.0.3 h1:Fnt+/B6NjQOVuCWOKYRREZnjGyvg+mEhd1nkkA04aTQ=
github.com/leaanthony/gosod v1.0.3/go.mod h1:BJ2J+oHsQIyIQpnLPjnqFGTMnOZXDbvWtRCSG7jGxs4=
github.com/leaanthony/idgen v1.0.0 h1:IZreR+JGEzFV4yeVuBZA25gM0keUoFy+RDUldncQ+Jw=
@@ -125,10 +128,8 @@ github.com/leaanthony/slicer v1.5.0 h1:aHYTN8xbCCLxJmkNKiLB6tgcMARl4eWmH9/F+S/0H
github.com/leaanthony/slicer v1.5.0/go.mod h1:FwrApmf8gOrpzEWM2J/9Lh79tyq8KTX5AzRtwV7m4AY=
github.com/leaanthony/typescriptify-golang-structs v0.1.7 h1:yoznzWzyxkO/iWdlpq+aPcuJ5Y/hpjq/lmgMFmpjwl0=
github.com/leaanthony/typescriptify-golang-structs v0.1.7/go.mod h1:cWtOkiVhMF77e6phAXUcfNwYmMwCJ67Sij24lfvi9Js=
github.com/leaanthony/webview2runtime v1.1.0 h1:N0pv55ift8XtqozIp4PNOtRCJ/Qdd/qzx80lUpalS4c=
github.com/leaanthony/webview2runtime v1.1.0/go.mod h1:hH9GnWCve3DYzNaPOcPbhHQ7fodXR1QJNsnwixid4Tk=
github.com/leaanthony/winc v0.0.0-20210921073452-54963136bf18 h1:5iOd93PZbpH4Iir8QkC4coFD+zEQEZSIRcjwjTFZkr0=
github.com/leaanthony/winc v0.0.0-20210921073452-54963136bf18/go.mod h1:KEbMsKoznsebyGHwLk5LqkFOxL5uXSRdvpP4+avmAMs=
github.com/leaanthony/winc v0.0.0-20211202091710-9931d43181ff h1:FwGObElCr/T/xy8S9IKDjWsNcfJHGxgjRl/GIbcseoQ=
github.com/leaanthony/winc v0.0.0-20211202091710-9931d43181ff/go.mod h1:KEbMsKoznsebyGHwLk5LqkFOxL5uXSRdvpP4+avmAMs=
github.com/leaanthony/winicon v1.0.0 h1:ZNt5U5dY71oEoKZ97UVwJRT4e+5xo5o/ieKuHuk8NqQ=
github.com/leaanthony/winicon v1.0.0/go.mod h1:en5xhijl92aphrJdmRPlh4NI1L6wq3gEm0LpXAPghjU=
github.com/leodido/go-urn v1.2.0 h1:hpXL4XnriNwQ/ABnpepYM/1vCLWNDfUNts8dX3xTG6Y=
@@ -159,6 +160,8 @@ github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/rogpeppe/go-internal v1.6.1 h1:/FiVV8dS/e+YqF2JvO3yXRFbBLTIuSDkuC7aBOAvL+k=
github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/savsgio/gotils v0.0.0-20200117113501-90175b0fbe3f h1:PgA+Olipyj258EIEYnpFFONrrCcAIWNUNoFhUfMqAGY=
github.com/savsgio/gotils v0.0.0-20200117113501-90175b0fbe3f/go.mod h1:lHhJedqxCoHN+zMtwGNTXWmF0u9Jt363FYRhV6g0CdY=
github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0=
@@ -208,8 +211,6 @@ github.com/wzshiming/winseq v0.0.0-20200112104235-db357dc107ae h1:tpXvBXC3hpQBDC
github.com/wzshiming/winseq v0.0.0-20200112104235-db357dc107ae/go.mod h1:VTAq37rkGeV+WOybvZwjXiJOicICdpLCN8ifpISjK20=
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0=
github.com/xyproto/xpm v1.2.1 h1:trdvGjjWBsOOKzBBUPT6JvaIQM3acJEEYfbxN7M96wg=
github.com/xyproto/xpm v1.2.1/go.mod h1:cMnesLsD0PBXLgjDfTDEaKr8XyTFsnP1QycSqRw7BiY=
github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/ztrue/tracerr v0.3.0 h1:lDi6EgEYhPYPnKcjsYzmWw4EkFEoA/gfe+I9Y5f+h6Y=
github.com/ztrue/tracerr v0.3.0/go.mod h1:qEalzze4VN9O8tnhBXScfCrmoJo10o8TN5ciKjm6Mww=
@@ -247,18 +248,17 @@ golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200810151505-1b9f1253b3ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210218145245-beda7e5e158e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210611083646-a4fc73990273/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 h1:foEbQz/B0Oz6YIqu/69kfXPYeFQAuuMYFkjaqXzl5Wo=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e h1:fLOSk5Q00efkSvAm+4xcoXD+RRmLmmulPn5I3Y9F2EM=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@@ -280,10 +280,12 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0
google.golang.org/protobuf v1.26.0 h1:bxAC2xTBsZGibn2RTntX0oH50xLsqy1OxA9tTL3p/lk=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk=
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME=
gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package wails

View File

@@ -1,3 +1,4 @@
//go:build !desktop && !hybrid && !server && !dev
// +build !desktop,!hybrid,!server,!dev
package app

View File

@@ -1,3 +1,4 @@
//go:build !server && !desktop && hybrid
// +build !server,!desktop,hybrid
package app

View File

@@ -1,4 +1,5 @@
//+build !windows
//go:build !windows
// +build !windows
package app

View File

@@ -1,4 +1,5 @@
//+build windows
//go:build windows
// +build windows
package app

View File

@@ -61,6 +61,9 @@ func generateBindings(bindings *binding.Bindings) error {
return err
}
if projectConfig.WailsJSDir == "" {
projectConfig.WailsJSDir = filepath.Join(cwd, "frontend")
}
wrapperDir := filepath.Join(projectConfig.WailsJSDir, "wailsjs", "runtime")
_ = os.RemoveAll(wrapperDir)
extractor := gosod.New(wrapper.RuntimeWrapper)
@@ -100,6 +103,12 @@ func generateBindings(bindings *binding.Bindings) error {
return err
}
bindingsTypes := filepath.Join(targetDir, "bindings.d.ts")
err = bindings.GenerateBackendTS(bindingsTypes)
if err != nil {
return err
}
return nil
}

View File

@@ -0,0 +1,32 @@
//go:build !dev && !production && !bindings && linux
package appng
import (
"fmt"
"github.com/wailsapp/wails/v2/pkg/options"
)
// App defines a Wails application structure
type App struct{}
func (a *App) Run() error {
return nil
}
// CreateApp creates the app!
func CreateApp(_ *options.App) (*App, error) {
// result := w32.MessageBox(0,
// `Wails applications will not build without the correct build tags.
//Please use "wails build" or press "OK" to open the documentation on how to use "go build"`,
// "Error",
// w32.MB_ICONERROR|w32.MB_OKCANCEL)
// if result == 1 {
// exec.Command("rundll32", "url.dll,FileProtocolHandler", "https://wails.io").Start()
// }
err := fmt.Errorf(`Wails applications will not build without the correct build tags.`)
return nil, err
}

View File

@@ -5,7 +5,13 @@ package appng
import (
"context"
"embed"
"flag"
"fmt"
iofs "io/fs"
"os"
"path/filepath"
"github.com/wailsapp/wails/v2/internal/binding"
"github.com/wailsapp/wails/v2/internal/frontend"
"github.com/wailsapp/wails/v2/internal/frontend/desktop"
@@ -16,18 +22,14 @@ import (
"github.com/wailsapp/wails/v2/internal/logger"
"github.com/wailsapp/wails/v2/internal/menumanager"
"github.com/wailsapp/wails/v2/internal/project"
"github.com/wailsapp/wails/v2/internal/signal"
pkglogger "github.com/wailsapp/wails/v2/pkg/logger"
"github.com/wailsapp/wails/v2/pkg/options"
"os"
"path/filepath"
)
// App defines a Wails application structure
type App struct {
frontend frontend.Frontend
logger *logger.Logger
signal *signal.Manager
options *options.App
menuManager *menumanager.Manager
@@ -60,19 +62,65 @@ func CreateApp(appoptions *options.App) (*App, error) {
myLogger.SetLogLevel(appoptions.LogLevel)
// Check for CLI Flags
assetdir := flag.String("assetdir", "", "Directory to serve assets")
devServerURL := flag.String("devserverurl", "", "URL of development server")
loglevel := flag.String("loglevel", "debug", "Loglevel to use - Trace, Debug, Info, Warning, Error")
flag.Parse()
if devServerURL != nil && *devServerURL != "" {
ctx = context.WithValue(ctx, "devserverurl", *devServerURL)
var assetdirFlag *string
var devServerURLFlag *string
var loglevelFlag *string
assetdir := os.Getenv("assetdir")
if assetdir == "" {
assetdirFlag = flag.String("assetdir", "", "Directory to serve assets")
}
if assetdir != nil && *assetdir != "" {
ctx = context.WithValue(ctx, "assetdir", *assetdir)
devServerURL := os.Getenv("devserverurl")
if devServerURL == "" {
devServerURLFlag = flag.String("devserverurl", "", "URL of development server")
}
if loglevel != nil && *loglevel != "" {
level, err := pkglogger.StringToLogLevel(*loglevel)
loglevel := os.Getenv("loglevel")
if loglevel == "" {
loglevelFlag = flag.String("loglevel", "debug", "Loglevel to use - Trace, Debug, Info, Warning, Error")
}
// If we weren't given the assetdir in the environment variables
if assetdir == "" {
flag.Parse()
if assetdirFlag != nil {
assetdir = *assetdirFlag
}
if devServerURLFlag != nil {
devServerURL = *devServerURLFlag
}
if loglevelFlag != nil {
loglevel = *loglevelFlag
}
}
if assetdir == "" {
// If no assetdir has been defined, let's try to infer it from the project root and the asset FS.
assetdir, err = tryInferAssetDirFromFS(appoptions.Assets)
if err != nil {
return nil, err
}
}
if assetdir != "" {
// Let's override the assets to serve from on disk, if needed
absdir, err := filepath.Abs(assetdir)
if err != nil {
return nil, err
}
myLogger.Info("Serving assets from disk: %s", absdir)
appoptions.Assets = os.DirFS(absdir)
ctx = context.WithValue(ctx, "assetdir", assetdir)
}
if devServerURL != "" {
ctx = context.WithValue(ctx, "devserverurl", devServerURL)
}
if loglevel != "" {
level, err := pkglogger.StringToLogLevel(loglevel)
if err != nil {
return nil, err
}
@@ -166,6 +214,42 @@ func generateBindings(bindings *binding.Bindings) error {
if err != nil {
return err
}
bindingsTypes := filepath.Join(targetDir, "bindings.d.ts")
err = bindings.GenerateBackendTS(bindingsTypes)
if err != nil {
return err
}
return nil
}
func tryInferAssetDirFromFS(assets iofs.FS) (string, error) {
if _, isEmbedFs := assets.(embed.FS); !isEmbedFs {
// We only infer the assetdir for embed.FS assets
return "", nil
}
path, err := fs.FindPathToFile(assets, "index.html")
if err != nil {
return "", err
}
path, err = filepath.Abs(path)
if err != nil {
return "", err
}
if _, err := os.Stat(filepath.Join(path, "index.html")); err != nil {
if os.IsNotExist(err) {
err = fmt.Errorf(
"inferred assetdir '%s' does not exist or does not contain an 'index.html' file, "+
"please specify it with -assetdir or set it in wails.json",
path)
}
return "", err
}
return path, nil
}

View File

@@ -0,0 +1,15 @@
//go:build linux && !bindings
package appng
import (
"github.com/wailsapp/wails/v2/internal/logger"
"github.com/wailsapp/wails/v2/pkg/options"
)
func PreflightChecks(options *options.App, logger *logger.Logger) error {
_ = options
return nil
}

View File

@@ -5,6 +5,7 @@ package appng
import (
"context"
"github.com/wailsapp/wails/v2/internal/binding"
"github.com/wailsapp/wails/v2/internal/frontend"
"github.com/wailsapp/wails/v2/internal/frontend/desktop"
@@ -12,7 +13,6 @@ import (
"github.com/wailsapp/wails/v2/internal/frontend/runtime"
"github.com/wailsapp/wails/v2/internal/logger"
"github.com/wailsapp/wails/v2/internal/menumanager"
"github.com/wailsapp/wails/v2/internal/signal"
"github.com/wailsapp/wails/v2/pkg/options"
)
@@ -20,7 +20,6 @@ import (
type App struct {
frontend frontend.Frontend
logger *logger.Logger
signal *signal.Manager
options *options.App
menuManager *menumanager.Manager
@@ -82,6 +81,9 @@ func CreateApp(appoptions *options.App) (*App, error) {
appFrontend := desktop.NewFrontend(ctx, appoptions, myLogger, appBindings, messageDispatcher)
eventHandler.AddFrontend(appFrontend)
// Attach logger to context
ctx = context.WithValue(ctx, "logger", myLogger)
result := &App{
ctx: ctx,
frontend: appFrontend,

View File

@@ -15,9 +15,9 @@ func PreflightChecks(options *options.App, logger *logger.Logger) error {
// Process the webview2 runtime situation. We can pass a strategy in via the `webview2` flag for `wails build`.
// This will determine how wv2runtime.Process will handle a lack of valid runtime.
installedVersion, err := wv2runtime.Process()
if installedVersion != nil {
logger.Debug("WebView2 Runtime installed: Name: '%s' Version:'%s' Location:'%s'. Minimum version required: %s.",
installedVersion.Name, installedVersion.Version, installedVersion.Location, wv2runtime.MinimumRuntimeVersion)
if installedVersion != "" {
logger.Debug("WebView2 Runtime Version '%s' installed. Minimum version required: %s.",
installedVersion, wv2runtime.MinimumRuntimeVersion)
}
if err != nil {
return err

View File

@@ -1,4 +1,6 @@
//go:build !desktop
// +build !desktop
package assetdb
import (

View File

@@ -100,12 +100,10 @@ func (b *Bindings) GenerateBackendJS(targetfile string, isDevBindings bool) erro
})
output.WriteString(fmt.Sprintf(" }"))
output.WriteString("\n")
output.WriteString(" },\n")
})
output.WriteString(fmt.Sprintf(" },\n"))
output.WriteString("\n")
output.WriteString(" },\n\n")
})
output.WriteString(`};
@@ -124,6 +122,83 @@ export default go;`)
return os.WriteFile(targetfile, output.Bytes(), 0755)
}
// GenerateBackendTS generates typescript bindings for
// the bound methods.
func (b *Bindings) GenerateBackendTS(targetfile string) error {
store := b.db.store
var output bytes.Buffer
output.WriteString("interface go {\n")
var sortedPackageNames slicer.StringSlicer
for packageName := range store {
sortedPackageNames.Add(packageName)
}
sortedPackageNames.Sort()
sortedPackageNames.Each(func(packageName string) {
packages := store[packageName]
output.WriteString(fmt.Sprintf(" \"%s\": {", packageName))
output.WriteString("\n")
var sortedStructNames slicer.StringSlicer
for structName := range packages {
sortedStructNames.Add(structName)
}
sortedStructNames.Sort()
sortedStructNames.Each(func(structName string) {
structs := packages[structName]
output.WriteString(fmt.Sprintf(" \"%s\": {", structName))
output.WriteString("\n")
var sortedMethodNames slicer.StringSlicer
for methodName := range structs {
sortedMethodNames.Add(methodName)
}
sortedMethodNames.Sort()
sortedMethodNames.Each(func(methodName string) {
methodDetails := structs[methodName]
output.WriteString(fmt.Sprintf("\t\t%s(", methodName))
var args slicer.StringSlicer
for count, input := range methodDetails.Inputs {
arg := fmt.Sprintf("arg%d", count+1)
args.Add(arg + ":" + goTypeToTypescriptType(input.TypeName))
}
output.WriteString(args.Join(",") + "):")
returnType := "Promise"
if methodDetails.OutputCount() > 0 {
firstType := goTypeToTypescriptType(methodDetails.Outputs[0].TypeName)
returnType += "<" + firstType
if methodDetails.OutputCount() == 2 {
secondType := goTypeToTypescriptType(methodDetails.Outputs[1].TypeName)
returnType += "|" + secondType
}
returnType += ">"
} else {
returnType = "Promise<void>"
}
output.WriteString(returnType + "\n")
})
output.WriteString(" },\n")
})
output.WriteString(" }\n\n")
})
output.WriteString("}\n")
globals := `
declare global {
interface Window {
go: go;
}
}
`
output.WriteString(globals)
return os.WriteFile(targetfile, output.Bytes(), 0755)
}
func goTypeToJSDocType(input string) string {
switch true {
case input == "string":
@@ -141,7 +216,7 @@ func goTypeToJSDocType(input string) string {
return "string"
case strings.HasPrefix(input, "[]"):
arrayType := goTypeToJSDocType(input[2:])
return "Array.<" + arrayType + ">"
return "Array<" + arrayType + ">"
default:
if strings.ContainsRune(input, '.') {
return strings.Split(input, ".")[1]
@@ -149,3 +224,11 @@ func goTypeToJSDocType(input string) string {
return "any"
}
}
func goTypeToTypescriptType(input string) string {
if strings.HasPrefix(input, "[]") {
arrayType := goTypeToJSDocType(input[2:])
return "Array<" + arrayType + ">"
}
return goTypeToJSDocType(input)
}

View File

@@ -78,10 +78,16 @@ func (b *Bindings) getMethods(value interface{}) ([]*BoundMethod, error) {
input := methodType.In(inputIndex)
thisParam := newParameter("", input)
thisInput := input
if thisInput.Kind() == reflect.Slice {
thisInput = thisInput.Elem()
}
// Process struct pointer params
if input.Kind() == reflect.Ptr {
if input.Elem().Kind() == reflect.Struct {
typ := input.Elem()
if thisInput.Kind() == reflect.Ptr {
if thisInput.Elem().Kind() == reflect.Struct {
typ := thisInput.Elem()
a := reflect.New(typ)
s := reflect.Indirect(a).Interface()
b.converter.Add(s)
@@ -89,8 +95,8 @@ func (b *Bindings) getMethods(value interface{}) ([]*BoundMethod, error) {
}
// Process struct params
if input.Kind() == reflect.Struct {
a := reflect.New(input)
if thisInput.Kind() == reflect.Struct {
a := reflect.New(thisInput)
s := reflect.Indirect(a).Interface()
b.converter.Add(s)
}
@@ -108,6 +114,30 @@ func (b *Bindings) getMethods(value interface{}) ([]*BoundMethod, error) {
for outputIndex := 0; outputIndex < outputParamCount; outputIndex++ {
output := methodType.Out(outputIndex)
thisParam := newParameter("", output)
thisOutput := output
if thisOutput.Kind() == reflect.Slice {
thisOutput = thisOutput.Elem()
}
// Process struct pointer params
if thisOutput.Kind() == reflect.Ptr {
if thisOutput.Elem().Kind() == reflect.Struct {
typ := thisOutput.Elem()
a := reflect.New(typ)
s := reflect.Indirect(a).Interface()
b.converter.Add(s)
}
}
// Process struct params
if thisOutput.Kind() == reflect.Struct {
a := reflect.New(thisOutput)
s := reflect.Indirect(a).Interface()
b.converter.Add(s)
}
outputs = append(outputs, thisParam)
}
boundMethod.Outputs = outputs

View File

@@ -1,3 +1,4 @@
//go:build !windows
// +build !windows
package ffenestri

View File

@@ -1,3 +1,4 @@
//go:build windows
// +build windows
package ffenestri

View File

@@ -1252,7 +1252,7 @@ void createDelegate(struct Application *app) {
app->delegate = delegate;
msg_id(app->application, s("setDelegate:"), delegate);
msg_id(app->application, s("setDelegate:"), delegate);
}
bool windowShouldClose(id self, SEL cmd, id sender) {

View File

@@ -1 +1 @@
The version of WebView2 used: 1.0.864.35
The version of WebView2 SDK used: 1.0.992.28

View File

@@ -7,7 +7,7 @@ set sdk_version=%1
set native_dir="%~dp0\microsoft.web.webview2.%sdk_version%\build\native"
copy "%native_dir%\include\*.h" .. >NUL
copy "%native_dir%\x64\WebView2Loader.dll" "..\x64" >NUL
@rd /S /Q "microsoft.web.webview2.%sdk_version%"
@REM @rd /S /Q "microsoft.web.webview2.%sdk_version%"
del /s version.txt >nul 2>&1
echo The version of WebView2 SDK used: %sdk_version% > sdkversion.txt
echo SDK updated to %sdk_version%

View File

@@ -1,10 +1,11 @@
//go:build wv2runtime.browser
// +build wv2runtime.browser
package wv2runtime
import (
"fmt"
"github.com/leaanthony/webview2runtime"
"github.com/wailsapp/wails/v2/internal/webview2runtime"
)
func doInstallationStrategy(installStatus installationStatus) error {

View File

@@ -1,12 +1,11 @@
// +build !wv2runtime.error
// +build !wv2runtime.browser
// +build !wv2runtime.embed
//go:build !wv2runtime.error && !wv2runtime.browser && !wv2runtime.embed
// +build !wv2runtime.error,!wv2runtime.browser,!wv2runtime.embed
package wv2runtime
import (
"fmt"
"github.com/leaanthony/webview2runtime"
"github.com/wailsapp/wails/v2/internal/webview2runtime"
)
func doInstallationStrategy(installStatus installationStatus) error {

View File

@@ -1,10 +1,11 @@
//go:build wv2runtime.embed
// +build wv2runtime.embed
package wv2runtime
import (
"fmt"
"github.com/leaanthony/webview2runtime"
"github.com/wailsapp/wails/v2/internal/webview2runtime"
)
func doInstallationStrategy(installStatus installationStatus) error {

View File

@@ -1,10 +1,11 @@
//go:build wv2runtime.error
// +build wv2runtime.error
package wv2runtime
import (
"fmt"
"github.com/leaanthony/webview2runtime"
"github.com/wailsapp/wails/v2/internal/webview2runtime"
)
func doInstallationStrategy(installStatus installationStatus) error {

View File

@@ -2,10 +2,9 @@ package wv2runtime
import (
"github.com/leaanthony/go-webview2/webviewloader"
"github.com/leaanthony/webview2runtime"
)
const MinimumRuntimeVersion string = "91.0.864.48"
const MinimumRuntimeVersion string = "91.0.992.28"
type installationStatus int
@@ -15,14 +14,17 @@ const (
installed
)
func Process() (*webview2runtime.Info, error) {
func Process() (string, error) {
installStatus := needsInstalling
installedVersion := webview2runtime.GetInstalledVersion()
if installedVersion != nil {
installedVersion, err := webviewloader.GetInstalledVersion()
if err != nil {
return "", err
}
if installedVersion != "" {
installStatus = installed
compareResult, err := webviewloader.CompareBrowserVersions(installedVersion.Version, MinimumRuntimeVersion)
compareResult, err := webviewloader.CompareBrowserVersions(installedVersion, MinimumRuntimeVersion)
if err != nil {
return nil, err
return "", err
}
updateRequired := compareResult == -1
// Installed and does not require updating

View File

@@ -1,14 +1,16 @@
//+build windows
//go:build windows
// +build windows
package ffenestri
import (
"fmt"
"github.com/leaanthony/slicer"
"github.com/wailsapp/wails/v2/internal/menumanager"
"os"
"sync"
"text/tabwriter"
"github.com/leaanthony/slicer"
"github.com/wailsapp/wails/v2/internal/menumanager"
)
/* ---------------------------------------------------------------------------------

View File

@@ -1,4 +1,5 @@
//+build windows,debug
//go:build windows && debug
// +build windows,debug
package ffenestri

View File

@@ -1,3 +1,4 @@
//go:build windows && !debug
// +build windows,!debug
package ffenestri

View File

@@ -1,4 +1,5 @@
//+build windows
//go:build windows
// +build windows
package ffenestri

View File

@@ -1,4 +1,5 @@
//+build windows
//go:build windows
// +build windows
package ffenestri

View File

@@ -1,4 +1,5 @@
//+build windows
//go:build windows
// +build windows
package ffenestri

View File

@@ -1,4 +1,5 @@
//+build windows
//go:build windows
// +build windows
package ffenestri

View File

@@ -5,9 +5,13 @@ package assetserver
import (
"bytes"
"context"
"io/fs"
"strings"
"github.com/wailsapp/wails/v2/internal/frontend/runtime"
"github.com/wailsapp/wails/v2/pkg/options"
"path/filepath"
"github.com/wailsapp/wails/v2/internal/logger"
"golang.org/x/net/html"
)
/*
@@ -17,39 +21,49 @@ It injects a websocket based IPC script into `index.html`.
*/
import (
"os"
)
type BrowserAssetServer struct {
runtimeJS []byte
assetdir string
appOptions *options.App
assets fs.FS
runtimeJS []byte
logger *logger.Logger
}
func NewBrowserAssetServer(assetdir string, bindingsJSON string, appOptions *options.App) (*BrowserAssetServer, error) {
result := &BrowserAssetServer{
assetdir: assetdir,
appOptions: appOptions,
func NewBrowserAssetServer(ctx context.Context, assets fs.FS, bindingsJSON string) (*BrowserAssetServer, error) {
result := &BrowserAssetServer{}
_logger := ctx.Value("logger")
if _logger != nil {
result.logger = _logger.(*logger.Logger)
}
var err error
result.assets, err = prepareAssetsForServing(assets)
if err != nil {
return nil, err
}
var buffer bytes.Buffer
buffer.WriteString(`window.wailsbindings='` + bindingsJSON + `';` + "\n")
buffer.Write(runtime.RuntimeDesktopJS)
result.runtimeJS = buffer.Bytes()
return result, nil
}
func (a *BrowserAssetServer) loadFileFromDisk(filename string) ([]byte, error) {
return os.ReadFile(filepath.Join(a.assetdir, filename))
func (d *BrowserAssetServer) LogDebug(message string, args ...interface{}) {
if d.logger != nil {
d.logger.Debug("[BrowserAssetServer] "+message, args...)
}
}
func (a *BrowserAssetServer) processIndexHTML() ([]byte, error) {
indexHTML, err := a.loadFileFromDisk("index.html")
indexHTML, err := fs.ReadFile(a.assets, "index.html")
if err != nil {
return nil, err
}
indexHTML, err = injectHTML(string(indexHTML), `<div id="wails-spinner"></div>`)
htmlNode, err := getHTMLNode(indexHTML)
if err != nil {
return nil, err
}
err = appendSpinnerToBody(htmlNode)
if err != nil {
return nil, err
}
@@ -57,19 +71,27 @@ func (a *BrowserAssetServer) processIndexHTML() ([]byte, error) {
if err != nil {
return nil, err
}
if wailsOptions.disableRuntimeInjection == false {
indexHTML, err = injectHTML(string(indexHTML), `<script src="/wails/runtime.js"></script>`)
if err != nil {
return nil, err
}
}
if wailsOptions.disableIPCInjection == false {
indexHTML, err = injectHTML(string(indexHTML), `<script src="/wails/ipc.js"></script>`)
err := insertScriptInHead(htmlNode, "/wails/ipc.js")
if err != nil {
return nil, err
}
}
return indexHTML, nil
if wailsOptions.disableRuntimeInjection == false {
err := insertScriptInHead(htmlNode, "/wails/runtime.js")
if err != nil {
return nil, err
}
}
var buffer bytes.Buffer
err = html.Render(&buffer, htmlNode)
if err != nil {
return nil, err
}
return buffer.Bytes(), nil
}
func (a *BrowserAssetServer) Load(filename string) ([]byte, string, error) {
@@ -83,7 +105,9 @@ func (a *BrowserAssetServer) Load(filename string) ([]byte, string, error) {
case "/wails/ipc.js":
content = runtime.WebsocketIPC
default:
content, err = a.loadFileFromDisk(filename)
filename = strings.TrimPrefix(filename, "/")
a.LogDebug("Loading file: %s", filename)
content, err = fs.ReadFile(a.assets, filename)
}
if err != nil {
return nil, "", err

View File

@@ -0,0 +1,25 @@
package assetserver
import (
iofs "io/fs"
"path"
"github.com/wailsapp/wails/v2/internal/fs"
)
func prepareAssetsForServing(assets iofs.FS) (iofs.FS, error) {
if _, err := assets.Open("."); err != nil {
return nil, err
}
subDir, err := fs.FindPathToFile(assets, "index.html")
if err != nil {
return nil, err
}
assets, err = iofs.Sub(assets, path.Clean(subDir))
if err != nil {
return nil, err
}
return assets, nil
}

View File

@@ -3,26 +3,21 @@ package assetserver
import (
"bytes"
"context"
"embed"
"fmt"
"github.com/leaanthony/debme"
"github.com/leaanthony/slicer"
"github.com/wailsapp/wails/v2/internal/frontend/runtime"
"github.com/wailsapp/wails/v2/internal/logger"
"io/fs"
"log"
"path/filepath"
"strings"
"github.com/wailsapp/wails/v2/internal/frontend/runtime"
"github.com/wailsapp/wails/v2/internal/logger"
)
type DesktopAssetServer struct {
assets debme.Debme
assets fs.FS
runtimeJS []byte
assetdir string
logger *logger.Logger
}
func NewDesktopAssetServer(ctx context.Context, assets embed.FS, bindingsJSON string) (*DesktopAssetServer, error) {
func NewDesktopAssetServer(ctx context.Context, assets fs.FS, bindingsJSON string) (*DesktopAssetServer, error) {
result := &DesktopAssetServer{}
_logger := ctx.Value("logger")
@@ -30,22 +25,18 @@ func NewDesktopAssetServer(ctx context.Context, assets embed.FS, bindingsJSON st
result.logger = _logger.(*logger.Logger)
}
_assetdir := ctx.Value("assetdir")
if _assetdir != nil {
result.assetdir = _assetdir.(string)
absdir, err := filepath.Abs(result.assetdir)
if err != nil {
return nil, err
}
result.LogDebug("Loading assets from: %s", absdir)
var err error
result.assets, err = prepareAssetsForServing(assets)
if err != nil {
return nil, err
}
var buffer bytes.Buffer
buffer.WriteString(`window.wailsbindings='` + bindingsJSON + `';` + "\n")
buffer.Write(runtime.RuntimeDesktopJS)
result.runtimeJS = buffer.Bytes()
err := result.init(assets)
return result, err
return result, nil
}
func (d *DesktopAssetServer) LogDebug(message string, args ...interface{}) {
@@ -54,63 +45,8 @@ func (d *DesktopAssetServer) LogDebug(message string, args ...interface{}) {
}
}
func (d *DesktopAssetServer) SetAssetDir(assetdir string) {
d.assetdir = assetdir
}
func PathToIndexHTML(assets embed.FS) (string, error) {
stat, err := fs.Stat(assets, "index.html")
if stat != nil {
return ".", nil
}
var indexFiles slicer.StringSlicer
err = fs.WalkDir(assets, ".", func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}
if strings.HasSuffix(path, "index.html") {
indexFiles.Add(path)
}
return nil
})
if err != nil {
return "", err
}
if indexFiles.Length() > 1 {
return "", fmt.Errorf("multiple 'index.html' files found in assets")
}
path, _ := filepath.Split(indexFiles.AsSlice()[0])
return path, nil
}
func processAssets(assets embed.FS) (debme.Debme, error) {
result, err := debme.FS(assets, ".")
if err != nil {
return result, err
}
// Find index.html
path, err := PathToIndexHTML(assets)
if err != nil {
return debme.Debme{}, err
}
return debme.FS(assets, path)
}
func (a *DesktopAssetServer) init(assets embed.FS) error {
var err error
a.assets, err = processAssets(assets)
if err != nil {
return err
}
return nil
}
func (a *DesktopAssetServer) processIndexHTML() ([]byte, error) {
indexHTML, err := a.ReadFile("index.html")
indexHTML, err := fs.ReadFile(a.assets, "index.html")
if err != nil {
return nil, err
}
@@ -146,7 +82,9 @@ func (a *DesktopAssetServer) Load(filename string) ([]byte, string, error) {
case "/wails/ipc.js":
content = runtime.DesktopIPC
default:
content, err = a.ReadFile(filename)
filename = strings.TrimPrefix(filename, "/")
a.LogDebug("Loading file: %s", filename)
content, err = fs.ReadFile(a.assets, filename)
}
if err != nil {
return nil, "", err

View File

@@ -1,13 +0,0 @@
//go:build dev
package assetserver
import (
"os"
"path/filepath"
)
func (a *DesktopAssetServer) ReadFile(filename string) ([]byte, error) {
a.LogDebug("Loading file from disk: %s", filename)
return os.ReadFile(filepath.Join(a.assetdir, filename))
}

View File

@@ -1,7 +0,0 @@
//go:build production
package assetserver
func (a *DesktopAssetServer) ReadFile(filename string) ([]byte, error) {
return a.assets.ReadFile(filename)
}

View File

@@ -2,6 +2,7 @@ package assetserver
import (
"bytes"
"errors"
"fmt"
"golang.org/x/net/html"
"strings"
@@ -12,7 +13,7 @@ type optionType string
const (
noAutoInject optionType = "noautoinject"
noAutoInjectRuntime optionType = "noautoinjectruntime"
noautoinjectipc optionType = "noautoinjectipc"
noAutoInjectIPC optionType = "noautoinjectipc"
)
type Options struct {
@@ -29,7 +30,7 @@ func newOptions(optionString string) *Options {
case noAutoInject:
result.disableRuntimeInjection = true
result.disableIPCInjection = true
case noautoinjectipc:
case noAutoInjectIPC:
result.disableIPCInjection = true
case noAutoInjectRuntime:
result.disableRuntimeInjection = true
@@ -86,3 +87,77 @@ func extractOptions(htmldata []byte) (*Options, error) {
}
return result, nil
}
func createScriptNode(scriptName string) *html.Node {
return &html.Node{
Type: html.ElementNode,
Data: "script",
Attr: []html.Attribute{
{
Key: "src",
Val: scriptName,
},
},
}
}
func createDivNode(id string) *html.Node {
return &html.Node{
Type: html.ElementNode,
Data: "div",
Attr: []html.Attribute{
{
Namespace: "",
Key: "id",
Val: id,
},
},
}
}
func insertScriptInHead(htmlNode *html.Node, scriptName string) error {
headNode := findFirstTag(htmlNode, "head")
if headNode == nil {
return errors.New("cannot find head in HTML")
}
scriptNode := createScriptNode(scriptName)
if headNode.FirstChild != nil {
headNode.InsertBefore(scriptNode, headNode.FirstChild)
} else {
headNode.AppendChild(scriptNode)
}
return nil
}
func appendSpinnerToBody(htmlNode *html.Node) error {
bodyNode := findFirstTag(htmlNode, "body")
if bodyNode == nil {
return errors.New("cannot find body in HTML")
}
scriptNode := createDivNode("wails-spinner")
bodyNode.AppendChild(scriptNode)
return nil
}
func getHTMLNode(htmldata []byte) (*html.Node, error) {
return html.Parse(bytes.NewReader(htmldata))
}
func findFirstTag(htmlnode *html.Node, tagName string) *html.Node {
var extractor func(*html.Node) *html.Node
var result *html.Node
extractor = func(node *html.Node) *html.Node {
if node.Type == html.ElementNode && node.Data == tagName {
return node
}
for child := node.FirstChild; child != nil; child = child.NextSibling {
result := extractor(child)
if result != nil {
return result
}
}
return nil
}
result = extractor(htmlnode)
return result
}

View File

@@ -0,0 +1,20 @@
package common
import "net/url"
func TranslateUriToFile(uri string, expectedScheme string, expectedHost string) (file string, match bool, err error) {
url, err := url.Parse(uri)
if err != nil {
return "", false, err
}
if url.Scheme != expectedScheme || url.Host != expectedHost {
return "", false, nil
}
filePath := url.Path
if filePath == "" {
filePath = "/"
}
return filePath, true, nil
}

View File

@@ -0,0 +1,23 @@
//
// AppDelegate.h
// test
//
// Created by Lea Anthony on 10/10/21.
//
#ifndef AppDelegate_h
#define AppDelegate_h
#import <Cocoa/Cocoa.h>
#import "WailsContext.h"
@interface AppDelegate : NSResponder <NSTouchBarProvider>
@property bool alwaysOnTop;
@property bool startHidden;
@property bool startFullscreen;
@property (retain) WailsWindow* mainWindow;
@end
#endif /* AppDelegate_h */

View File

@@ -0,0 +1,43 @@
//
// AppDelegate.m
// test
//
// Created by Lea Anthony on 10/10/21.
//
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import "AppDelegate.h"
@implementation AppDelegate
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender {
return NO;
}
- (void)applicationWillFinishLaunching:(NSNotification *)aNotification {
[NSApp setActivationPolicy:NSApplicationActivationPolicyRegular];
if (self.alwaysOnTop) {
[self.mainWindow setLevel:NSStatusWindowLevel];
}
if ( !self.startHidden ) {
[self.mainWindow makeKeyAndOrderFront:self];
}
}
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
[NSApp activateIgnoringOtherApps:YES];
if ( self.startFullscreen ) {
NSWindowCollectionBehavior behaviour = [self.mainWindow collectionBehavior];
behaviour |= NSWindowCollectionBehaviorFullScreenPrimary;
[self.mainWindow setCollectionBehavior:behaviour];
[self.mainWindow toggleFullScreen:nil];
}
}
- (void)dealloc {
[super dealloc];
}
@synthesize touchBar;
@end

View File

@@ -0,0 +1,66 @@
//
// Application.h
// test
//
// Created by Lea Anthony on 10/10/21.
//
#ifndef Application_h
#define Application_h
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import "WailsContext.h"
#define WindowStartsNormal 0
#define WindowStartsMaximised 1
#define WindowStartsMinimised 2
#define WindowStartsFullscreen 3
WailsContext* Create(const char* title, int width, int height, int frameless, int resizable, int fullscreen, int fullSizeContent, int hideTitleBar, int titlebarAppearsTransparent, int hideTitle, int useToolbar, int hideToolbarSeparator, int webviewIsTransparent, int alwaysOnTop, int hideWindowOnClose, const char *appearance, int windowIsTranslucent, int debug, int windowStartState, int startsHidden, int minWidth, int minHeight, int maxWidth, int maxHeight);
void Run(void*);
void SetTitle(void* ctx, const char *title);
void Center(void* ctx);
void SetSize(void* ctx, int width, int height);
void SetMinSize(void* ctx, int width, int height);
void SetMaxSize(void* ctx, int width, int height);
void SetPosition(void* ctx, int x, int y);
void Fullscreen(void* ctx);
void UnFullscreen(void* ctx);
void Minimise(void* ctx);
void UnMinimise(void* ctx);
void Maximise(void* ctx);
void UnMaximise(void* ctx);
void Hide(void* ctx);
void Show(void* ctx);
void SetRGBA(void* ctx, int r, int g, int b, int a);
void ExecJS(void* ctx, const char*);
void Quit(void*);
const char* GetSize(void *ctx);
const char* GetPos(void *ctx);
void ProcessURLResponse(void *inctx, const char *url, int statusCode, const char *contentType, void* data, int datalength);
/* Dialogs */
void MessageDialog(void *inctx, const char* dialogType, const char* title, const char* message, const char* button1, const char* button2, const char* button3, const char* button4, const char* defaultButton, const char* cancelButton, void* iconData, int iconDataLength);
void OpenFileDialog(void *inctx, const char* title, const char* defaultFilename, const char* defaultDirectory, int allowDirectories, int allowFiles, int canCreateDirectories, int treatPackagesAsDirectories, int resolveAliases, int showHiddenFiles, int allowMultipleSelection, const char* filters);
void SaveFileDialog(void *inctx, const char* title, const char* defaultFilename, const char* defaultDirectory, int canCreateDirectories, int treatPackagesAsDirectories, int showHiddenFiles, const char* filters);
/* Application Menu */
void* NewMenu(const char* name);
void AppendSubmenu(void* parent, void* child);
void AppendRole(void *inctx, void *inMenu, int role);
void SetAsApplicationMenu(void *inctx, void *inMenu);
void UpdateApplicationMenu(void *inctx);
void SetAbout(void *inctx, const char* title, const char* description, void* imagedata, int datalen);
void* AppendMenuItem(void* inctx, void* nsmenu, const char* label, const char* shortcutKey, int modifiers, int disabled, int checked, int menuItemID);
void AppendSeparator(void* inMenu);
void UpdateMenuItem(void* nsmenuitem, int checked);
NSString* safeInit(const char* input);
#endif /* Application_h */

View File

@@ -0,0 +1,339 @@
//
// Application.m
//
// Created by Lea Anthony on 10/10/21.
//
#import <Foundation/Foundation.h>
#import <Cocoa/Cocoa.h>
#import "WailsContext.h"
#import "Application.h"
#import "AppDelegate.h"
#import "WailsMenu.h"
#import "WailsMenuItem.h"
WailsContext* Create(const char* title, int width, int height, int frameless, int resizable, int fullscreen, int fullSizeContent, int hideTitleBar, int titlebarAppearsTransparent, int hideTitle, int useToolbar, int hideToolbarSeparator, int webviewIsTransparent, int alwaysOnTop, int hideWindowOnClose, const char *appearance, int windowIsTranslucent, int debug, int windowStartState, int startsHidden, int minWidth, int minHeight, int maxWidth, int maxHeight) {
[NSApplication sharedApplication];
WailsContext *result = [WailsContext new];
result.debug = debug;
if ( windowStartState == WindowStartsFullscreen ) {
fullscreen = 1;
}
[result CreateWindow:width :height :frameless :resizable :fullscreen :fullSizeContent :hideTitleBar :titlebarAppearsTransparent :hideTitle :useToolbar :hideToolbarSeparator :webviewIsTransparent :hideWindowOnClose :safeInit(appearance) :windowIsTranslucent :minWidth :minHeight :maxWidth :maxHeight];
[result SetTitle:safeInit(title)];
[result Center];
switch( windowStartState ) {
case WindowStartsMaximised:
[result.mainWindow zoom:nil];
break;
case WindowStartsMinimised:
//TODO: Can you start a mac app minimised?
break;
}
if ( startsHidden == 1 ) {
result.startHidden = true;
}
if ( fullscreen == 1 ) {
result.startFullscreen = true;
}
result.alwaysOnTop = alwaysOnTop;
result.hideOnClose = hideWindowOnClose;
return result;
}
void ProcessURLResponse(void *inctx, const char *url, int statusCode, const char *contentType, void* data, int datalength) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
NSString *nsurl = safeInit(url);
NSString *nsContentType = safeInit(contentType);
NSData *nsdata = [NSData dataWithBytes:data length:datalength];
[ctx processURLResponse:nsurl :statusCode :nsContentType :nsdata];
[nsdata release];
}
void ExecJS(void* inctx, const char *script) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
NSString *nsscript = safeInit(script);
ON_MAIN_THREAD(
[ctx ExecJS:nsscript];
);
}
void SetTitle(void* inctx, const char *title) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
NSString *_title = safeInit(title);
ON_MAIN_THREAD(
[ctx SetTitle:_title];
);
}
void SetRGBA(void *inctx, int r, int g, int b, int a) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
ON_MAIN_THREAD(
[ctx SetRGBA:r :g :b :a];
);
}
void SetSize(void* inctx, int width, int height) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
ON_MAIN_THREAD(
[ctx SetSize:width :height];
);
}
void SetMinSize(void* inctx, int width, int height) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
ON_MAIN_THREAD(
[ctx SetMinSize:width :height];
);
}
void SetMaxSize(void* inctx, int width, int height) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
ON_MAIN_THREAD(
[ctx SetMaxSize:width :height];
);
}
void SetPosition(void* inctx, int x, int y) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
ON_MAIN_THREAD(
[ctx SetPosition:x :y];
);
}
void Center(void* inctx) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
ON_MAIN_THREAD(
[ctx Center];
);
}
void Fullscreen(void* inctx) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
ON_MAIN_THREAD(
[ctx Fullscreen];
);
}
void UnFullscreen(void* inctx) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
ON_MAIN_THREAD(
[ctx UnFullscreen];
);
}
void Minimise(void* inctx) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
ON_MAIN_THREAD(
[ctx Minimise];
);
}
void UnMinimise(void* inctx) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
ON_MAIN_THREAD(
[ctx UnMinimise];
);
}
void Maximise(void* inctx) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
ON_MAIN_THREAD(
[ctx Maximise];
);
}
const char* GetSize(void *inctx) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
NSRect frame = [ctx.mainWindow frame];
NSString *result = [NSString stringWithFormat:@"%d,%d", (int)frame.size.width, (int)frame.size.height];
return [result UTF8String];
}
const char* GetPos(void *inctx) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
NSScreen* screen = [ctx getCurrentScreen];
NSRect windowFrame = [ctx.mainWindow frame];
NSRect screenFrame = [screen visibleFrame];
int x = windowFrame.origin.x - screenFrame.origin.x;
int y = windowFrame.origin.y - screenFrame.origin.y;
y = screenFrame.size.height - y - windowFrame.size.height;
NSString *result = [NSString stringWithFormat:@"%d,%d",x,y];
return [result UTF8String];
}
void UnMaximise(void* inctx) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
ON_MAIN_THREAD(
[ctx UnMaximise];
);
}
void Quit(void *inctx) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
[NSApp stop:ctx];
}
void Hide(void *inctx) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
ON_MAIN_THREAD(
[ctx Hide];
);
}
void Show(void *inctx) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
ON_MAIN_THREAD(
[ctx Show];
);
}
NSString* safeInit(const char* input) {
NSString *result = nil;
if (input != nil) {
result = [NSString stringWithUTF8String:input];
}
return result;
}
void MessageDialog(void *inctx, const char* dialogType, const char* title, const char* message, const char* button1, const char* button2, const char* button3, const char* button4, const char* defaultButton, const char* cancelButton, void* iconData, int iconDataLength) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
NSString *_dialogType = safeInit(dialogType);
NSString *_title = safeInit(title);
NSString *_message = safeInit(message);
NSString *_button1 = safeInit(button1);
NSString *_button2 = safeInit(button2);
NSString *_button3 = safeInit(button3);
NSString *_button4 = safeInit(button4);
NSString *_defaultButton = safeInit(defaultButton);
NSString *_cancelButton = safeInit(cancelButton);
ON_MAIN_THREAD(
[ctx MessageDialog:_dialogType :_title :_message :_button1 :_button2 :_button3 :_button4 :_defaultButton :_cancelButton :iconData :iconDataLength];
)
}
void OpenFileDialog(void *inctx, const char* title, const char* defaultFilename, const char* defaultDirectory, int allowDirectories, int allowFiles, int canCreateDirectories, int treatPackagesAsDirectories, int resolveAliases, int showHiddenFiles, int allowMultipleSelection, const char* filters) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
NSString *_title = safeInit(title);
NSString *_defaultFilename = safeInit(defaultFilename);
NSString *_defaultDirectory = safeInit(defaultDirectory);
NSString *_filters = safeInit(filters);
ON_MAIN_THREAD(
[ctx OpenFileDialog:_title :_defaultFilename :_defaultDirectory :allowDirectories :allowFiles :canCreateDirectories :treatPackagesAsDirectories :resolveAliases :showHiddenFiles :allowMultipleSelection :_filters];
)
}
void SaveFileDialog(void *inctx, const char* title, const char* defaultFilename, const char* defaultDirectory, int canCreateDirectories, int treatPackagesAsDirectories, int showHiddenFiles, const char* filters) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
NSString *_title = safeInit(title);
NSString *_defaultFilename = safeInit(defaultFilename);
NSString *_defaultDirectory = safeInit(defaultDirectory);
NSString *_filters = safeInit(filters);
ON_MAIN_THREAD(
[ctx SaveFileDialog:_title :_defaultFilename :_defaultDirectory :canCreateDirectories :treatPackagesAsDirectories :showHiddenFiles :_filters];
)
}
void AppendRole(void *inctx, void *inMenu, int role) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
WailsMenu *menu = (__bridge WailsMenu*) inMenu;
[menu appendRole :ctx :role];
}
void* NewMenu(const char *name) {
NSString *title = @"";
if (name != nil) {
title = [NSString stringWithUTF8String:name];
}
WailsMenu *result = [[WailsMenu new] initWithNSTitle:title];
return result;
}
void AppendSubmenu(void* inparent, void* inchild) {
WailsMenu *parent = (__bridge WailsMenu*) inparent;
WailsMenu *child = (__bridge WailsMenu*) inchild;
[parent appendSubmenu:child];
}
void SetAsApplicationMenu(void *inctx, void *inMenu) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
WailsMenu *menu = (__bridge WailsMenu*) inMenu;
ctx.applicationMenu = menu;
}
void UpdateApplicationMenu(void *inctx) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
ON_MAIN_THREAD(
NSApplication *app = [NSApplication sharedApplication];
[app setMainMenu:ctx.applicationMenu];
)
}
void SetAbout(void *inctx, const char* title, const char* description, void* imagedata, int datalen) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
NSString *_title = safeInit(title);
NSString *_description = safeInit(description);
[ctx SetAbout :_title :_description :imagedata :datalen];
}
void* AppendMenuItem(void* inctx, void* inMenu, const char* label, const char* shortcutKey, int modifiers, int disabled, int checked, int menuItemID) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
WailsMenu *menu = (__bridge WailsMenu*) inMenu;
NSString *_label = safeInit(label);
NSString *_shortcutKey = safeInit(shortcutKey);
return [menu AppendMenuItem:ctx :_label :_shortcutKey :modifiers :disabled :checked :menuItemID];
}
void UpdateMenuItem(void* nsmenuitem, int checked) {
ON_MAIN_THREAD(
WailsMenuItem *menuItem = (__bridge WailsMenuItem*) nsmenuitem;
[menuItem setState:(checked == 1?NSControlStateValueOn:NSControlStateValueOff)];
)
}
void AppendSeparator(void* inMenu) {
WailsMenu *menu = (__bridge WailsMenu*) inMenu;
[menu AppendSeparator];
}
void Run(void *inctx) {
WailsContext *ctx = (__bridge WailsContext*) inctx;
NSApplication *app = [NSApplication sharedApplication];
AppDelegate* delegate = [AppDelegate new];
[app setDelegate:(id)delegate];
ctx.appdelegate = delegate;
delegate.mainWindow = ctx.mainWindow;
delegate.alwaysOnTop = ctx.alwaysOnTop;
delegate.startHidden = ctx.startHidden;
delegate.startFullscreen = ctx.startFullscreen;
[ctx loadRequest:@"wails://wails/"];
[app setMainMenu:ctx.applicationMenu];
[app run];
[ctx release];
}

Some files were not shown because too many files have changed in this diff Show More