Compare commits

...

153 Commits

Author SHA1 Message Date
Lea Anthony
8d29d8a902 lint fix 2019-11-27 22:53:08 +11:00
Lea Anthony
d3b6040b6b initial release of wails console 2019-11-27 22:49:54 +11:00
Lea Anthony
51bd1c7bc0 Merge branch 'develop' into windows-console 2019-11-27 22:36:59 +11:00
Lea Anthony
806b1aa8e0 angular windows fixes (#298) 2019-11-27 22:35:14 +11:00
Lea Anthony
416bd7bfc4 Merge branch 'develop' of https://github.com/wailsapp/wails into develop 2019-11-27 22:22:38 +11:00
Lea Anthony
aca72d3f7a Hidpi fix (#297)
* Add global error handler for runtime

* Set DPI Aware on windows
2019-11-27 22:22:10 +11:00
Lea Anthony
ad20e2622b Add global error handler for runtime 2019-11-27 21:28:33 +11:00
Lea Anthony
859d8e0ebb require shift+ESC to toggle 2019-11-07 17:04:21 +11:00
Lea Anthony
daeda501f4 Merge branch 'master' into develop 2019-11-05 14:45:30 +11:00
lea
fb1e8647bc release v0.19.0 2019-11-05 14:43:37 +11:00
Lea Anthony
723236f348 chore: bump version 2019-11-04 04:06:47 +11:00
Lea Anthony
394a823d82 fix: remove unicode flag 2019-11-04 04:02:42 +11:00
Lea Anthony
241f10188b WIP 2019-11-03 09:52:06 +11:00
Lea Anthony
afe57802ad v0.18.15-pre 2019-11-02 21:07:02 +11:00
Lea Anthony
914642bd1d Backport (#283)
* Develop (#265)


* Patch for file dialog on OSX

* Update CONTRIBUTORS.md

* 262 add wails shutdown method (#264)

* feat: support close in bridge mode

* feat: WailsShutdown callback

Now handles proper shutdown through:
  * runtime.Window.Close()
  * Killing the main window
  * Ctrl-C

* chore: version bump

* chore: version bump

* feat: adjust binary name for OS

* fix: allow spaces in gcc path

* feat: migrate command

* fix: npm/node versions

* fix: allow IE for serve

* feat: go build script

* fix: make runtime ES2015 compliant

* fix: remove invoke patch

* fix: allow any line endings

* chore: remove legacy bridge files

* chore: latest assets
2019-11-02 21:06:02 +11:00
Lea Anthony
dafd9bcb24 fix: make binary name more os specific 2019-10-29 10:24:05 +11:00
Lea Anthony
7f75f27f6b fix: debug build should use terminal 2019-10-29 07:57:29 +11:00
Lea Anthony
d77fa1ee74 fix: npm/node version reporting 2019-10-26 05:36:00 +11:00
Lea Anthony
82e00ff83a hotfix: build issue for windows 2019-10-25 18:21:18 +11:00
Lea Anthony
14f91ab109 release v0.18.12-pre 2019-10-25 18:13:57 +11:00
Lea Anthony
19706a12a4 261 korean fonts (#276)
* fix: linting

* chore: bump version

* fix: unicode text for Windows

* fix: re-add webview_set_title
2019-10-25 18:12:56 +11:00
Lea Anthony
52e6091f0f release v0.18.11-pre 2019-10-25 17:39:12 +11:00
Lea Anthony
2db1624faf 274 support spaces in windows paths (#275)
* fix: escape windows commands

* fix: allow spaces in path to windres

* Update go.mod
2019-10-25 17:37:36 +11:00
Lea Anthony
f5d3fb0848 release v0.18.10-pre 2019-10-25 12:34:43 +11:00
Lea Anthony
85a64914aa 261 korean fonts (#273)
* fix: linting

* chore: bump version

* fix: unicode text for Windows
2019-10-25 12:33:29 +11:00
Lea Anthony
0819207e33 Bump version to v0.18.9-pre 2019-10-25 12:05:51 +11:00
Lea Anthony
50a0bc7701 fix: add flag to fix windows builds (#272) 2019-10-25 12:04:08 +11:00
Lea Anthony
c51f0cad6f chore: version bump 2019-10-24 16:13:42 +11:00
Lea Anthony
6795f6c678 Migrate tool (#270)
Experimental migration tool for projects < v1.0.0
2019-10-24 16:11:50 +11:00
Lea Anthony
315ef5f7ea fix: detect encoding on windows (#266)
* fix: linting

* chore: bump version
2019-10-24 16:04:32 +11:00
Lea Anthony
24530d9da4 fix: force install when node_modules missing (#268) 2019-10-24 09:36:42 +11:00
Lea Anthony
96fc70df26 Merge branch 'master' into develop 2019-10-23 14:07:22 +11:00
Lea Anthony
1c8d4c902a Merge branch 'develop' of github.com:wailsapp/wails into develop 2019-10-23 14:06:19 +11:00
Lea Anthony
08fc1d53d0 chore: version bump 2019-10-23 14:06:14 +11:00
Lea Anthony
6c5d5e40f4 262 add wails shutdown method (#264)
* feat: support close in bridge mode

* feat: WailsShutdown callback

Now handles proper shutdown through:
  * runtime.Window.Close()
  * Killing the main window
  * Ctrl-C
2019-10-23 14:04:41 +11:00
Lea Anthony
3f1dfe931c Update CONTRIBUTORS.md 2019-10-14 09:37:01 +11:00
Kris Raney
cb850c9653 Patch for file dialog on OSX (#258)
* Patch for file dialog on OSX
2019-10-14 09:34:50 +11:00
Lea Anthony
8d8f47363a chore: supress warnings 2019-10-12 20:19:05 +11:00
Lea Anthony
1b04b71254 fix: importing runtime (#254) 2019-10-09 19:33:13 +11:00
Lea Anthony
0b19ad1427 chore: version bump 2019-10-09 19:30:53 +11:00
Lea Anthony
9aca99911e Update CONTRIBUTORS.md 2019-10-09 04:47:00 +11:00
Robin Eklind
a7f61e335e cmd/wails: report error status code to OS (#252)
Fixes #251.
2019-10-09 04:44:32 +11:00
Lea Anthony
9fff0a513e chore: merge master 2019-10-08 06:30:22 +11:00
Lea Anthony
7fd5b77cbe chore: version bump 2019-10-08 06:06:02 +11:00
Lea Anthony
d2cac50f93 fix: update runtime 2019-10-07 22:16:29 +11:00
Lea Anthony
00f1f82520 Merge branch 'master' into develop 2019-10-07 21:35:52 +11:00
Lea Anthony
02fbb14e34 chore: version bump 2019-10-07 21:32:27 +11:00
Byron
f961659ada manjaro (#248)
* manjaro

* Update go.mod
2019-10-06 19:14:05 +11:00
Lea Anthony
93942111bc fix: multiple runtime fixes 2019-10-06 14:20:59 +11:00
Lea Anthony
dc5a68acce feat: add runtime typings 2019-10-06 13:36:20 +11:00
Lea Anthony
12ff0f8c97 fix: binding more than one struct method (#245) 2019-10-01 06:13:55 +10:00
Lea Anthony
c375c281ee chore: remove some debug output 2019-09-19 08:57:40 +10:00
Lea Anthony
7d86b0f7c4 chore: version bump 2019-09-14 05:56:52 +10:00
Byron
990f7dd06c feat: KDE neon support (#234) 2019-09-14 05:51:29 +10:00
Lea Anthony
0b6f256d55 docs: add Mattn 2019-09-10 06:34:40 +10:00
Byron
0a57fa4035 (FIX) 215 support distribution kali (#224)
* fix: kali support
2019-09-04 08:44:08 +10:00
Lea Anthony
af1a1a2498 chore: remove debug output 2019-09-03 19:36:21 +10:00
Lea Anthony
cc0617d247 chore: release v0.17.14-pre 2019-09-03 18:22:27 +10:00
Byron
99a3f87cef duplicate code spotted (#221)
* fix: duplicate code
2019-09-03 18:21:13 +10:00
Lea Anthony
1ccdb1bc4e fix: allow 0 return types 2019-09-01 15:52:35 +10:00
Byron
62b1967e45 215 support distribution kali (#219)
* test: azure pipeline

* fix: azure pipeline yaml

* feat: kali linux support

* feat: kali linux support
2019-08-30 23:21:54 +10:00
Lea Anthony
c10303e7c0 fix: upgrade eslint 2019-08-28 07:01:52 +10:00
Byron
4a61584827 Elementary support + readme update (#210)
* test: azure pipeline

* fix: azure pipeline yaml

* feat: elementary support+readme udpate
2019-08-28 06:19:48 +10:00
Lea Anthony
cf249ba836 chore: bump version 2019-08-26 17:58:20 +10:00
Byron
08fe7b64d6 Yaml bug (#207)
* test: azure pipeline

* fix: azure pipeline yaml

* feat: elementary support

* feat: opensuse support

* fix: 0_setup.go line 27

* fix: 0_setup.go line 27

* fix: opensuse yaml

* fix: opensuse yaml

* fix: opensuse yaml

* fix: opensuse yaml

* fix: opensuse yaml

* fix: opensuse yaml

* fix: yaml

* fix: yaml

* fix: yaml

* fix: opensuse yaml

* fix: opensuse

* fix: opensuse

* fix: opensuse

* fix: opensuse

* fix: string trim os osRelease field NAME

* fix: 0_setup.go if err typo

* test

* test

* fix: typo in linux.go

* test: remove quotes from opensuse case

* test: revert

* test: ""

* test: ""

* test: ""

* test: ""

* fix: replace trim with replace

* fix: drop 0_setup.go and run checks by system.go

* fix: elementary os yaml name

* fix: open suse yaml entry

* fix: commented out result.Release = version

* fix: commented out result.Release = version

* fix: revert Replace to Trim

* fix: Linux Mint yaml entry

* fix: capitalize distros entries

* fix: capitalize distros entries

* fix: capitalize distros entries

* test

* test

* fix: open suse yaml entry

* fix: yaml entris

* test

* test

* test

* test

* test

* test

* branch changing

* fix: bug in setup process

* debugging

* debugging

* debugging

* debugging

* fix: yaml entries & err == nil bug

* Update prerequisites.go

* fix: bug

* fix: 0_setup.go

* fix: yaml bug

* fix: yaml bug
2019-08-26 05:02:49 +10:00
Lea Anthony
77939ea414 Merge pull request #200 from Vaelatern/voidlinux-support
feat: VoidLinux support
2019-08-26 04:23:16 +10:00
Toyam Cox
468394d03c feat: VoidLinux support 2019-08-25 08:41:51 -04:00
Lea Anthony
dc87699a1e Merge pull request #205 from Vaelatern/undefined-webview
fix: undefined: webview during build
2019-08-25 19:44:53 +10:00
Toyam Cox
36e906507d fix: undefined: webview during build 2019-08-25 04:08:21 -04:00
Lea Anthony
a5f9688708 Merge branch 'develop' of github.com:wailsapp/wails into develop 2019-08-25 15:59:02 +10:00
Lea Anthony
880f900e51 Update contributors 2019-08-25 15:58:44 +10:00
Lea Anthony
349306cf73 chore: deduplicate library verificaation code (#203) 2019-08-25 15:56:42 +10:00
Toyam Cox
f140697857 chore: deduplicate library verificaation code 2019-08-25 00:14:39 -04:00
Lea Anthony
26ff8df7e5 chore: remove unused mewn file 2019-08-19 22:43:54 +10:00
Lea Anthony
b7dae216df Merge branch 'develop' of github.com:wailsapp/wails into develop 2019-08-19 22:23:32 +10:00
Byron
0b9d093d6c Azure Pipelines (#192)
* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* test: azure pipeline

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines

* feat: azure pipelines
2019-08-19 19:11:43 +10:00
Lea Anthony
7f282ad071 chore: add inprogress label 2019-08-19 09:01:44 +10:00
Lea Anthony
d6ed583e07 chore: add stale issue bot config 2019-08-19 08:56:58 +10:00
Lea Anthony
930cab2d9d chore: rename webview for clarity 2019-08-16 19:12:55 +10:00
Lea Anthony
ae41f33dcc chore: merge webview back in 2019-08-16 08:28:43 +10:00
Lea Anthony
5af6b7cafe chore: bump version 2019-08-10 10:50:25 +10:00
Lea Anthony
68ac3763d0 chore: update linux db 2019-08-10 10:43:09 +10:00
admin_3.exe
cdc66b556e 188 support distribution linux mint (#189) 2019-08-10 10:42:02 +10:00
admin_3.exe
3ff16322c2 182 linux bd (#183)
* fix: linuxdb.yaml entries

* fix: typo

* fix: yaml syntax error
2019-08-09 20:21:01 +10:00
Lea Anthony
d60066a0b1 chore: linter fixes (#185) 2019-08-09 08:12:50 +10:00
Lea Anthony
9d6ebf0fd4 Linux db (#182)
* feat: refactor linux distro detection

* linux db updates

* feat: add gccversioncommand + windows support

* fix: build-essential
2019-08-08 21:04:59 +10:00
Lea Anthony
839815e2fb chore: bump version 2019-08-05 18:40:34 +10:00
admin_3.exe
846fe479bf 179 parrot distributionsupport (#181)
* feat: parrot support && git push

* feat: parrot support

* feat: parrot support

* fix: arch support

* fix: gentoos support

* Update README.md

* Update README.md
2019-08-05 18:35:04 +10:00
Lea Anthony
62f7070e0c chore: hotfix version bump 2019-07-31 18:26:12 +10:00
Lea Anthony
dd418b36c2 Merge pull request #178 from bh90210/169-improve-wails-issue-linux-quick-fixes
169 improve wails issue linux quick fixes
2019-07-31 18:04:51 +10:00
bh90210
f4f04f2199 fix: typo 2019-07-31 03:20:08 +03:00
bh90210
3a7514bbdc fix: issue report 2019-07-31 02:54:59 +03:00
admin_3.exe
213f07fed4 Merge pull request #3 from wailsapp/develop
Develop
2019-07-31 01:48:54 +03:00
Lea Anthony
ed3ed8aa18 chore: hotfix 2019-07-31 06:57:56 +10:00
Lea Anthony
d038dca37c Merge pull request #177 from wailsapp/gitbash-fixes
fix: gitbash fixes
2019-07-31 06:55:40 +10:00
Lea Anthony
bb86d770a1 fix: gitbash fixes 2019-07-31 06:54:07 +10:00
Lea Anthony
33daa8621e chore: version bump 2019-07-31 06:21:00 +10:00
Lea Anthony
6c124fcff4 Merge pull request #175 from bh90210/174-wails-init-does-not-work-on-centos-7
fixed centos & fedora support
2019-07-31 06:17:42 +10:00
Lea Anthony
45833574b3 Merge branch 'bh90210-169-improve-wails-issue' into develop 2019-07-31 06:09:12 +10:00
Lea Anthony
5cb00eb481 trim gcc string 2019-07-31 06:08:43 +10:00
Lea Anthony
e2105331c1 Merge branch '169-improve-wails-issue' of git://github.com/bh90210/wails into bh90210-169-improve-wails-issue 2019-07-31 06:02:41 +10:00
bh90210
21d2383e63 Merge branch '169-improve-wails-issue' of github.com:bh90210/wails into 169-improve-wails-issue 2019-07-30 16:11:51 +03:00
bh90210
6c945a4eed fix: crashing typo 2019-07-30 16:11:18 +03:00
admin_3.exe
6c8d34dfd3 Delete npm-debug.log 2019-07-30 16:00:16 +03:00
bh90210
b9b42c059e feat: show gcc, node, npm version on issue report 2019-07-30 15:57:51 +03:00
bh90210
3f657b34cf darwin working 2019-07-30 02:12:51 +03:00
bh90210
6e81a36ada linux working 2019-07-30 02:02:01 +03:00
bh90210
ddec01a429 feat: gcc,npm,node versions on issues 2019-07-29 23:53:43 +03:00
bh90210
21fdb3be7d fix(linux): fedora & centos support 2019-07-29 19:12:05 +03:00
admin_3.exe
c1a13ab6d0 Merge pull request #2 from wailsapp/develop
Develop
2019-07-29 16:09:33 +03:00
Lea Anthony
750a02efc6 chore: version bump 2019-07-29 17:54:41 +10:00
Lea Anthony
5e047debfc fix: add support back for ubuntu, redhat 2019-07-29 17:52:22 +10:00
Lea Anthony
9cac336708 docs: updated contributors 2019-07-29 09:03:17 +10:00
Lea Anthony
827c2b9a95 Merge pull request #172 from Chronophylos/dont-use-lsb_release
Drop lsb_release
2019-07-29 09:01:41 +10:00
Chronophylos
b36a3c4abb fix assumption
Signed-off-by: Chronophylos <nikolai@chronophylos.com>
2019-07-28 13:39:03 +02:00
Chronophylos
0bac205565 show distro id when creating a issue
Signed-off-by: Chronophylos <nikolai@chronophylos.com>
2019-07-28 13:16:56 +02:00
Chronophylos
67a8ad8e12 change DistributionID to NAME=
Signed-off-by: Chronophylos <nikolai@chronophylos.com>
2019-07-28 00:44:46 +02:00
Chronophylos
9de2f66f50 drop lsb_release
Signed-off-by: Chronophylos <nikolai@chronophylos.com>
2019-07-27 21:26:11 +02:00
admin_3.exe
9370030ff3 Merge pull request #1 from wailsapp/develop
Develop
2019-07-27 22:12:15 +03:00
Lea Anthony
e38d6e7ef0 Merge pull request #165 from bt/master
Fix Masterminds/semver reference import path (case-sensitivity)
2019-07-22 18:33:54 +10:00
Bertram Truong
2f21fc3575 Fix Masterminds/semver reference import path (case-sensitivity) 2019-07-22 10:25:23 +10:00
Lea Anthony
63e73f5f64 chore: Version Bump 2019-07-20 19:40:43 +10:00
Lea Anthony
e1adc1ba49 Merge pull request #163 from wailsapp/more-runtime-refactor
More runtime refactor
2019-07-20 19:35:59 +10:00
Lea Anthony
030e911ea4 feat: significant overhaul of runtime 2019-07-20 19:32:30 +10:00
Lea Anthony
d2f114e44e Update contributors 2019-07-19 08:08:26 +10:00
Lea Anthony
700d3f84d3 Merge pull request #161 from fdidron/145-Fix-React-Error-Windows
145 fix react error windows
2019-07-19 00:32:20 +10:00
Florian Didron
1d49042013 style: replace double quotes with single quotes 2019-07-18 21:46:25 +09:00
Florian Didron
8671b1e6cf fix: add promises polyfill for the windows target 2019-07-18 21:10:42 +09:00
Lea Anthony
517d6c44ec fix: Print stdout on error :rolleyes: 2019-07-18 09:12:57 +10:00
Lea Anthony
a082a659ea fix: renamed global logger 2019-07-16 18:29:15 +10:00
Lea Anthony
083153efc9 fix: eslintrc config 2019-07-13 22:32:19 +10:00
Lea Anthony
65a2560153 chore: bump version 2019-07-13 22:30:32 +10:00
Lea Anthony
29535c10a3 Merge pull request #157 from wailsapp/runtime-refactor
Runtime refactor
2019-07-13 22:27:36 +10:00
Lea Anthony
24c7362163 Even more fixes 2019-07-13 22:18:42 +10:00
Lea Anthony
f6ff7d7b16 fix: linting for hound 2019-07-13 22:12:49 +10:00
Lea Anthony
b0a075cdf2 fix: more lint fixes 2019-07-13 22:10:43 +10:00
Lea Anthony
98d4d6b33c config: eslint 2019-07-13 15:42:57 +10:00
Lea Anthony
9ba3e0512b fix: linting 2019-07-13 15:35:50 +10:00
Lea Anthony
eff63175e5 fix: lint 2019-07-13 15:34:00 +10:00
Lea Anthony
75a0b632bc fix: capitalisation and binding fix 2019-07-13 15:30:52 +10:00
Lea Anthony
a2af626477 fix: config errors 2019-07-12 10:22:19 +10:00
Lea Anthony
8aa97f64ef feat: major refactor 2019-07-12 10:12:15 +10:00
Lea Anthony
caa1e04b5a Update README.md 2019-07-08 21:29:59 +10:00
Lea Anthony
cddf6a0204 chore: version bump 2019-07-07 10:28:58 +10:00
Lea Anthony
9fa1f42dc7 Merge pull request #155 from wailsapp/154-Support-Distribution-'Fedora'
feat: test support for Fedora
2019-07-07 10:28:19 +10:00
Lea Anthony
c7e709d487 feat: test support for Fedora 2019-07-07 10:25:59 +10:00
Lea Anthony
6801398f3d docs: update contributors 2019-07-07 10:17:44 +10:00
Lea Anthony
982d14c049 Merge pull request #152 from fallendusk/master
Add support for Gentoo
2019-07-07 10:16:21 +10:00
fallendusk
ddbaf55ae7 Merge branch 'develop' into master 2019-07-06 17:31:21 -04:00
Greg Helton
5552a8501b Add support for Gentoo 2019-07-06 01:43:02 -04:00
Lea Anthony
b997becb2f chore: bump version 2019-07-03 19:47:03 +10:00
Lea Anthony
753516bab7 Merge pull request #149 from wailsapp/148-Support-Distribution-'Zorin'
148 support distribution 'zorin'
2019-07-03 19:46:20 +10:00
Lea Anthony
89992d8636 feat: attempt to support Zorin 2019-07-03 19:42:32 +10:00
40 changed files with 993 additions and 124 deletions

View File

@@ -2,21 +2,22 @@
Wails is what it is because of the time and effort given by these great people. A huge thank you to each and every one!
* [Dustin Krysak](https://wiki.ubuntu.com/bashfulrobot)
* [Qais Patankar](https://github.com/qaisjp)
* [Anthony Lee](https://github.com/alee792)
* [Adrian Lanzafame](https://github.com/lanzafame)
* [Mattn](https://github.com/mattn)
* [0xflotus](https://github.com/0xflotus)
* [Michael D Henderson](https://github.com/mdhender)
* [fred2104](https://github.com/fishfishfish2104)
* [intelwalk](https://github.com/intelwalk)
* [Mark Stenglein](https://github.com/ocelotsloth)
* [admin_3.exe](https://github.com/bh90210)
* [iceleo-com](https://github.com/iceleo-com)
* [fallendusk](https://github.com/fallendusk)
* [Florian Didran](https://github.com/fdidron)
* [Nikolai Zimmermann](https://github.com/Chronophylos)
* [Toyam Cox](https://github.com/Vaelatern)
* [Robin Eklind](https://github.com/mewmew)
* [Kris Raney](https://github.com/kraney)
* [Dustin Krysak](https://wiki.ubuntu.com/bashfulrobot)
* [Qais Patankar](https://github.com/qaisjp)
* [Anthony Lee](https://github.com/alee792)
* [Adrian Lanzafame](https://github.com/lanzafame)
* [Mattn](https://github.com/mattn)
* [0xflotus](https://github.com/0xflotus)
* [Michael D Henderson](https://github.com/mdhender)
* [fred2104](https://github.com/fishfishfish2104)
* [intelwalk](https://github.com/intelwalk)
* [Mark Stenglein](https://github.com/ocelotsloth)
* [admin_3.exe](https://github.com/bh90210)
* [iceleo-com](https://github.com/iceleo-com)
* [fallendusk](https://github.com/fallendusk)
* [Florian Didran](https://github.com/fdidron)
* [Nikolai Zimmermann](https://github.com/Chronophylos)
* [Toyam Cox](https://github.com/Vaelatern)
* [Robin Eklind](https://github.com/mewmew)
* [Kris Raney](https://github.com/kraney)
* [Jack Mordaunt](https://github.com/JackMordaunt)

28
app.go
View File

@@ -1,7 +1,9 @@
package wails
import (
"fmt"
"os"
"runtime"
"syscall"
"github.com/syossan27/tebata"
@@ -43,7 +45,7 @@ func CreateApp(optionalConfig ...*AppConfig) *App {
}
result := &App{
logLevel: "info",
logLevel: "debug",
renderer: renderer.NewWebView(),
ipc: ipc.NewManager(),
bindingManager: binding.NewManager(),
@@ -65,9 +67,28 @@ func CreateApp(optionalConfig ...*AppConfig) *App {
result.config.DisableInspector = true
}
// If running windows, do a hidpi fix
if runtime.GOOS == "windows" {
err := SetProcessDPIAware()
if err != nil {
result.log.Fatalf(err.Error())
}
}
return result
}
// SetProcessDPIAware via user32.dll
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setprocessdpiaware
// Also, thanks Jack Mordaunt! https://github.com/wailsapp/wails/issues/293
func SetProcessDPIAware() error {
status, r, err := syscall.NewLazyDLL("user32.dll").NewProc("SetProcessDPIAware").Call()
if status == 0 {
return fmt.Errorf("exit status %d: %v %v", status, r, err)
}
return nil
}
// Run the app
func (a *App) Run() error {
@@ -102,6 +123,11 @@ func (a *App) start() error {
return err
}
// Enable console for Windows debug builds
if runtime.GOOS == "windows" && BuildMode == cmd.BuildModeDebug {
a.renderer.EnableConsole()
}
// Start signal handler
t := tebata.New(os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL)
t.Reserve(func() {

File diff suppressed because one or more lines are too long

View File

@@ -7,6 +7,7 @@ import (
"os/exec"
"path/filepath"
"runtime"
"strings"
"time"
"github.com/leaanthony/mewn"
@@ -87,6 +88,17 @@ func BuildApplication(binaryName string, forceRebuild bool, buildMode string, pa
buildCommand.Add("build")
if binaryName != "" {
// Alter binary name based on OS
switch runtime.GOOS {
case "windows":
if !strings.HasSuffix(binaryName, ".exe") {
binaryName += ".exe"
}
default:
if strings.HasSuffix(binaryName, ".exe") {
binaryName = strings.TrimSuffix(binaryName, ".exe")
}
}
buildCommand.Add("-o")
buildCommand.Add(binaryName)
}
@@ -103,7 +115,7 @@ func BuildApplication(binaryName string, forceRebuild bool, buildMode string, pa
}
// Add windows flags
if runtime.GOOS == "windows" {
if runtime.GOOS == "windows" && buildMode == BuildModeProd {
ldflags += "-H windowsgui "
}
@@ -219,6 +231,15 @@ func InstallFrontendDeps(projectDir string, projectOptions *ProjectOptions, forc
const md5sumFile = "package.json.md5"
// If node_modules does not exist, force a rebuild.
nodeModulesPath, err := filepath.Abs(filepath.Join(".", "node_modules"))
if err != nil {
return err
}
if !fs.DirExists(nodeModulesPath) {
forceRebuild = true
}
// If we aren't forcing the install and the md5sum file exists
if !forceRebuild && fs.FileExists(md5sumFile) {
// Yes - read contents

View File

@@ -191,8 +191,15 @@ func (b *PackageHelper) PackageWindows(po *ProjectOptions, cleanUp bool) error {
// Build syso
sysofile := filepath.Join(b.fs.Cwd(), basename+"-res.syso")
windresCommand := []string{"windres", "-o", sysofile, tgtRCFile}
err := NewProgramHelper().RunCommandArray(windresCommand)
batfile, err := fs.LocalDir(".")
if err != nil {
return err
}
windresBatFile := filepath.Join(batfile.fullPath, "windres.bat")
windresCommand := []string{windresBatFile, sysofile, tgtRCFile}
err = NewProgramHelper().RunCommandArray(windresCommand)
if err != nil {
return err
}

View File

@@ -100,6 +100,19 @@ func (p *ProgramHelper) InstallGoPackage(packageName string) error {
return err
}
// InstallNPMPackage installs the given npm package
func (p *ProgramHelper) InstallNPMPackage(packageName string, save bool) error {
args := strings.Split("install "+packageName, " ")
if save {
args = append(args, "--save")
}
_, stderr, err := p.shell.Run("npm", args...)
if err != nil {
fmt.Println(stderr)
}
return err
}
// RunCommand runs the given command
func (p *ProgramHelper) RunCommand(command string) error {
args := strings.Split(command, " ")
@@ -115,6 +128,7 @@ func (p *ProgramHelper) RunCommandArray(args []string, dir ...string) error {
fmt.Printf("ERROR: Looks like '%s' isn't installed. Please install and try again.", program)
return err
}
args = args[1:]
var stderr string
var stdout string

View File

@@ -13,6 +13,18 @@ import (
"github.com/leaanthony/slicer"
)
// PackageManager indicates different package managers
type PackageManager int
const (
// UNKNOWN package manager
UNKNOWN PackageManager = iota
// NPM package manager
NPM
// YARN package manager
YARN
)
type author struct {
Name string `json:"name"`
Email string `json:"email"`
@@ -153,6 +165,23 @@ func (po *ProjectOptions) Defaults() {
po.WailsVersion = Version
}
// GetNPMBinaryName returns the type of package manager used by the project
func (po *ProjectOptions) GetNPMBinaryName() (PackageManager, error) {
if po.FrontEnd == nil {
return UNKNOWN, fmt.Errorf("No frontend specified in project options")
}
if strings.Index(po.FrontEnd.Install, "npm") > -1 {
return NPM, nil
}
if strings.Index(po.FrontEnd.Install, "yarn") > -1 {
return YARN, nil
}
return UNKNOWN, nil
}
// PromptForInputs asks the user to input project details
func (po *ProjectOptions) PromptForInputs() error {

View File

@@ -9,4 +9,4 @@
last 2 versions
Firefox ESR
not dead
not IE 9-11 # For IE 9-11 support, remove 'not'.
IE 9-11 # For IE 9-11 support, remove 'not'.

View File

@@ -22,6 +22,7 @@
"@angular/platform-browser-dynamic": "~8.0.1",
"@angular/router": "~8.0.1",
"@wailsapp/runtime": "^1.0.0",
"core-js": "^3.4.4",
"ngx-build-plus": "^8.0.3",
"rxjs": "~6.4.0",
"tslib": "^1.9.0",

View File

@@ -1,3 +1,4 @@
import 'core-js/stable';
import { enableProdMode } from '@angular/core';
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';

View File

@@ -1,17 +0,0 @@
/*
Wails Bridge (c) 2019-present Lea Anthony
This prod version is to get around having to rewrite your code
for production. When doing a release build, this file will be used
instead of the full version.
*/
export default {
// The main function
// Passes the main Wails object to the callback if given.
Start: function(callback) {
if (callback) {
window.wails.events.on("wails:ready", callback);
}
}
};

View File

@@ -11,7 +11,7 @@
"module": "esnext",
"moduleResolution": "node",
"importHelpers": true,
"target": "es2015",
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
@@ -20,4 +20,4 @@
"dom"
]
}
}
}

View File

@@ -11,7 +11,7 @@ func basic() string {
func main() {
js := mewn.String("./frontend/dist/my-app/main-es2015.js")
js := mewn.String("./frontend/dist/my-app/main.js")
css := mewn.String("./frontend/dist/my-app/styles.css")
app := wails.CreateApp(&wails.AppConfig{

View File

@@ -1,17 +0,0 @@
/*
Wails Bridge (c) 2019-present Lea Anthony
This prod version is to get around having to rewrite your code
for production. When doing a release build, this file will be used
instead of the full version.
*/
export default {
// The main function
// Passes the main Wails object to the callback if given.
Start: function (callback) {
if (callback) {
window.wails.Events.On("wails:ready", callback);
}
}
};

View File

@@ -1,4 +1,4 @@
package cmd
// Version - Wails version
const Version = "v0.18.5"
const Version = "v0.19.0"

408
cmd/wails/15_migrate.go Normal file
View File

@@ -0,0 +1,408 @@
package main
import (
"bufio"
"fmt"
"io/ioutil"
"log"
"os"
"path/filepath"
"regexp"
"strings"
"github.com/Masterminds/semver"
"github.com/leaanthony/spinner"
"github.com/wailsapp/wails/cmd"
)
// Constants
var checkSpinner = spinner.NewSpinner()
var migrateProjectOptions = &cmd.ProjectOptions{}
var migrateFS = cmd.NewFSHelper()
var migrateGithub = cmd.NewGitHubHelper()
var programHelper = cmd.NewProgramHelper()
var lessThanV1 *semver.Constraints
// The user's go.mod
var goMod string
var goModFile string
// The user's main.js
var mainJSFile string
var mainJSContents string
// Frontend directory
var frontEndDir string
func init() {
var dryrun bool
var err error
lessThanV1, err = semver.NewConstraint("< v1.0.0")
if err != nil {
log.Fatal(err)
}
// var forceRebuild = false
checkSpinner.SetSpinSpeed(50)
commandDescription := `EXPERIMENTAL - This command attempts to migrate projects to the latest Wails version.`
updateCmd := app.Command("migrate", "Migrate projects to latest Wails release").
LongDescription(commandDescription).
BoolFlag("dryrun", "Only display what would be done", &dryrun)
updateCmd.Action(func() error {
message := "Migrate Project"
logger.PrintSmallBanner(message)
logger.Red("WARNING: This is an experimental command. Ensure you have backups of your project!")
logger.Red("It currently only supports npm based projects.")
fmt.Println()
// Check project directory
err := checkProjectDirectory()
if err != nil {
return err
}
// Find Wails version from go.mod
wailsVersion, err := getWailsVersion()
if err != nil {
return err
}
// Get latest stable version
var latestVersion *semver.Version
latestVersion, err = getLatestWailsVersion()
if err != nil {
return err
}
var canMigrate bool
canMigrate, err = canMigrateVersion(wailsVersion, latestVersion)
if err != nil {
return err
}
if !canMigrate {
return nil
}
// Check for wailsbridge
wailsBridge, err := checkWailsBridge()
if err != nil {
return err
}
// Is main.js using bridge.Init()
canUpdateMainJS, err := checkMainJS()
if err != nil {
return err
}
// TODO: Check if we are using legacy js runtime
// Operations
logger.Yellow("Operations to perform:")
logger.Yellowf(" - Update to Wails v%s\n", latestVersion)
if len(wailsBridge) > 0 {
logger.Yellow(" - Delete wailsbridge.js")
}
if canUpdateMainJS {
logger.Yellow(" - Patch main.js")
}
logger.Yellow(" - Ensure '@wailsapp/runtime` module is installed")
if dryrun {
logger.White("Exiting: Dry Run")
return nil
}
logger.Red("*WARNING* About to modify your project!")
logger.Red("Type 'YES' to continue: ")
scanner := bufio.NewScanner(os.Stdin)
scanner.Scan()
input := scanner.Text()
if input != "YES" {
logger.Red("ABORTED!")
return nil
}
logger.Yellow("Let's do this!")
err = updateWailsVersion(wailsVersion, latestVersion)
if err != nil {
return err
}
if len(wailsBridge) > 0 {
err = deleteWailsBridge(wailsBridge)
if err != nil {
return err
}
}
if canUpdateMainJS {
err = patchMainJS()
if err != nil {
return err
}
}
// Install runtime
err = installWailsRuntime()
if err != nil {
return err
}
fmt.Println()
logger.Yellow("Migration complete! Check project by running `wails build`.")
return nil
})
}
func checkProjectDirectory() error {
// Get versions
checkSpinner.Start("Check Project Directory")
// Check we are in project directory
err := migrateProjectOptions.LoadConfig(migrateFS.Cwd())
if err != nil {
checkSpinner.Error()
return fmt.Errorf("Unable to find 'project.json'. Please check you are in a Wails project directory")
}
checkSpinner.Success()
return nil
}
func getWailsVersion() (*semver.Version, error) {
checkSpinner.Start("Get Wails Version")
var result *semver.Version
// Load file
var err error
goModFile, err = filepath.Abs(filepath.Join(".", "go.mod"))
if err != nil {
checkSpinner.Error()
return nil, fmt.Errorf("Unable to load go.mod at %s", goModFile)
}
goMod, err = migrateFS.LoadAsString(goModFile)
if err != nil {
checkSpinner.Error()
return nil, fmt.Errorf("Unable to load go.mod")
}
// Find wails version
versionRegexp := regexp.MustCompile(`.*github.com/wailsapp/wails.*(v\d+.\d+.\d+)`)
versions := versionRegexp.FindStringSubmatch(goMod)
if len(versions) != 2 {
return nil, fmt.Errorf("Unable to determine Wails version")
}
version := versions[1]
result, err = semver.NewVersion(version)
if err != nil {
return nil, fmt.Errorf("Unable to parse Wails version: %s", version)
}
checkSpinner.Success("Found Wails Version: " + version)
return result, nil
}
func canMigrateVersion(wailsVersion *semver.Version, latestVersion *semver.Version) (bool, error) {
checkSpinner.Start("Checking ability to Migrate")
// Check if we are at the latest version!!!!
if wailsVersion.Equal(latestVersion) || wailsVersion.GreaterThan(latestVersion) {
checkSpinner.Errorf("Checking ability to Migrate: No! (v%s >= v%s)", wailsVersion, latestVersion)
return false, nil
}
// Check for < v1.0.0
if lessThanV1.Check(wailsVersion) {
checkSpinner.Successf("Checking ability to Migrate: Yes! (v%s < v1.0.0)", wailsVersion)
return true, nil
}
checkSpinner.Error("Unable to migrate")
return false, fmt.Errorf("No migration rules for version %s", wailsVersion)
}
func checkWailsBridge() (string, error) {
checkSpinner.Start("Checking if legacy Wails Bridge present")
// Check frontend dir is available
if migrateProjectOptions.FrontEnd == nil ||
len(migrateProjectOptions.FrontEnd.Dir) == 0 ||
!migrateFS.DirExists(migrateProjectOptions.FrontEnd.Dir) {
checkSpinner.Error("Unable to determine frontend directory")
return "", fmt.Errorf("Unable to determine frontend directory")
}
frontEndDir = migrateProjectOptions.FrontEnd.Dir
wailsBridgePath, err := filepath.Abs(filepath.Join(".", frontEndDir, "src", "wailsbridge.js"))
if err != nil {
checkSpinner.Error(err.Error())
return "", err
}
// If it doesn't exist, return blank string
if !migrateFS.FileExists(wailsBridgePath) {
checkSpinner.Success("Checking if legacy Wails Bridge present: No")
return "", nil
}
checkSpinner.Success("Checking if legacy Wails Bridge present: Yes")
return wailsBridgePath, nil
}
// This function determines if the main.js file using wailsbridge can be auto-updated
func checkMainJS() (bool, error) {
checkSpinner.Start("Checking if main.js can be migrated")
var err error
// Check main.js is there
if migrateProjectOptions.FrontEnd == nil ||
len(migrateProjectOptions.FrontEnd.Dir) == 0 ||
!migrateFS.DirExists(migrateProjectOptions.FrontEnd.Dir) {
checkSpinner.Error("Unable to determine frontend directory")
return false, fmt.Errorf("Unable to determine frontend directory")
}
frontEndDir = migrateProjectOptions.FrontEnd.Dir
mainJSFile, err = filepath.Abs(filepath.Join(".", frontEndDir, "src", "main.js"))
if err != nil {
checkSpinner.Error("Unable to find main.js")
return false, err
}
mainJSContents, err = migrateFS.LoadAsString(mainJSFile)
if err != nil {
checkSpinner.Error("Unable to load main.js")
return false, err
}
// Check we have a line like: import Bridge from "./wailsbridge";
if strings.Index(mainJSContents, `import Bridge from "./wailsbridge";`) == -1 {
checkSpinner.Success("Checking if main.js can be migrated: No - Cannot find `import Bridge`")
return false, nil
}
// Check we have a line like: Bridge.Start(() => {
if strings.Index(mainJSContents, `Bridge.Start(`) == -1 {
checkSpinner.Success("Checking if main.js can be migrated: No - Cannot find `Bridge.Start`")
return false, nil
}
checkSpinner.Success("Checking if main.js can be migrated: Yes")
return true, nil
}
func getLatestWailsVersion() (*semver.Version, error) {
checkSpinner.Start("Checking GitHub for latest Wails version")
version, err := migrateGithub.GetLatestStableRelease()
if err != nil {
checkSpinner.Error("Checking GitHub for latest Wails version: Failed")
return nil, err
}
checkSpinner.Successf("Checking GitHub for latest Wails version: v%s", version)
return version.Version, nil
}
func updateWailsVersion(currentVersion, latestVersion *semver.Version) error {
// Patch go.mod
checkSpinner.Start("Patching go.mod")
wailsModule := "github.com/wailsapp/wails"
old := fmt.Sprintf("%s v%s", wailsModule, currentVersion)
new := fmt.Sprintf("%s v%s", wailsModule, latestVersion)
goMod = strings.Replace(goMod, old, new, -1)
err := ioutil.WriteFile(goModFile, []byte(goMod), 0600)
if err != nil {
checkSpinner.Error()
return err
}
checkSpinner.Success()
return nil
}
func deleteWailsBridge(bridgeFilename string) error {
// Patch go.mod
checkSpinner.Start("Delete legacy wailsbridge.js")
err := migrateFS.RemoveFile(bridgeFilename)
if err != nil {
checkSpinner.Error()
return err
}
checkSpinner.Success()
return nil
}
func patchMainJS() error {
// Patch main.js
checkSpinner.Start("Patching main.js")
// Patch import line
oldImportLine := `import Bridge from "./wailsbridge";`
newImportLine := `import * as Wails from "@wailsapp/runtime";`
mainJSContents = strings.Replace(mainJSContents, oldImportLine, newImportLine, -1)
// Patch Start line
oldStartLine := `Bridge.Start`
newStartLine := `Wails.Init`
mainJSContents = strings.Replace(mainJSContents, oldStartLine, newStartLine, -1)
err := ioutil.WriteFile(mainJSFile, []byte(mainJSContents), 0600)
if err != nil {
checkSpinner.Error()
return err
}
checkSpinner.Success()
return nil
}
func installWailsRuntime() error {
checkSpinner.Start("Installing @wailsapp/runtime module")
// Change to the frontend directory
err := os.Chdir(frontEndDir)
if err != nil {
checkSpinner.Error()
return nil
}
// Determine package manager
packageManager, err := migrateProjectOptions.GetNPMBinaryName()
if err != nil {
checkSpinner.Error()
return nil
}
switch packageManager {
case cmd.NPM:
// npm install --save @wailsapp/runtime
programHelper.InstallNPMPackage("@wailsapp/runtime", true)
default:
checkSpinner.Error()
return fmt.Errorf("Unknown package manager")
}
checkSpinner.Success()
return nil
}

View File

@@ -80,15 +80,16 @@ To help you in this process, we will ask for some information, add Go/Wails deta
npm := program.FindProgram("npm")
if npm != nil {
stdout, _, _, _ := npm.Run("--version")
nodeVersion = stdout
nodeVersion = nodeVersion[:len(nodeVersion)-1]
npmVersion = stdout
npmVersion = npmVersion[:len(npmVersion)-1]
npmVersion = strings.TrimSpace(npmVersion)
}
node := program.FindProgram("node")
if node != nil {
stdout, _, _, _ := node.Run("--version")
npmVersion = stdout
npmVersion = npmVersion[:len(npmVersion)-1]
nodeVersion = stdout
nodeVersion = nodeVersion[:len(nodeVersion)-1]
}
str.WriteString("\n| Name | Value |\n| ----- | ----- |\n")

1
cmd/windres.bat Normal file
View File

@@ -0,0 +1 @@
windres.exe -o %1 %2

View File

@@ -1,6 +1,9 @@
package wails
import "github.com/leaanthony/mewn"
import (
"github.com/leaanthony/mewn"
"github.com/wailsapp/wails/runtime"
)
// AppConfig is the configuration structure used when creating a Wails App object
type AppConfig struct {
@@ -65,7 +68,7 @@ func (a *AppConfig) merge(in *AppConfig) error {
a.CSS = in.CSS
}
if in.Title != "" {
a.Title = in.Title
a.Title = runtime.ProcessEncoding(in.Title)
}
if in.Colour != "" {

2
go.mod
View File

@@ -2,6 +2,7 @@ module github.com/wailsapp/wails
require (
github.com/Masterminds/semver v1.4.2
github.com/abadojack/whatlanggo v1.0.1
github.com/dchest/cssmin v0.0.0-20151210170030-fb8d9b44afdc // indirect
github.com/dchest/htmlmin v0.0.0-20150526090704-e254725e81ac
github.com/dchest/jsmin v0.0.0-20160823214000-faeced883947 // indirect
@@ -26,6 +27,7 @@ require (
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529 // indirect
golang.org/x/net v0.0.0-20190509222800-a4d6f7feada5 // indirect
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862
golang.org/x/text v0.3.0
gopkg.in/AlecAivazis/survey.v1 v1.8.4
gopkg.in/yaml.v3 v3.0.0-20190709130402-674ba3eaed22
)

3
go.sum
View File

@@ -2,6 +2,8 @@ github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITg
github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw=
github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8/go.mod h1:oX5x61PbNXchhh0oikYAH+4Pcfw5LKv21+Jnpr6r6Pc=
github.com/abadojack/whatlanggo v1.0.1 h1:19N6YogDnf71CTHm3Mp2qhYfkRdyvbgwWdd2EPxJRG4=
github.com/abadojack/whatlanggo v1.0.1/go.mod h1:66WiQbSbJBIlOZMsvbKe5m6pzQovxCH9B/K8tQB2uoc=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -85,6 +87,7 @@ golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5h
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862 h1:rM0ROo5vb9AdYJi1110yjWGMej9ITfKddS89P3Fkhug=
golang.org/x/sys v0.0.0-20190509141414-a5b02f93d862/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
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=
gopkg.in/AlecAivazis/survey.v1 v1.8.4/go.mod h1:iBNOmqKz/NUbZx3bA+4hAGLRC7fSK7tgtVDT4tB22XA=

View File

@@ -3,10 +3,12 @@ package interfaces
import (
"github.com/wailsapp/wails/lib/messages"
)
// Renderer is an interface describing a Wails target to render the app to
type Renderer interface {
Initialise(AppConfig, IPCManager, EventManager) error
Run() error
EnableConsole()
// Binding
NewBinding(bindingName string) error

View File

@@ -74,6 +74,10 @@ func (h *Bridge) evalJS(js string, mtype messageType) error {
return nil
}
// EnableConsole not needed for bridge!
func (h *Bridge) EnableConsole() {
}
func (h *Bridge) injectCSS(css string) {
// Minify css to overcome issues in the browser with carriage returns
minified, err := htmlmin.Minify([]byte(css), &htmlmin.Options{

File diff suppressed because one or more lines are too long

View File

@@ -19,12 +19,13 @@ import (
// WebView defines the main webview application window
// Default values in []
type WebView struct {
window wv.WebView // The webview object
ipc interfaces.IPCManager
log *logger.CustomLogger
config interfaces.AppConfig
eventManager interfaces.EventManager
bindingCache []string
window wv.WebView // The webview object
ipc interfaces.IPCManager
log *logger.CustomLogger
config interfaces.AppConfig
eventManager interfaces.EventManager
bindingCache []string
enableConsole bool
}
// NewWebView returns a new WebView struct
@@ -103,6 +104,11 @@ func (w *WebView) evalJS(js string) error {
return nil
}
// EnableConsole enables the console!
func (w *WebView) EnableConsole() {
w.enableConsole = true
}
// Escape the Javascripts!
func escapeJS(js string) (string, error) {
result := strings.Replace(js, "\\", "\\\\", -1)
@@ -172,6 +178,13 @@ func (w *WebView) Run() error {
w.log.Info("Running...")
// Inject firebug in debug mode on Windows
if w.enableConsole {
w.log.Debug("Enabling Wails console")
console := mewn.String("../../runtime/assets/console.js")
w.evalJS(console)
}
// Runtime assets
wailsRuntime := mewn.String("../../runtime/assets/wails.js")
w.evalJS(wailsRuntime)

View File

@@ -1,6 +1,5 @@
// Package wails implements Go bindings to https://github.com/zserge/webview C library.
// Package webview implements Go bindings to https://github.com/zserge/webview C library.
// It is a modified version of webview.go from that repository
// Bindings closely repeat the C APIs and include both, a simplified
// single-function API to just open a full-screen webview window, and a more
// advanced and featureful set of APIs, including Go-to-JavaScript bindings.
@@ -14,7 +13,7 @@ package webview
#cgo linux openbsd freebsd CFLAGS: -DWEBVIEW_GTK=1 -Wno-deprecated-declarations
#cgo linux openbsd freebsd pkg-config: gtk+-3.0 webkit2gtk-4.0
#cgo windows CFLAGS: -DWEBVIEW_WINAPI=1
#cgo windows CFLAGS: -DWEBVIEW_WINAPI=1 -std=c99
#cgo windows LDFLAGS: -lole32 -lcomctl32 -loleaut32 -luuid -lgdi32
#cgo darwin CFLAGS: -DWEBVIEW_COCOA=1 -x objective-c

View File

@@ -1038,7 +1038,7 @@ struct webview_priv
return S_FALSE;
}
static const TCHAR *classname = "WebView";
static const TCHAR *classname = TEXT("WebView");
static const SAFEARRAYBOUND ArrayBound = {1, 0};
static IOleClientSiteVtbl MyIOleClientSiteTable = {
@@ -1227,7 +1227,7 @@ struct webview_priv
}
VariantInit(&myURL);
myURL.vt = VT_BSTR;
#ifndef UNICODE
// #ifndef UNICODE
{
wchar_t *buffer = webview_to_utf16(webPageName);
if (buffer == NULL)
@@ -1237,9 +1237,9 @@ struct webview_priv
myURL.bstrVal = SysAllocString(buffer);
GlobalFree(buffer);
}
#else
myURL.bstrVal = SysAllocString(webPageName);
#endif
// #else
// myURL.bstrVal = SysAllocString(webPageName);
// #endif
if (!myURL.bstrVal)
{
badalloc:
@@ -1277,7 +1277,7 @@ struct webview_priv
if (!SafeArrayAccessData(sfArray, (void **)&pVar))
{
pVar->vt = VT_BSTR;
#ifndef UNICODE
// #ifndef UNICODE
{
wchar_t *buffer = webview_to_utf16(url);
if (buffer == NULL)
@@ -1287,9 +1287,9 @@ struct webview_priv
bstr = SysAllocString(buffer);
GlobalFree(buffer);
}
#else
bstr = SysAllocString(string);
#endif
// #else
// bstr = SysAllocString(url);
// #endif
if ((pVar->bstrVal = bstr))
{
htmlDoc2->lpVtbl->write(htmlDoc2, sfArray);
@@ -1404,6 +1404,7 @@ struct webview_priv
{
return -1;
}
ZeroMemory(&wc, sizeof(WNDCLASSEX));
wc.cbSize = sizeof(WNDCLASSEX);
wc.hInstance = hInstance;
@@ -1431,10 +1432,24 @@ struct webview_priv
rect.bottom = rect.bottom - rect.top + top;
rect.top = top;
#ifdef UNICODE
wchar_t *u16title = webview_to_utf16(w->title);
if (u16title == NULL)
{
return -1;
}
w->priv.hwnd =
CreateWindowEx(0, classname, u16title, style, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top,
HWND_DESKTOP, NULL, hInstance, (void *)w);
#else
w->priv.hwnd =
CreateWindowEx(0, classname, w->title, style, rect.left, rect.top,
rect.right - rect.left, rect.bottom - rect.top,
HWND_DESKTOP, NULL, hInstance, (void *)w);
#endif
if (w->priv.hwnd == 0)
{
OleUninitialize();
@@ -1445,7 +1460,14 @@ struct webview_priv
DisplayHTMLPage(w);
#ifdef UNICODE
SetWindowText(w->priv.hwnd, u16title);
GlobalFree(u16title);
#else
SetWindowText(w->priv.hwnd, w->title);
#endif
ShowWindow(w->priv.hwnd, SW_SHOWDEFAULT);
UpdateWindow(w->priv.hwnd);
SetFocus(w->priv.hwnd);
@@ -1581,9 +1603,20 @@ struct webview_priv
WEBVIEW_API void webview_set_title(struct webview *w, const char *title)
{
#ifdef UNICODE
wchar_t *u16title = webview_to_utf16(title);
if (u16title == NULL)
{
return;
}
SetWindowText(w->priv.hwnd, u16title);
GlobalFree(u16title);
#else
SetWindowText(w->priv.hwnd, title);
#endif
}
WEBVIEW_API void webview_set_fullscreen(struct webview *w, int fullscreen)
{
if (w->priv.is_fullscreen == !!fullscreen)

View File

@@ -95,13 +95,6 @@ function startBridge() {
window.wailsbridge.reconnectOverlay.style.display = 'none';
}
// Bridge external.invoke
window.external = {
invoke: function (msg) {
window.wailsbridge.websocket.send(msg);
}
};
// Adds a script to the Dom.
// Removes it if second parameter is true.
function addScript(script, remove) {
@@ -214,4 +207,4 @@ function Init(callback) {
start(callback);
}
module.exports = Init;
module.exports = Init;

175
runtime/assets/console.js Normal file
View File

@@ -0,0 +1,175 @@
(function () {
window.wailsconsole = {};
var debugconsole = document.createElement("div");
var header = document.createElement("div");
var consoleOut = document.createElement("div");
document.addEventListener('keyup', logKey);
debugconsole.id = "wailsdebug";
debugconsole.style.fontSize = "18px";
debugconsole.style.width = "100%";
debugconsole.style.height = "35%";
debugconsole.style.maxHeight = "35%";
debugconsole.style.position = "fixed";
debugconsole.style.left = "0px";
debugconsole.style.backgroundColor = "rgba(255,255,255,0.8)";
debugconsole.style.borderTop = '1px solid black';
debugconsole.style.color = "black";
debugconsole.style.display = "none";
header.style.width = "100%";
header.style.height = "30px";
header.style.display = "block";
// header.style.paddingTop = "3px";
header.style.verticalAlign = "middle";
header.style.paddingLeft = "10px";
header.style.background = "rgba(255,255,255,0.8)";
header.innerHTML = " <span style='vertical-align: middle'> Wails Console > <input id='conin' style='border: solid 1px black; width: 50%'></input><span style='padding-left: 5px; cursor:pointer;' onclick='window.wailsconsole.clearConsole()'>Clear</span></span>";
consoleOut.style.position = "absolute";
consoleOut.style.width = "100%";
consoleOut.style.height = "auto";
consoleOut.style.top = "30px";
// consoleOut.style.paddingLeft = "10px";
consoleOut.style.bottom = "0px";
consoleOut.style.backgroundColor = "rgba(200,200,200,1)";
consoleOut.style.overflowY = "scroll";
consoleOut.style.msOverflowStyle = "-ms-autohiding-scrollbar";
debugconsole.appendChild(header);
debugconsole.appendChild(consoleOut);
document.body.appendChild(debugconsole);
console.log(debugconsole.style.display)
function logKey(e) {
var conin = document.getElementById('conin');
if (e.which == 27 && e.shiftKey) {
toggleConsole(conin);
}
if (e.which == 13 && consoleVisible()) {
var command = conin.value.trim();
if (command.length > 0) {
console.log("> " + command)
try {
evaluateInput(command);
} catch (e) {
console.error(e.message);
}
conin.value = "";
}
}
};
function consoleVisible() {
return debugconsole.style.display == "block";
}
function toggleConsole(conin) {
var display = "none"
if (debugconsole.style.display == "none") display = "block";
debugconsole.style.display = display;
if (display == "block") {
conin.focus();
}
}
function evaluateExpression(expression) {
var pathSegments = [].concat(expression.split('.'));
if (pathSegments[0] == 'window') {
pathSegments.shift()
}
var currentObject = window;
for (var i = 0; i < pathSegments.length; i++) {
var pathSegment = pathSegments[i];
if (currentObject[pathSegment] == undefined) {
return false;
}
currentObject = currentObject[pathSegment];
}
console.log(JSON.stringify(currentObject));
return true;
}
function evaluateInput(command) {
try {
if (evaluateExpression(command)) {
return
} else {
eval(command);
}
} catch (e) {
console.error(e.message)
}
}
// Set us up as a listener
function hookIntoIPC() {
if (window.wails && window.wails._ && window.wails._.AddIPCListener) {
window.wails._.AddIPCListener(processIPCMessage);
} else {
setTimeout(hookIntoIPC, 100);
}
}
hookIntoIPC();
function processIPCMessage(message) {
console.log(message);
var parsedMessage;
try {
parsedMessage = JSON.parse(message);
} catch (e) {
console.error("Error in parsing IPC message: " + e.message);
return false;
}
var logmessage = "[IPC] "
switch (parsedMessage.type) {
case 'call':
logmessage += " Call: " + parsedMessage.payload.bindingName;
var params = "";
var parsedParams = JSON.parse(parsedMessage.payload.data);
if (parsedParams.length > 0) {
params = parsedParams;
}
logmessage += "(" + params + ")";
break;
case 'log':
logmessage += "Log (" + parsedMessage.payload.level + "): " + parsedMessage.payload.message;
break;
default:
logmessage = message;
}
console.log(logmessage);
}
window.wailsconsole.clearConsole = function () {
consoleOut.innerHTML = "";
}
console.log = function (message) {
consoleOut.innerHTML = consoleOut.innerHTML + "<span style='padding-left: 5px'>" + message + '</span><br/>';
consoleOut.scrollTop = consoleOut.scrollHeight;
};
console.error = function (message) {
consoleOut.innerHTML = consoleOut.innerHTML + "<span style='color:red; padding-left: 5px'> Error: " + message + '</span><br/>';
consoleOut.scrollTop = consoleOut.scrollHeight;
};
// var h = document.getElementsByTagName("html")[0];
// console.log("html margin: " + h.style.marginLeft);
// console.log("html padding: " + h.style.paddingLeft);
// setInterval(function() { console.log("test");}, 1000);
// setInterval(function() { console.error("oops");}, 3000);
// var script = document.createElement('script');
// script.src = "https://cdnjs.cloudflare.com/ajax/libs/firebug-lite/1.4.0/firebug-lite.js#startOpened=true";
// document.body.appendChild(script);
})();

File diff suppressed because one or more lines are too long

View File

@@ -15,10 +15,7 @@
"error",
"tab"
],
"linebreak-style": [
"error",
"unix"
],
"linebreak-style": 0,
"quotes": [
"error",
"single"
@@ -28,4 +25,4 @@
"always"
]
}
}
}

View File

@@ -9,13 +9,35 @@ The lightweight framework for web-like apps
*/
/* jshint esversion: 6 */
// IPC Listeners
var listeners = [];
/**
* Adds a listener to IPC messages
* @param {function} callback
*/
export function AddIPCListener(callback) {
listeners.push(callback);
}
/**
* Invoke sends the given message to the backend
*
* @param {string} message
*/
function Invoke(message) {
window.external.invoke(message);
if (window.wailsbridge) {
window.wailsbridge.websocket.send(message);
} else {
window.external.invoke(message);
}
// Also send to listeners
if (listeners.length > 0) {
for (var i = 0; i < listeners.length; i++) {
listeners[i](message);
}
}
}
/**

View File

@@ -14,6 +14,7 @@ import { On, OnMultiple, Emit, Notify, Heartbeat, Acknowledge } from './events';
import { NewBinding } from './bindings';
import { Callback } from './calls';
import { AddScript, InjectCSS } from './utils';
import { AddIPCListener } from './ipc';
// Initialise global if not already
window.wails = window.wails || {};
@@ -27,6 +28,7 @@ var internal = {
AddScript,
InjectCSS,
Init,
AddIPCListener,
};
// Setup runtime structure
@@ -46,6 +48,16 @@ var runtime = {
// Augment global
Object.assign(window.wails, runtime);
// Setup global error handler
window.onerror = function (msg, url, lineNo, columnNo, error) {
window.wails.Log.Error('**** Caught Unhandled Error ****');
window.wails.Log.Error('Message: ' + msg);
window.wails.Log.Error('URL: ' + url);
window.wails.Log.Error('Line No: ' + lineNo);
window.wails.Log.Error('Column No: ' + columnNo);
window.wails.Log.Error('error: ' + error);
};
// Emit loaded event
Emit('wails:loaded');

View File

@@ -32,6 +32,6 @@ function OpenFile(filename) {
}
module.exports = {
OpenURL,
OpenFile
OpenURL: OpenURL,
OpenFile: OpenFile
};

View File

@@ -80,10 +80,10 @@ function Acknowledge(eventName) {
}
module.exports = {
OnMultiple,
On,
Once,
Emit,
Heartbeat,
Acknowledge
OnMultiple: OnMultiple,
On: On,
Once: Once,
Emit: Emit,
Heartbeat: Heartbeat,
Acknowledge: Acknowledge
};

View File

@@ -62,9 +62,9 @@ function Fatal(message) {
}
module.exports = {
Debug,
Info,
Warning,
Error,
Fatal
Debug: Debug,
Info: Info,
Warning: Warning,
Error: Error,
Fatal: Fatal
};

View File

@@ -15,8 +15,8 @@ const Events = require('./events');
const Init = require('./init');
module.exports = {
Log,
Browser,
Events,
Init
Log: Log,
Browser: Browser,
Events: Events,
Init: Init
};

View File

@@ -1,6 +1,6 @@
{
"name": "@wailsapp/runtime",
"version": "1.0.6",
"version": "1.0.9",
"description": "Wails Javascript runtime library",
"main": "main.js",
"types": "runtime.d.ts",

View File

@@ -1,6 +1,54 @@
package runtime
import "github.com/wailsapp/wails/lib/interfaces"
import (
"bytes"
"runtime"
"github.com/abadojack/whatlanggo"
"github.com/wailsapp/wails/lib/interfaces"
"golang.org/x/text/encoding"
"golang.org/x/text/encoding/japanese"
"golang.org/x/text/encoding/korean"
"golang.org/x/text/encoding/simplifiedchinese"
"golang.org/x/text/transform"
)
func detectEncoding(text string) (encoding.Encoding, string) {
// korean
var enc encoding.Encoding
info := whatlanggo.Detect(text)
//fmt.Println("Language:", info.Lang.String(), " Script:", whatlanggo.Scripts[info.Script], " Confidence: ", info.Confidence)
switch info.Lang.String() {
case "Korean":
enc = korean.EUCKR
case "Mandarin":
enc = simplifiedchinese.GBK
case "Japanese":
enc = japanese.EUCJP
}
return enc, info.Lang.String()
}
// ProcessEncoding attempts to convert CKJ strings to UTF-8
func ProcessEncoding(text string) string {
if runtime.GOOS != "windows" {
return text
}
encoding, _ := detectEncoding(text)
if encoding != nil {
var bufs bytes.Buffer
wr := transform.NewWriter(&bufs, encoding.NewEncoder())
_, err := wr.Write([]byte(text))
defer wr.Close()
if err != nil {
return ""
}
return bufs.String()
}
return text
}
// Window exposes an interface for manipulating the window
type Window struct {
@@ -31,6 +79,7 @@ func (r *Window) UnFullscreen() {
// SetTitle sets the the window title
func (r *Window) SetTitle(title string) {
title = ProcessEncoding(title)
r.renderer.SetTitle(title)
}

85
scripts/build.go Normal file
View File

@@ -0,0 +1,85 @@
package main
import (
"fmt"
"log"
"os"
"os/exec"
"path/filepath"
)
// Default target to run when none is specified
// If not set, running mage will list available targets
// var Default = Build
/*
# Build runtime
echo "**** Building Runtime ****"
cd runtime/js
npm install
npm run build
cd ../..
echo "**** Packing Assets ****"
cd cmd
mewn
cd ..
cd lib/renderer
mewn
cd ../..
echo "**** Installing Wails locally ****"
cd cmd/wails
go install
cd ../..
echo "**** Tidying the mods! ****"
go mod tidy
echo "**** WE ARE DONE! ****"
*/
func runCommand(command string, args ...string) {
cmd := exec.Command(command, args...)
output, err := cmd.CombinedOutput()
fmt.Println(string(output))
if err != nil {
log.Println(string(output))
log.Fatal(err)
}
cmd.Run()
fmt.Println(string(output))
}
// A build step that requires additional params, or platform specific steps for example
func main() {
dir, _ := os.Getwd()
// Build Runtime
fmt.Println("**** Building Runtime ****")
runtimeDir, _ := filepath.Abs(filepath.Join(dir, "..", "runtime", "js"))
os.Chdir(runtimeDir)
runCommand("npm", "install")
runCommand("npm", "run", "build")
// Pack assets
fmt.Println("**** Packing Assets ****")
rendererDir, _ := filepath.Abs(filepath.Join(dir, "..", "lib", "renderer"))
os.Chdir(rendererDir)
runCommand("mewn")
cmdDir, _ := filepath.Abs(filepath.Join(dir, "..", "cmd"))
os.Chdir(cmdDir)
runCommand("mewn")
// Install Wails
fmt.Println("**** Installing Wails locally ****")
execDir, _ := filepath.Abs(filepath.Join(dir, "..", "cmd", "wails"))
os.Chdir(execDir)
runCommand("go", "install")
baseDir, _ := filepath.Abs(filepath.Join(dir, ".."))
os.Chdir(baseDir)
runCommand("go", "mod", "tidy")
}