mirror of
https://github.com/taigrr/wails.git
synced 2026-04-07 15:42:42 -07:00
Compare commits
12 Commits
backport
...
angular-fi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
288feee1d9 | ||
|
|
416bd7bfc4 | ||
|
|
aca72d3f7a | ||
|
|
ad20e2622b | ||
|
|
daeda501f4 | ||
|
|
fb1e8647bc | ||
|
|
723236f348 | ||
|
|
394a823d82 | ||
|
|
afe57802ad | ||
|
|
914642bd1d | ||
|
|
d572418ec3 | ||
|
|
8c7480d277 |
@@ -20,4 +20,4 @@ Wails is what it is because of the time and effort given by these great people.
|
|||||||
* [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)
|
||||||
* [soon cheol shin](https://github.com/scshin0572)
|
* [Jack Mordaunt](https://github.com/JackMordaunt)
|
||||||
|
|||||||
21
app.go
21
app.go
@@ -1,7 +1,9 @@
|
|||||||
package wails
|
package wails
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"runtime"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/syossan27/tebata"
|
"github.com/syossan27/tebata"
|
||||||
@@ -65,9 +67,28 @@ func CreateApp(optionalConfig ...*AppConfig) *App {
|
|||||||
result.config.DisableInspector = true
|
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
|
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
|
// Run the app
|
||||||
func (a *App) Run() error {
|
func (a *App) Run() error {
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -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'.
|
||||||
@@ -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';
|
||||||
|
|
||||||
|
|||||||
@@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -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,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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
// Version - Wails version
|
// Version - Wails version
|
||||||
const Version = "v0.18.14-pre"
|
const Version = "v0.19.0"
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -13,7 +13,7 @@ package webview
|
|||||||
#cgo linux openbsd freebsd CFLAGS: -DWEBVIEW_GTK=1 -Wno-deprecated-declarations
|
#cgo linux openbsd freebsd CFLAGS: -DWEBVIEW_GTK=1 -Wno-deprecated-declarations
|
||||||
#cgo linux openbsd freebsd pkg-config: gtk+-3.0 webkit2gtk-4.0
|
#cgo linux openbsd freebsd pkg-config: gtk+-3.0 webkit2gtk-4.0
|
||||||
|
|
||||||
#cgo windows CFLAGS: -DWEBVIEW_WINAPI=1 -std=c99 -DUNICODE=1
|
#cgo windows CFLAGS: -DWEBVIEW_WINAPI=1 -std=c99
|
||||||
#cgo windows LDFLAGS: -lole32 -lcomctl32 -loleaut32 -luuid -lgdi32
|
#cgo windows LDFLAGS: -lole32 -lcomctl32 -loleaut32 -luuid -lgdi32
|
||||||
|
|
||||||
#cgo darwin CFLAGS: -DWEBVIEW_COCOA=1 -x objective-c
|
#cgo darwin CFLAGS: -DWEBVIEW_COCOA=1 -x objective-c
|
||||||
|
|||||||
@@ -95,13 +95,6 @@ function startBridge() {
|
|||||||
window.wailsbridge.reconnectOverlay.style.display = 'none';
|
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.
|
// Adds a script to the Dom.
|
||||||
// Removes it if second parameter is true.
|
// Removes it if second parameter is true.
|
||||||
function addScript(script, remove) {
|
function addScript(script, remove) {
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -15,10 +15,7 @@
|
|||||||
"error",
|
"error",
|
||||||
"tab"
|
"tab"
|
||||||
],
|
],
|
||||||
"linebreak-style": [
|
"linebreak-style": 0,
|
||||||
"error",
|
|
||||||
"unix"
|
|
||||||
],
|
|
||||||
"quotes": [
|
"quotes": [
|
||||||
"error",
|
"error",
|
||||||
"single"
|
"single"
|
||||||
|
|||||||
@@ -15,7 +15,11 @@ The lightweight framework for web-like apps
|
|||||||
* @param {string} message
|
* @param {string} message
|
||||||
*/
|
*/
|
||||||
function Invoke(message) {
|
function Invoke(message) {
|
||||||
window.external.invoke(message);
|
if ( window.wailsbridge ) {
|
||||||
|
window.wailsbridge.websocket.send(message);
|
||||||
|
} else {
|
||||||
|
window.external.invoke(message);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -46,6 +46,16 @@ var runtime = {
|
|||||||
// Augment global
|
// Augment global
|
||||||
Object.assign(window.wails, runtime);
|
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 loaded event
|
||||||
Emit('wails:loaded');
|
Emit('wails:loaded');
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,6 @@ function OpenFile(filename) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
OpenURL,
|
OpenURL: OpenURL,
|
||||||
OpenFile
|
OpenFile: OpenFile
|
||||||
};
|
};
|
||||||
@@ -80,10 +80,10 @@ function Acknowledge(eventName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
OnMultiple,
|
OnMultiple: OnMultiple,
|
||||||
On,
|
On: On,
|
||||||
Once,
|
Once: Once,
|
||||||
Emit,
|
Emit: Emit,
|
||||||
Heartbeat,
|
Heartbeat: Heartbeat,
|
||||||
Acknowledge
|
Acknowledge: Acknowledge
|
||||||
};
|
};
|
||||||
@@ -62,9 +62,9 @@ function Fatal(message) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
Debug,
|
Debug: Debug,
|
||||||
Info,
|
Info: Info,
|
||||||
Warning,
|
Warning: Warning,
|
||||||
Error,
|
Error: Error,
|
||||||
Fatal
|
Fatal: Fatal
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,8 +15,8 @@ const Events = require('./events');
|
|||||||
const Init = require('./init');
|
const Init = require('./init');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
Log,
|
Log: Log,
|
||||||
Browser,
|
Browser: Browser,
|
||||||
Events,
|
Events: Events,
|
||||||
Init
|
Init: Init
|
||||||
};
|
};
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@wailsapp/runtime",
|
"name": "@wailsapp/runtime",
|
||||||
"version": "1.0.6",
|
"version": "1.0.9",
|
||||||
"description": "Wails Javascript runtime library",
|
"description": "Wails Javascript runtime library",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"types": "runtime.d.ts",
|
"types": "runtime.d.ts",
|
||||||
|
|||||||
84
scripts/build.go
Normal file
84
scripts/build.go
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
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()
|
||||||
|
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")
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user