mirror of
https://github.com/taigrr/wails.git
synced 2026-04-13 10:28:13 -07:00
Compare commits
25 Commits
angular-fi
...
v1.0.2-pre
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e1e8b1513 | ||
|
|
dd49292b68 | ||
|
|
af30e5e6ba | ||
|
|
558cc9681c | ||
|
|
62f6bece57 | ||
|
|
084d412d86 | ||
|
|
788d22740b | ||
|
|
34ef3de737 | ||
|
|
8149cbc3c0 | ||
|
|
2032ef8225 | ||
|
|
38e897f646 | ||
|
|
de2f9a1e9e | ||
|
|
c506c95506 | ||
|
|
955cfbb689 | ||
|
|
aa698b993d | ||
|
|
a6fa5feb0c | ||
|
|
67a52b2a57 | ||
|
|
99d22fdcb7 | ||
|
|
7051ffd425 | ||
|
|
bac823566c | ||
|
|
401ebee719 | ||
|
|
b5b92c4afa | ||
|
|
2c2aee2d30 | ||
|
|
806b1aa8e0 | ||
|
|
94c56115a5 |
@@ -2,21 +2,24 @@
|
|||||||
|
|
||||||
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!
|
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)
|
* [Dustin Krysak](https://wiki.ubuntu.com/bashfulrobot)
|
||||||
* [Qais Patankar](https://github.com/qaisjp)
|
* [Qais Patankar](https://github.com/qaisjp)
|
||||||
* [Anthony Lee](https://github.com/alee792)
|
* [Anthony Lee](https://github.com/alee792)
|
||||||
* [Adrian Lanzafame](https://github.com/lanzafame)
|
* [Adrian Lanzafame](https://github.com/lanzafame)
|
||||||
* [Mattn](https://github.com/mattn)
|
* [Mattn](https://github.com/mattn)
|
||||||
* [0xflotus](https://github.com/0xflotus)
|
* [0xflotus](https://github.com/0xflotus)
|
||||||
* [Michael D Henderson](https://github.com/mdhender)
|
* [Michael D Henderson](https://github.com/mdhender)
|
||||||
* [fred2104](https://github.com/fishfishfish2104)
|
* [fred2104](https://github.com/fishfishfish2104)
|
||||||
* [intelwalk](https://github.com/intelwalk)
|
* [intelwalk](https://github.com/intelwalk)
|
||||||
* [Mark Stenglein](https://github.com/ocelotsloth)
|
* [Mark Stenglein](https://github.com/ocelotsloth)
|
||||||
* [admin_3.exe](https://github.com/bh90210)
|
* [admin_3.exe](https://github.com/bh90210)
|
||||||
* [iceleo-com](https://github.com/iceleo-com)
|
* [iceleo-com](https://github.com/iceleo-com)
|
||||||
* [fallendusk](https://github.com/fallendusk)
|
* [fallendusk](https://github.com/fallendusk)
|
||||||
* [Florian Didran](https://github.com/fdidron)
|
* [Florian Didran](https://github.com/fdidron)
|
||||||
* [Nikolai Zimmermann](https://github.com/Chronophylos)
|
* [Nikolai Zimmermann](https://github.com/Chronophylos)
|
||||||
* [Toyam Cox](https://github.com/Vaelatern)
|
* [Toyam Cox](https://github.com/Vaelatern)
|
||||||
* [Robin Eklind](https://github.com/mewmew)
|
* [Robin Eklind](https://github.com/mewmew)
|
||||||
* [Kris Raney](https://github.com/kraney)
|
* [Kris Raney](https://github.com/kraney)
|
||||||
|
* [Jack Mordaunt](https://github.com/JackMordaunt)
|
||||||
|
* [Michael Hipp](https://github.com/MichaelHipp)
|
||||||
|
* [Travis McLane](https://github.com/tmclane)
|
||||||
12
README.md
12
README.md
@@ -1,5 +1,5 @@
|
|||||||
<p align="center" style="text-align: center">
|
<p align="center" style="text-align: center">
|
||||||
<img src="https://github.com/wailsapp/docs/raw/master/.vuepress/public/media/logo_cropped.png" width="40%"><br/>
|
<img src="logo_cropped.png" width="40%"><br/>
|
||||||
</p>
|
</p>
|
||||||
<p align="center">
|
<p align="center">
|
||||||
A framework for building desktop applications using Go & Web Technologies.<br/><br/>
|
A framework for building desktop applications using Go & Web Technologies.<br/><br/>
|
||||||
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
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!
|
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!
|
||||||
|
|
||||||
|
The official docs can be found at [https://wails.app](https://wails.app).
|
||||||
|
|
||||||
## Features
|
## Features
|
||||||
|
|
||||||
- Use standard Go libraries/frameworks for the backend
|
- Use standard Go libraries/frameworks for the backend
|
||||||
@@ -28,9 +30,6 @@ The traditional method of providing web interfaces to Go programs is via a built
|
|||||||
- Powerful cli tool
|
- Powerful cli tool
|
||||||
- Multiplatform
|
- Multiplatform
|
||||||
|
|
||||||
## Project Status
|
|
||||||
|
|
||||||
Wails is currently in Beta. Please make sure you read the [Project Status](https://wails.app/project_status.html) if you are interested in using this project.
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
@@ -94,7 +93,7 @@ Windows requires gcc and related tooling. The recommended download is from [http
|
|||||||
Installation is as simple as running the following command:
|
Installation is as simple as running the following command:
|
||||||
|
|
||||||
<pre style='color:white'>
|
<pre style='color:white'>
|
||||||
go get github.com/wailsapp/wails/cmd/wails
|
go get -u github.com/wailsapp/wails/cmd/wails
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
## Next Steps
|
## Next Steps
|
||||||
@@ -126,8 +125,7 @@ And without [these people](CONTRIBUTORS.md), it wouldn't be what it is today. A
|
|||||||
|
|
||||||
Special Mentions:
|
Special Mentions:
|
||||||
|
|
||||||
* [Bill Kennedy](https://twitter.com/goinggodotnet) - Go guru, encourager and all-round nice guy, whose infectious energy and inspiration powered me on when I had none left.
|
* [Byron](https://github.com/bh90210) - At times, Byron has single handedly kept this project alive. Without his incredible input, we never would have got to v1.
|
||||||
* [Mark Bates](https://github.com/markbates) - Creator of [Packr](https://github.com/gobuffalo/packr), inspiration for packing strategies which fed into some of the tooling.
|
|
||||||
|
|
||||||
This project was mainly coded to the following albums:
|
This project was mainly coded to the following albums:
|
||||||
|
|
||||||
|
|||||||
28
app.go
28
app.go
@@ -1,7 +1,6 @@
|
|||||||
package wails
|
package wails
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
|
||||||
"os"
|
"os"
|
||||||
"runtime"
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
@@ -45,7 +44,7 @@ func CreateApp(optionalConfig ...*AppConfig) *App {
|
|||||||
}
|
}
|
||||||
|
|
||||||
result := &App{
|
result := &App{
|
||||||
logLevel: "info",
|
logLevel: "debug",
|
||||||
renderer: renderer.NewWebView(),
|
renderer: renderer.NewWebView(),
|
||||||
ipc: ipc.NewManager(),
|
ipc: ipc.NewManager(),
|
||||||
bindingManager: binding.NewManager(),
|
bindingManager: binding.NewManager(),
|
||||||
@@ -67,28 +66,12 @@ func CreateApp(optionalConfig ...*AppConfig) *App {
|
|||||||
result.config.DisableInspector = true
|
result.config.DisableInspector = true
|
||||||
}
|
}
|
||||||
|
|
||||||
// If running windows, do a hidpi fix
|
// Platform specific init
|
||||||
if runtime.GOOS == "windows" {
|
platformInit()
|
||||||
err := SetProcessDPIAware()
|
|
||||||
if err != nil {
|
|
||||||
result.log.Fatalf(err.Error())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetProcessDPIAware via user32.dll
|
|
||||||
// https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setprocessdpiaware
|
|
||||||
// Also, thanks Jack Mordaynt! 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
|
// Run the app
|
||||||
func (a *App) Run() error {
|
func (a *App) Run() error {
|
||||||
|
|
||||||
@@ -123,6 +106,11 @@ func (a *App) start() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable console for Windows debug builds
|
||||||
|
if runtime.GOOS == "windows" && BuildMode == cmd.BuildModeDebug {
|
||||||
|
a.renderer.EnableConsole()
|
||||||
|
}
|
||||||
|
|
||||||
// Start signal handler
|
// Start signal handler
|
||||||
t := tebata.New(os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL)
|
t := tebata.New(os.Interrupt, os.Kill, syscall.SIGTERM, syscall.SIGINT, syscall.SIGKILL)
|
||||||
t.Reserve(func() {
|
t.Reserve(func() {
|
||||||
|
|||||||
7
app_other.go
Normal file
7
app_other.go
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
// +build +linux +darwin !windows
|
||||||
|
|
||||||
|
package wails
|
||||||
|
|
||||||
|
func platformInit() {
|
||||||
|
|
||||||
|
}
|
||||||
27
app_windows.go
Normal file
27
app_windows.go
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
// +build windows !linux !darwin
|
||||||
|
|
||||||
|
package wails
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
|
"syscall"
|
||||||
|
)
|
||||||
|
|
||||||
|
func platformInit() {
|
||||||
|
err := SetProcessDPIAware()
|
||||||
|
if err != nil {
|
||||||
|
log.Fatalf(err.Error())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 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
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
10
cmd/fs.go
10
cmd/fs.go
@@ -132,6 +132,16 @@ func (fs *FSHelper) LocalDir(dir string) (*Dir, error) {
|
|||||||
}, err
|
}, 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
|
// GetSubdirs will return a list of FQPs to subdirectories in the given directory
|
||||||
func (d *Dir) GetSubdirs() (map[string]string, error) {
|
func (d *Dir) GetSubdirs() (map[string]string, error) {
|
||||||
|
|
||||||
|
|||||||
12
cmd/linux.go
12
cmd/linux.go
@@ -43,8 +43,14 @@ const (
|
|||||||
Kali
|
Kali
|
||||||
// Neon distribution
|
// Neon distribution
|
||||||
Neon
|
Neon
|
||||||
|
// ArcoLinux distribution
|
||||||
|
ArcoLinux
|
||||||
// Manjaro distribution
|
// Manjaro distribution
|
||||||
Manjaro
|
Manjaro
|
||||||
|
// ManjaroARM distribution
|
||||||
|
ManjaroARM
|
||||||
|
// Deepin distribution
|
||||||
|
Deepin
|
||||||
)
|
)
|
||||||
|
|
||||||
// DistroInfo contains all the information relating to a linux distribution
|
// DistroInfo contains all the information relating to a linux distribution
|
||||||
@@ -128,8 +134,14 @@ func parseOsRelease(osRelease string) *DistroInfo {
|
|||||||
result.Distribution = Kali
|
result.Distribution = Kali
|
||||||
case "neon":
|
case "neon":
|
||||||
result.Distribution = Neon
|
result.Distribution = Neon
|
||||||
|
case "arcolinux":
|
||||||
|
result.Distribution = ArcoLinux
|
||||||
case "manjaro":
|
case "manjaro":
|
||||||
result.Distribution = Manjaro
|
result.Distribution = Manjaro
|
||||||
|
case "manjaro-arm":
|
||||||
|
result.Distribution = ManjaroARM
|
||||||
|
case "deepin":
|
||||||
|
result.Distribution = Deepin
|
||||||
default:
|
default:
|
||||||
result.Distribution = Unknown
|
result.Distribution = Unknown
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package cmd
|
|||||||
import (
|
import (
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
"github.com/leaanthony/mewn"
|
|
||||||
"gopkg.in/yaml.v3"
|
"gopkg.in/yaml.v3"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -79,11 +78,14 @@ func (l *LinuxDB) GetDistro(distro string) *Distribution {
|
|||||||
// NewLinuxDB creates a new LinuxDB instance from the bundled
|
// NewLinuxDB creates a new LinuxDB instance from the bundled
|
||||||
// linuxdb.yaml file.
|
// linuxdb.yaml file.
|
||||||
func NewLinuxDB() *LinuxDB {
|
func NewLinuxDB() *LinuxDB {
|
||||||
data := mewn.Bytes("./linuxdb.yaml")
|
data, err := fs.LoadRelativeFile("./linuxdb.yaml")
|
||||||
|
if err != nil {
|
||||||
|
log.Fatal("Could not load linuxdb.yaml")
|
||||||
|
}
|
||||||
result := LinuxDB{
|
result := LinuxDB{
|
||||||
Distributions: make(map[string]*Distribution),
|
Distributions: make(map[string]*Distribution),
|
||||||
}
|
}
|
||||||
err := result.ImportData(data)
|
err = result.ImportData(data)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -82,6 +82,15 @@ distributions:
|
|||||||
gccversioncommand: *gccdumpfullversion
|
gccversioncommand: *gccdumpfullversion
|
||||||
programs: *debiandefaultprograms
|
programs: *debiandefaultprograms
|
||||||
libraries: *debiandefaultlibraries
|
libraries: *debiandefaultlibraries
|
||||||
|
deepin:
|
||||||
|
id: deepin
|
||||||
|
releases:
|
||||||
|
default:
|
||||||
|
version: default
|
||||||
|
name: Deepin
|
||||||
|
gccversioncommand: *gccdumpfullversion
|
||||||
|
programs: *debiandefaultprograms
|
||||||
|
libraries: *debiandefaultlibraries
|
||||||
void:
|
void:
|
||||||
id: void
|
id: void
|
||||||
releases:
|
releases:
|
||||||
@@ -158,6 +167,15 @@ distributions:
|
|||||||
help: Please install with `sudo pacman -S gtk3` and try again
|
help: Please install with `sudo pacman -S gtk3` and try again
|
||||||
- name: webkit2gtk
|
- name: webkit2gtk
|
||||||
help: Please install with `sudo pacman -S webkit2gtk` and try again
|
help: Please install with `sudo pacman -S webkit2gtk` and try again
|
||||||
|
arcolinux:
|
||||||
|
id: arcolinux
|
||||||
|
releases:
|
||||||
|
default:
|
||||||
|
version: default
|
||||||
|
name: ArcoLinux
|
||||||
|
gccversioncommand: *gccdumpversion
|
||||||
|
programs: *archdefaultprograms
|
||||||
|
libraries: *archdefaultlibraries
|
||||||
manjaro:
|
manjaro:
|
||||||
id: manjaro
|
id: manjaro
|
||||||
releases:
|
releases:
|
||||||
@@ -167,6 +185,15 @@ distributions:
|
|||||||
gccversioncommand: *gccdumpversion
|
gccversioncommand: *gccdumpversion
|
||||||
programs: *archdefaultprograms
|
programs: *archdefaultprograms
|
||||||
libraries: *archdefaultlibraries
|
libraries: *archdefaultlibraries
|
||||||
|
manjaro-arm:
|
||||||
|
id: manjaro-arm
|
||||||
|
releases:
|
||||||
|
default:
|
||||||
|
version: default
|
||||||
|
name: Manjaro-ARM
|
||||||
|
gccversioncommand: *gccdumpversion
|
||||||
|
programs: *archdefaultprograms
|
||||||
|
libraries: *archdefaultlibraries
|
||||||
gentoo:
|
gentoo:
|
||||||
id: gentoo
|
id: gentoo
|
||||||
releases:
|
releases:
|
||||||
|
|||||||
@@ -274,9 +274,9 @@ func CheckDependencies(logger *Logger) (bool, error) {
|
|||||||
distroInfo := GetLinuxDistroInfo()
|
distroInfo := GetLinuxDistroInfo()
|
||||||
|
|
||||||
switch distroInfo.Distribution {
|
switch distroInfo.Distribution {
|
||||||
case Ubuntu, Debian, Zorin, Parrot, Linuxmint, Elementary, Kali, Neon:
|
case Ubuntu, Debian, Zorin, Parrot, Linuxmint, Elementary, Kali, Neon, Deepin:
|
||||||
libraryChecker = DpkgInstalled
|
libraryChecker = DpkgInstalled
|
||||||
case Arch, Manjaro:
|
case Arch, ArcoLinux, Manjaro, ManjaroARM:
|
||||||
libraryChecker = PacmanInstalled
|
libraryChecker = PacmanInstalled
|
||||||
case CentOS, Fedora:
|
case CentOS, Fedora:
|
||||||
libraryChecker = RpmInstalled
|
libraryChecker = RpmInstalled
|
||||||
|
|||||||
@@ -9,4 +9,4 @@
|
|||||||
last 2 versions
|
last 2 versions
|
||||||
Firefox ESR
|
Firefox ESR
|
||||||
not dead
|
not dead
|
||||||
not IE 9-11 # For IE 9-11 support, remove 'not'.
|
IE 9-11 # For IE 9-11 support, remove 'not'.
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"ng": "npx ng",
|
"ng": "npx ng",
|
||||||
"start": "npx ng serve --poll=2000",
|
"start": "npx ng serve --poll=2000 --host=0.0.0.0",
|
||||||
"build": "npx ng build --single-bundle true --output-hashing none --prod --bundle-styles false",
|
"build": "npx ng build --single-bundle true --output-hashing none --prod --bundle-styles false",
|
||||||
"test": "npx ng test",
|
"test": "npx ng test",
|
||||||
"lint": "npx ng lint",
|
"lint": "npx ng lint",
|
||||||
@@ -22,6 +22,7 @@
|
|||||||
"@angular/platform-browser-dynamic": "~8.0.1",
|
"@angular/platform-browser-dynamic": "~8.0.1",
|
||||||
"@angular/router": "~8.0.1",
|
"@angular/router": "~8.0.1",
|
||||||
"@wailsapp/runtime": "^1.0.0",
|
"@wailsapp/runtime": "^1.0.0",
|
||||||
|
"core-js": "^3.4.4",
|
||||||
"ngx-build-plus": "^8.0.3",
|
"ngx-build-plus": "^8.0.3",
|
||||||
"rxjs": "~6.4.0",
|
"rxjs": "~6.4.0",
|
||||||
"tslib": "^1.9.0",
|
"tslib": "^1.9.0",
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import 'core-js/stable';
|
||||||
import { enableProdMode } from '@angular/core';
|
import { enableProdMode } from '@angular/core';
|
||||||
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
"module": "esnext",
|
"module": "esnext",
|
||||||
"moduleResolution": "node",
|
"moduleResolution": "node",
|
||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
"target": "es2015",
|
"target": "es5",
|
||||||
"typeRoots": [
|
"typeRoots": [
|
||||||
"node_modules/@types"
|
"node_modules/@types"
|
||||||
],
|
],
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ func basic() string {
|
|||||||
|
|
||||||
func main() {
|
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")
|
css := mewn.String("./frontend/dist/my-app/styles.css")
|
||||||
|
|
||||||
app := wails.CreateApp(&wails.AppConfig{
|
app := wails.CreateApp(&wails.AppConfig{
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
presets: [
|
presets: [
|
||||||
'@vue/app'
|
[ '@vue/app', { useBuiltIns: 'entry' } ]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,8 @@
|
|||||||
"lint": "vue-cli-service lint"
|
"lint": "vue-cli-service lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"core-js": "^2.6.4",
|
"core-js": "^3.6.1",
|
||||||
|
"regenerator-runtime": "^0.13.3",
|
||||||
"vue": "^2.5.22",
|
"vue": "^2.5.22",
|
||||||
"@wailsapp/runtime": "^1.0.0"
|
"@wailsapp/runtime": "^1.0.0"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
import 'core-js/stable';
|
||||||
|
import 'regenerator-runtime/runtime';
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import App from './App.vue';
|
import App from './App.vue';
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
disableHostCheck: true,
|
disableHostCheck: true
|
||||||
host: "localhost"
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
module.exports = {
|
module.exports = {
|
||||||
presets: [
|
presets: [
|
||||||
'@vue/app'
|
[ '@vue/app', { useBuiltIns: 'entry' } ]
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,8 @@
|
|||||||
"lint": "vue-cli-service lint"
|
"lint": "vue-cli-service lint"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-polyfill": "^6.26.0",
|
"core-js": "^3.6.1",
|
||||||
"core-js": "^2.6.4",
|
"regenerator-runtime": "^0.13.3",
|
||||||
"material-design-icons-iconfont": "^5.0.1",
|
"material-design-icons-iconfont": "^5.0.1",
|
||||||
"vue": "^2.5.22",
|
"vue": "^2.5.22",
|
||||||
"vuetify": "^1.5.14",
|
"vuetify": "^1.5.14",
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import 'babel-polyfill';
|
import 'core-js/stable';
|
||||||
|
import 'regenerator-runtime/runtime';
|
||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
|
||||||
// Setup Vuetify
|
// Setup Vuetify
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ module.exports = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
devServer: {
|
devServer: {
|
||||||
disableHostCheck: true,
|
disableHostCheck: true
|
||||||
host: "localhost"
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "Vuetify Basic",
|
"name": "Vuetify1.5/Webpack Basic",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"shortdescription": "Vuetify + Webpack",
|
"shortdescription": "A basic Vuetify1.5/Webpack4 template",
|
||||||
"description": "Basic template using Vuetify and bundled using Webpack",
|
"description": "Basic template using Vuetify v1.5 and bundled using Webpack",
|
||||||
"install": "npm install",
|
"install": "npm install",
|
||||||
"build": "npm run build",
|
"build": "npm run build",
|
||||||
"author": "lea <lea.anthony@gmail.com>",
|
"author": "lea <lea.anthony@gmail.com>",
|
||||||
|
|||||||
3
cmd/templates/vuetify2-basic/.jshint
Normal file
3
cmd/templates/vuetify2-basic/.jshint
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"esversion": 6
|
||||||
|
}
|
||||||
21
cmd/templates/vuetify2-basic/frontend/.gitignore
vendored
Normal file
21
cmd/templates/vuetify2-basic/frontend/.gitignore
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
/dist
|
||||||
|
|
||||||
|
# local env files
|
||||||
|
.env.local
|
||||||
|
.env.*.local
|
||||||
|
|
||||||
|
# Log files
|
||||||
|
npm-debug.log*
|
||||||
|
yarn-debug.log*
|
||||||
|
yarn-error.log*
|
||||||
|
|
||||||
|
# Editor directories and files
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
*.suo
|
||||||
|
*.ntvs*
|
||||||
|
*.njsproj
|
||||||
|
*.sln
|
||||||
|
*.sw*
|
||||||
5
cmd/templates/vuetify2-basic/frontend/babel.config.js
Normal file
5
cmd/templates/vuetify2-basic/frontend/babel.config.js
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
module.exports = {
|
||||||
|
presets: [
|
||||||
|
[ '@vue/app', { useBuiltIns: 'entry' } ]
|
||||||
|
]
|
||||||
|
};
|
||||||
53
cmd/templates/vuetify2-basic/frontend/package.json.template
Normal file
53
cmd/templates/vuetify2-basic/frontend/package.json.template
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
{
|
||||||
|
"name": "{{.NPMProjectName}}",
|
||||||
|
"author": "{{.Author.Name}}<{{.Author.Email}}>",
|
||||||
|
"private": true,
|
||||||
|
"scripts": {
|
||||||
|
"serve": "vue-cli-service serve",
|
||||||
|
"build": "vue-cli-service build",
|
||||||
|
"lint": "vue-cli-service lint"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"core-js": "^3.6.1",
|
||||||
|
"regenerator-runtime": "^0.13.3",
|
||||||
|
"vue": "^2.5.22",
|
||||||
|
"vuetify": "^2.0.15",
|
||||||
|
"@wailsapp/runtime": "^1.0.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@mdi/font": "^4.3.95",
|
||||||
|
"@vue/cli-plugin-babel": "^3.4.0",
|
||||||
|
"@vue/cli-plugin-eslint": "^3.4.0",
|
||||||
|
"@vue/cli-service": "^3.4.0",
|
||||||
|
"babel-eslint": "^10.0.1",
|
||||||
|
"eslint": "^5.8.0",
|
||||||
|
"eslint-plugin-vue": "^5.0.0",
|
||||||
|
"eventsource-polyfill": "^0.9.6",
|
||||||
|
"vue-template-compiler": "^2.5.21",
|
||||||
|
"webpack-hot-middleware": "^2.24.3"
|
||||||
|
},
|
||||||
|
"eslintConfig": {
|
||||||
|
"root": true,
|
||||||
|
"env": {
|
||||||
|
"node": true
|
||||||
|
},
|
||||||
|
"extends": [
|
||||||
|
"plugin:vue/essential",
|
||||||
|
"eslint:recommended"
|
||||||
|
],
|
||||||
|
"rules": {},
|
||||||
|
"parserOptions": {
|
||||||
|
"parser": "babel-eslint"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"postcss": {
|
||||||
|
"plugins": {
|
||||||
|
"autoprefixer": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"> 1%",
|
||||||
|
"last 2 versions",
|
||||||
|
"not ie <= 8"
|
||||||
|
]
|
||||||
|
}
|
||||||
60
cmd/templates/vuetify2-basic/frontend/src/App.vue
Normal file
60
cmd/templates/vuetify2-basic/frontend/src/App.vue
Normal file
@@ -0,0 +1,60 @@
|
|||||||
|
<template>
|
||||||
|
<v-app id="inspire">
|
||||||
|
<v-navigation-drawer v-model="drawer" clipped fixed app>
|
||||||
|
<v-list dense>
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-icon>
|
||||||
|
<v-icon>mdi-view-dashboard</v-icon>
|
||||||
|
</v-list-item-icon>
|
||||||
|
<v-list-item-content>
|
||||||
|
<v-list-item-title>Dashboard</v-list-item-title>
|
||||||
|
</v-list-item-content>
|
||||||
|
</v-list-item>
|
||||||
|
<v-list-item>
|
||||||
|
<v-list-item-icon>
|
||||||
|
<v-icon>mdi-settings</v-icon>
|
||||||
|
</v-list-item-icon>
|
||||||
|
<v-list-item-content>
|
||||||
|
<v-list-item-title>Settings</v-list-item-title>
|
||||||
|
</v-list-item-content>
|
||||||
|
</v-list-item>
|
||||||
|
</v-list>
|
||||||
|
</v-navigation-drawer>
|
||||||
|
<v-app-bar app fixed clipped-left>
|
||||||
|
<v-app-bar-nav-icon @click.stop="drawer = !drawer"></v-app-bar-nav-icon>
|
||||||
|
<v-toolbar-title>Application</v-toolbar-title>
|
||||||
|
</v-app-bar>
|
||||||
|
<v-content>
|
||||||
|
<v-container fluid class="px-0">
|
||||||
|
<v-layout justify-center align-center class="px-0">
|
||||||
|
<hello-world></hello-world>
|
||||||
|
</v-layout>
|
||||||
|
</v-container>
|
||||||
|
</v-content>
|
||||||
|
<v-footer app fixed>
|
||||||
|
<span style="margin-left:1em">© You</span>
|
||||||
|
</v-footer>
|
||||||
|
</v-app>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import HelloWorld from "./components/HelloWorld.vue"
|
||||||
|
|
||||||
|
export default {
|
||||||
|
data: () => ({
|
||||||
|
drawer: false
|
||||||
|
}),
|
||||||
|
components: {
|
||||||
|
HelloWorld
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
source: String
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.logo {
|
||||||
|
width: 16em;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
BIN
cmd/templates/vuetify2-basic/frontend/src/assets/images/logo.png
Normal file
BIN
cmd/templates/vuetify2-basic/frontend/src/assets/images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 301 KiB |
@@ -0,0 +1,85 @@
|
|||||||
|
<template>
|
||||||
|
<v-container fluid class="px-0">
|
||||||
|
<v-layout>
|
||||||
|
<v-flex xs12 sm6 offset-sm3>
|
||||||
|
<v-card raised="raised" class="pa-4 ma-4">
|
||||||
|
<v-layout justify-center align-center class="pa-4 ma-4">
|
||||||
|
<v-img :src="require('../assets/images/logo.png')"></v-img>
|
||||||
|
</v-layout>
|
||||||
|
<v-card-actions>
|
||||||
|
<v-layout justify-center align-center class="px-0">
|
||||||
|
<v-btn color="blue" @click="getMessage">Press Me</v-btn>
|
||||||
|
</v-layout>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-flex>
|
||||||
|
</v-layout>
|
||||||
|
<div class="text-xs-center">
|
||||||
|
<v-dialog v-model="dialog" width="500">
|
||||||
|
<v-card>
|
||||||
|
<v-card-title class="headline" primary-title>Message from Go</v-card-title>
|
||||||
|
<v-card-text>{{message}}</v-card-text>
|
||||||
|
<v-divider></v-divider>
|
||||||
|
<v-card-actions>
|
||||||
|
<v-spacer></v-spacer>
|
||||||
|
<v-btn color="primary" text @click="dialog = false">Awesome</v-btn>
|
||||||
|
</v-card-actions>
|
||||||
|
</v-card>
|
||||||
|
</v-dialog>
|
||||||
|
</div>
|
||||||
|
</v-container>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
data () {
|
||||||
|
return {
|
||||||
|
message: " ",
|
||||||
|
raised: true,
|
||||||
|
dialog: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
getMessage: function () {
|
||||||
|
var self = this
|
||||||
|
window.backend.basic().then(result => {
|
||||||
|
self.message = result
|
||||||
|
self.dialog = true
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||||
|
<style scoped>
|
||||||
|
h1 {
|
||||||
|
margin-top: 2em;
|
||||||
|
position: relative;
|
||||||
|
min-height: 5rem;
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
a:hover {
|
||||||
|
font-size: 1.7em;
|
||||||
|
border-color: blue;
|
||||||
|
background-color: blue;
|
||||||
|
color: white;
|
||||||
|
border: 3px solid white;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 9px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: 500ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
font-size: 1.7em;
|
||||||
|
border-color: white;
|
||||||
|
background-color: #121212;
|
||||||
|
color: white;
|
||||||
|
border: 3px solid white;
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 9px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
29
cmd/templates/vuetify2-basic/frontend/src/main.js
Normal file
29
cmd/templates/vuetify2-basic/frontend/src/main.js
Normal file
@@ -0,0 +1,29 @@
|
|||||||
|
import 'core-js/stable';
|
||||||
|
import 'regenerator-runtime/runtime';
|
||||||
|
import '@mdi/font/css/materialdesignicons.css';
|
||||||
|
import Vue from 'vue';
|
||||||
|
import Vuetify from 'vuetify';
|
||||||
|
import 'vuetify/dist/vuetify.min.css';
|
||||||
|
|
||||||
|
Vue.use(Vuetify);
|
||||||
|
|
||||||
|
import App from './App.vue';
|
||||||
|
|
||||||
|
Vue.config.productionTip = false;
|
||||||
|
Vue.config.devtools = true;
|
||||||
|
|
||||||
|
import Wails from '@wailsapp/runtime';
|
||||||
|
|
||||||
|
Wails.Init(() => {
|
||||||
|
new Vue({
|
||||||
|
vuetify: new Vuetify({
|
||||||
|
icons: {
|
||||||
|
iconfont: 'mdi'
|
||||||
|
},
|
||||||
|
theme: {
|
||||||
|
dark: true
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
render: h => h(App)
|
||||||
|
}).$mount('#app');
|
||||||
|
});
|
||||||
42
cmd/templates/vuetify2-basic/frontend/vue.config.js
Normal file
42
cmd/templates/vuetify2-basic/frontend/vue.config.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
let cssConfig = {};
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV == 'production') {
|
||||||
|
cssConfig = {
|
||||||
|
extract: {
|
||||||
|
filename: '[name].css',
|
||||||
|
chunkFilename: '[name].css'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
chainWebpack: config => {
|
||||||
|
let limit = 9999999999999999;
|
||||||
|
config.module
|
||||||
|
.rule('images')
|
||||||
|
.test(/\.(png|gif|jpg)(\?.*)?$/i)
|
||||||
|
.use('url-loader')
|
||||||
|
.loader('url-loader')
|
||||||
|
.tap(options => Object.assign(options, { limit: limit }));
|
||||||
|
config.module
|
||||||
|
.rule('fonts')
|
||||||
|
.test(/\.(woff2?|eot|ttf|otf|svg)(\?.*)?$/i)
|
||||||
|
.use('url-loader')
|
||||||
|
.loader('url-loader')
|
||||||
|
.options({
|
||||||
|
limit: limit
|
||||||
|
});
|
||||||
|
},
|
||||||
|
css: cssConfig,
|
||||||
|
configureWebpack: {
|
||||||
|
output: {
|
||||||
|
filename: '[name].js'
|
||||||
|
},
|
||||||
|
optimization: {
|
||||||
|
splitChunks: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
devServer: {
|
||||||
|
disableHostCheck: true
|
||||||
|
}
|
||||||
|
};
|
||||||
5
cmd/templates/vuetify2-basic/go.mod.template
Normal file
5
cmd/templates/vuetify2-basic/go.mod.template
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
module {{.BinaryName}}
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/wailsapp/wails {{.WailsVersion}}
|
||||||
|
)
|
||||||
27
cmd/templates/vuetify2-basic/main.go.template
Normal file
27
cmd/templates/vuetify2-basic/main.go.template
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/leaanthony/mewn"
|
||||||
|
"github.com/wailsapp/wails"
|
||||||
|
)
|
||||||
|
|
||||||
|
func basic() string {
|
||||||
|
return "Hello World!"
|
||||||
|
}
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
js := mewn.String("./frontend/dist/app.js")
|
||||||
|
css := mewn.String("./frontend/dist/app.css")
|
||||||
|
|
||||||
|
app := wails.CreateApp(&wails.AppConfig{
|
||||||
|
Width: 1024,
|
||||||
|
Height: 768,
|
||||||
|
Title: "{{.Name}}",
|
||||||
|
JS: js,
|
||||||
|
CSS: css,
|
||||||
|
Colour: "#131313",
|
||||||
|
})
|
||||||
|
app.Bind(basic)
|
||||||
|
app.Run()
|
||||||
|
}
|
||||||
14
cmd/templates/vuetify2-basic/template.json
Executable file
14
cmd/templates/vuetify2-basic/template.json
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"name": "Vuetify2/Webpack Basic",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"shortdescription": "A basic Vuetify2/Webpack4 template",
|
||||||
|
"description": "Basic template using Vuetify v2 and bundled using Webpack",
|
||||||
|
"install": "npm install",
|
||||||
|
"build": "npm run build",
|
||||||
|
"author": "Michael Hipp <michael@redmule.com>",
|
||||||
|
"created": "2019-09-06",
|
||||||
|
"frontenddir": "frontend",
|
||||||
|
"serve": "npm run serve",
|
||||||
|
"bridge": "src",
|
||||||
|
"wailsdir": ""
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
// Version - Wails version
|
// Version - Wails version
|
||||||
const Version = "v0.19.0"
|
const Version = "v1.0.2-pre3"
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package event
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/lib/interfaces"
|
"github.com/wailsapp/wails/lib/interfaces"
|
||||||
"github.com/wailsapp/wails/lib/logger"
|
"github.com/wailsapp/wails/lib/logger"
|
||||||
@@ -13,6 +12,7 @@ import (
|
|||||||
// Manager handles and processes events
|
// Manager handles and processes events
|
||||||
type Manager struct {
|
type Manager struct {
|
||||||
incomingEvents chan *messages.EventData
|
incomingEvents chan *messages.EventData
|
||||||
|
quitChannel chan struct{}
|
||||||
listeners map[string][]*eventListener
|
listeners map[string][]*eventListener
|
||||||
running bool
|
running bool
|
||||||
log *logger.CustomLogger
|
log *logger.CustomLogger
|
||||||
@@ -24,6 +24,7 @@ type Manager struct {
|
|||||||
func NewManager() interfaces.EventManager {
|
func NewManager() interfaces.EventManager {
|
||||||
return &Manager{
|
return &Manager{
|
||||||
incomingEvents: make(chan *messages.EventData, 100),
|
incomingEvents: make(chan *messages.EventData, 100),
|
||||||
|
quitChannel: make(chan struct{}, 1),
|
||||||
listeners: make(map[string][]*eventListener),
|
listeners: make(map[string][]*eventListener),
|
||||||
running: false,
|
running: false,
|
||||||
log: logger.NewCustomLogger("Events"),
|
log: logger.NewCustomLogger("Events"),
|
||||||
@@ -141,8 +142,8 @@ func (e *Manager) Start(renderer interfaces.Renderer) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
default:
|
case <-e.quitChannel:
|
||||||
time.Sleep(1 * time.Millisecond)
|
e.running = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
e.wg.Done()
|
e.wg.Done()
|
||||||
@@ -152,7 +153,7 @@ func (e *Manager) Start(renderer interfaces.Renderer) {
|
|||||||
// Shutdown is called when exiting the Application
|
// Shutdown is called when exiting the Application
|
||||||
func (e *Manager) Shutdown() {
|
func (e *Manager) Shutdown() {
|
||||||
e.log.Debug("Shutting Down")
|
e.log.Debug("Shutting Down")
|
||||||
e.running = false
|
e.quitChannel <- struct{}{}
|
||||||
e.log.Debug("Waiting for main loop to exit")
|
e.log.Debug("Waiting for main loop to exit")
|
||||||
e.wg.Wait()
|
e.wg.Wait()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,12 @@ package interfaces
|
|||||||
import (
|
import (
|
||||||
"github.com/wailsapp/wails/lib/messages"
|
"github.com/wailsapp/wails/lib/messages"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Renderer is an interface describing a Wails target to render the app to
|
// Renderer is an interface describing a Wails target to render the app to
|
||||||
type Renderer interface {
|
type Renderer interface {
|
||||||
Initialise(AppConfig, IPCManager, EventManager) error
|
Initialise(AppConfig, IPCManager, EventManager) error
|
||||||
Run() error
|
Run() error
|
||||||
|
EnableConsole()
|
||||||
|
|
||||||
// Binding
|
// Binding
|
||||||
NewBinding(bindingName string) error
|
NewBinding(bindingName string) error
|
||||||
|
|||||||
@@ -3,7 +3,6 @@ package ipc
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/wailsapp/wails/lib/interfaces"
|
"github.com/wailsapp/wails/lib/interfaces"
|
||||||
"github.com/wailsapp/wails/lib/logger"
|
"github.com/wailsapp/wails/lib/logger"
|
||||||
@@ -124,8 +123,8 @@ func (i *Manager) Start(eventManager interfaces.EventManager, bindingManager int
|
|||||||
i.log.DebugFields("Finished processing message", logger.Fields{
|
i.log.DebugFields("Finished processing message", logger.Fields{
|
||||||
"1D": &incomingMessage,
|
"1D": &incomingMessage,
|
||||||
})
|
})
|
||||||
default:
|
case <-i.quitChannel:
|
||||||
time.Sleep(1 * time.Millisecond)
|
i.running = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
i.log.Debug("Stopping")
|
i.log.Debug("Stopping")
|
||||||
@@ -175,7 +174,7 @@ func (i *Manager) SendResponse(response *ipcResponse) error {
|
|||||||
// Shutdown is called when exiting the Application
|
// Shutdown is called when exiting the Application
|
||||||
func (i *Manager) Shutdown() {
|
func (i *Manager) Shutdown() {
|
||||||
i.log.Debug("Shutdown called")
|
i.log.Debug("Shutdown called")
|
||||||
i.running = false
|
i.quitChannel <- struct{}{}
|
||||||
i.log.Debug("Waiting of main loop shutdown")
|
i.log.Debug("Waiting of main loop shutdown")
|
||||||
i.wg.Wait()
|
i.wg.Wait()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,10 @@ func (h *Bridge) evalJS(js string, mtype messageType) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EnableConsole not needed for bridge!
|
||||||
|
func (h *Bridge) EnableConsole() {
|
||||||
|
}
|
||||||
|
|
||||||
func (h *Bridge) injectCSS(css string) {
|
func (h *Bridge) injectCSS(css string) {
|
||||||
// Minify css to overcome issues in the browser with carriage returns
|
// Minify css to overcome issues in the browser with carriage returns
|
||||||
minified, err := htmlmin.Minify([]byte(css), &htmlmin.Options{
|
minified, err := htmlmin.Minify([]byte(css), &htmlmin.Options{
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -19,12 +19,13 @@ import (
|
|||||||
// WebView defines the main webview application window
|
// WebView defines the main webview application window
|
||||||
// Default values in []
|
// Default values in []
|
||||||
type WebView struct {
|
type WebView struct {
|
||||||
window wv.WebView // The webview object
|
window wv.WebView // The webview object
|
||||||
ipc interfaces.IPCManager
|
ipc interfaces.IPCManager
|
||||||
log *logger.CustomLogger
|
log *logger.CustomLogger
|
||||||
config interfaces.AppConfig
|
config interfaces.AppConfig
|
||||||
eventManager interfaces.EventManager
|
eventManager interfaces.EventManager
|
||||||
bindingCache []string
|
bindingCache []string
|
||||||
|
enableConsole bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewWebView returns a new WebView struct
|
// NewWebView returns a new WebView struct
|
||||||
@@ -103,6 +104,11 @@ func (w *WebView) evalJS(js string) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// EnableConsole enables the console!
|
||||||
|
func (w *WebView) EnableConsole() {
|
||||||
|
w.enableConsole = true
|
||||||
|
}
|
||||||
|
|
||||||
// Escape the Javascripts!
|
// Escape the Javascripts!
|
||||||
func escapeJS(js string) (string, error) {
|
func escapeJS(js string) (string, error) {
|
||||||
result := strings.Replace(js, "\\", "\\\\", -1)
|
result := strings.Replace(js, "\\", "\\\\", -1)
|
||||||
@@ -172,6 +178,13 @@ func (w *WebView) Run() error {
|
|||||||
|
|
||||||
w.log.Info("Running...")
|
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
|
// Runtime assets
|
||||||
wailsRuntime := mewn.String("../../runtime/assets/wails.js")
|
wailsRuntime := mewn.String("../../runtime/assets/wails.js")
|
||||||
w.evalJS(wailsRuntime)
|
w.evalJS(wailsRuntime)
|
||||||
|
|||||||
BIN
logo_cropped.png
Normal file
BIN
logo_cropped.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 122 KiB |
@@ -14,7 +14,7 @@ function init() {
|
|||||||
window.wailsbridge = {
|
window.wailsbridge = {
|
||||||
reconnectOverlay: null,
|
reconnectOverlay: null,
|
||||||
reconnectTimer: 300,
|
reconnectTimer: 300,
|
||||||
wsURL: 'ws://localhost:34115/bridge',
|
wsURL: 'ws://' + window.location.hostname + ':34115/bridge',
|
||||||
connectionState: null,
|
connectionState: null,
|
||||||
config: {},
|
config: {},
|
||||||
websocket: null,
|
websocket: null,
|
||||||
|
|||||||
175
runtime/assets/console.js
Normal file
175
runtime/assets/console.js
Normal 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
@@ -9,17 +9,35 @@ The lightweight framework for web-like apps
|
|||||||
*/
|
*/
|
||||||
/* jshint esversion: 6 */
|
/* 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
|
* Invoke sends the given message to the backend
|
||||||
*
|
*
|
||||||
* @param {string} message
|
* @param {string} message
|
||||||
*/
|
*/
|
||||||
function Invoke(message) {
|
function Invoke(message) {
|
||||||
if ( window.wailsbridge ) {
|
if (window.wailsbridge) {
|
||||||
window.wailsbridge.websocket.send(message);
|
window.wailsbridge.websocket.send(message);
|
||||||
} else {
|
} else {
|
||||||
window.external.invoke(message);
|
window.external.invoke(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Also send to listeners
|
||||||
|
if (listeners.length > 0) {
|
||||||
|
for (var i = 0; i < listeners.length; i++) {
|
||||||
|
listeners[i](message);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { On, OnMultiple, Emit, Notify, Heartbeat, Acknowledge } from './events';
|
|||||||
import { NewBinding } from './bindings';
|
import { NewBinding } from './bindings';
|
||||||
import { Callback } from './calls';
|
import { Callback } from './calls';
|
||||||
import { AddScript, InjectCSS } from './utils';
|
import { AddScript, InjectCSS } from './utils';
|
||||||
|
import { AddIPCListener } from './ipc';
|
||||||
|
|
||||||
// Initialise global if not already
|
// Initialise global if not already
|
||||||
window.wails = window.wails || {};
|
window.wails = window.wails || {};
|
||||||
@@ -27,6 +28,7 @@ var internal = {
|
|||||||
AddScript,
|
AddScript,
|
||||||
InjectCSS,
|
InjectCSS,
|
||||||
Init,
|
Init,
|
||||||
|
AddIPCListener,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Setup runtime structure
|
// Setup runtime structure
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ echo "**** WE ARE DONE! ****"
|
|||||||
func runCommand(command string, args ...string) {
|
func runCommand(command string, args ...string) {
|
||||||
cmd := exec.Command(command, args...)
|
cmd := exec.Command(command, args...)
|
||||||
output, err := cmd.CombinedOutput()
|
output, err := cmd.CombinedOutput()
|
||||||
|
fmt.Println(string(output))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Println(string(output))
|
log.Println(string(output))
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
|
|||||||
Reference in New Issue
Block a user