mirror of
https://github.com/wavetermdev/wails.git
synced 2026-04-22 15:26:15 -07:00
Compare commits
197 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2d5825d73d | |||
| c4a042cb1d | |||
| 205f9476fa | |||
| a1230fcbb6 | |||
| ba5c32a4a1 | |||
| 58eee64326 | |||
| 41d786a13c | |||
| a2b7906c89 | |||
| eeb6fa4677 | |||
| 6a36d75774 | |||
| 6078f3c780 | |||
| fc11197725 | |||
| 8c40b99194 | |||
| de53fc6510 | |||
| d4f4feb429 | |||
| 02973c49ff | |||
| 01dce9f139 | |||
| 6c0906e87d | |||
| d7cfc4c71a | |||
| fec3e7eac5 | |||
| 9f5e2c7dd4 | |||
| c5276cca6c | |||
| 74dbbbed8a | |||
| 629ac4b93c | |||
| 5ece7e84b3 | |||
| eaba857676 | |||
| db489a3cae | |||
| 4821ab8597 | |||
| 670b769f82 | |||
| eb53399824 | |||
| 24e4fbfb68 | |||
| 7f54ca4ac3 | |||
| b224803e4d | |||
| 28b2025aaa | |||
| 77e85705d1 | |||
| 9fd24595c7 | |||
| 69067e85f5 | |||
| c8db58e00e | |||
| e96e0e0999 | |||
| 2da21ec528 | |||
| cda0b40414 | |||
| 7f4229dd6b | |||
| 68651b77f4 | |||
| bf001f5ad2 | |||
| d1907b4ce5 | |||
| 56363d193d | |||
| 8553f43080 | |||
| 587681bb8d | |||
| afbf80ea4a | |||
| c180d7dccb | |||
| c20aabc8f8 | |||
| 4cccb628c9 | |||
| 5d487347d4 | |||
| fe8b7ac5c9 | |||
| 732c70777b | |||
| 753c5fd337 | |||
| 2dad29673d | |||
| 5e466893cf | |||
| c15fd822c1 | |||
| 42b1c0befa | |||
| 6ef8744e02 | |||
| cf916c8e8b | |||
| cdc1d4be3e | |||
| 1c5284db3e | |||
| 073cdc3a55 | |||
| fd9363e842 | |||
| 3051628fa2 | |||
| cac97e8652 | |||
| 2ccabc772b | |||
| ff91241592 | |||
| 2257b1cab1 | |||
| bdcf98fc15 | |||
| 3025a94a77 | |||
| d971495ad3 | |||
| a4b1f469e9 | |||
| b18f04b30d | |||
| 94e9447e1c | |||
| 03c479c890 | |||
| c95a3a795e | |||
| 1d8e99d846 | |||
| 8e909fc9f4 | |||
| 3bc86a4f50 | |||
| 2c7913c202 | |||
| d1c57ddb5f | |||
| 9ffb517183 | |||
| 27f852ac6a | |||
| 20c0b48634 | |||
| 6cf01b4239 | |||
| 3ae88f8822 | |||
| 5994eb605f | |||
| 9694dc57aa | |||
| b5b78fddee | |||
| c905185467 | |||
| 47ca7879cd | |||
| 6202b3bf3e | |||
| ea94c2de1f | |||
| eb0d4bc42f | |||
| b323c3db20 | |||
| 1670ac6567 | |||
| c941176018 | |||
| a060d9dcc0 | |||
| ba208dce44 | |||
| 9bbac46b3f | |||
| d8c591e64c | |||
| 2c28a8f550 | |||
| d6c5586159 | |||
| 08a7893b1d | |||
| fa6cf17079 | |||
| fe2a20f92a | |||
| b713d57168 | |||
| 17ca06693e | |||
| 243d738d64 | |||
| 3f50b95f26 | |||
| f0d8ce99a1 | |||
| 259eec97d6 | |||
| 8b2168abe7 | |||
| a51e127309 | |||
| c5cee79ff7 | |||
| 9393b08c3f | |||
| 0ca039e914 | |||
| cd8b4f088f | |||
| 847842504b | |||
| 8ab91d31fe | |||
| bb4d891549 | |||
| 4a316a76fa | |||
| 529e4cc07e | |||
| 579747d0f7 | |||
| 6880c53082 | |||
| 6e011e75c3 | |||
| 683ba7dc59 | |||
| 717e598330 | |||
| a6489a1044 | |||
| df911adcae | |||
| d7c0b1ec58 | |||
| 7135d4fa27 | |||
| 83e063bf2b | |||
| 6e0773b355 | |||
| 60f34223b0 | |||
| 539be2ce84 | |||
| 561198b81b | |||
| c823215eb6 | |||
| 93f890f6d9 | |||
| 8a3aec6866 | |||
| 1ef8ed73ab | |||
| 9004c3955e | |||
| 4c98ce7da1 | |||
| 0ae5381203 | |||
| 3f2f1b45f6 | |||
| e6bec8f7cc | |||
| f1f15fc1c5 | |||
| bcca09563c | |||
| ee355659ce | |||
| a660e4a9da | |||
| a44fd57e98 | |||
| 85de0bbf8a | |||
| 7274b6d19c | |||
| c0371f141a | |||
| 5c96264234 | |||
| a3c41d1740 | |||
| 7c15b780e2 | |||
| fb081b4876 | |||
| a28315f38b | |||
| 49e4f00b62 | |||
| 9167063976 | |||
| aaa425724c | |||
| ffdbb0af64 | |||
| 12dec650de | |||
| d4b2563e9b | |||
| 55817b65b5 | |||
| ab6e7531b4 | |||
| 1e4cf9b0ad | |||
| 13efa58c9a | |||
| 88b9b40bfe | |||
| 0011e39c55 | |||
| aa6b67734b | |||
| 733258cc83 | |||
| 4742fd7ed2 | |||
| 96996431b4 | |||
| f06ce760ba | |||
| 53cf2bb953 | |||
| 859b2dd638 | |||
| 0225b8588c | |||
| 0bb11079af | |||
| 35d4c4b99c | |||
| 76a4c3c171 | |||
| 5493e1d4ac | |||
| 807f772055 | |||
| 3e97a4cc4d | |||
| 5e42d67570 | |||
| 6ecdb43148 | |||
| ea5e06aabd | |||
| 54a88ae3d9 | |||
| 6edd941c1a | |||
| 04c64c1bea | |||
| db550f81cd | |||
| 5de8efff32 | |||
| a591bcc59c |
@@ -0,0 +1,30 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: bug
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Description**
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
**To Reproduce**
|
||||
Steps to reproduce the behaviour:
|
||||
1. Go to '...'
|
||||
2. Click on '....'
|
||||
3. Scroll down to '....'
|
||||
4. See error
|
||||
|
||||
**Expected behaviour**
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
**Screenshots**
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**System Details**
|
||||
Please paste the output of `wails report` here.
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
# Binaries for programs and plugins
|
||||
*.exe
|
||||
*.exe~
|
||||
*.dll
|
||||
*.so
|
||||
*.dylib
|
||||
|
||||
# Test binary, build with `go test -c`
|
||||
*.test
|
||||
|
||||
# Output of the go coverage tool, specifically when used with LiteIDE
|
||||
*.out
|
||||
|
||||
examples/**/example*
|
||||
!examples/**/*.*
|
||||
cmd/wails/wails
|
||||
.DS_Store
|
||||
tmp
|
||||
dist
|
||||
@@ -0,0 +1,26 @@
|
||||
# This is an example goreleaser.yaml file with some sane defaults.
|
||||
# Make sure to check the documentation at http://goreleaser.com
|
||||
before:
|
||||
hooks:
|
||||
- ./scripts/updateversion.sh
|
||||
builds:
|
||||
- env:
|
||||
- CGO_ENABLED=0
|
||||
main: ./cmd/wails/main.go
|
||||
archive:
|
||||
replacements:
|
||||
darwin: Darwin
|
||||
linux: Linux
|
||||
windows: Windows
|
||||
386: i386
|
||||
amd64: x86_64
|
||||
checksum:
|
||||
name_template: 'checksums.txt'
|
||||
snapshot:
|
||||
name_template: "{{ .Tag }}-next"
|
||||
changelog:
|
||||
sort: asc
|
||||
filters:
|
||||
exclude:
|
||||
- '^docs:'
|
||||
- '^test:'
|
||||
Vendored
+19
@@ -0,0 +1,19 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Launch",
|
||||
"type": "go",
|
||||
"request": "launch",
|
||||
"mode": "auto",
|
||||
"program": "${workspaceFolder}/cmd/wails/main.go",
|
||||
"env": {},
|
||||
"args": [
|
||||
"setup"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
-1300
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2018-Present Lea Anthony
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
@@ -0,0 +1,84 @@
|
||||
<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/>
|
||||
</p>
|
||||
<p align="center">
|
||||
A framework for building desktop applications using Go & Web Technologies.<br/><br/>
|
||||
<a href="https://github.com/wailsapp/wails/blob/master/LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg"></a>
|
||||
<a href="https://goreportcard.com/report/github.com/wailsapp/wails"><img src="https://goreportcard.com/badge/github.com/wailsapp/wails"/></a>
|
||||
<a href="http://godoc.org/github.com/wailsapp/wails"><img src="https://img.shields.io/badge/godoc-reference-blue.svg"/></a>
|
||||
<a href="https://www.codefactor.io/repository/github/wailsapp/wails"><img src="https://www.codefactor.io/repository/github/wailsapp/wails/badge" alt="CodeFactor" /></a>
|
||||
<a href="https://github.com/wailsapp/wails/issues"><img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="CodeFactor" /></a>
|
||||
</p>
|
||||
|
||||
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!
|
||||
|
||||
## Features
|
||||
|
||||
- Use standard Go libraries/frameworks for the backend
|
||||
- Use any frontend technology to build your UI
|
||||
- Expose Go methods/functions to the frontend via a single bind command
|
||||
- Uses native rendering engines - no embedded browser
|
||||
- Shared events system
|
||||
- Native file dialogs
|
||||
- Powerful cli tool
|
||||
- Multiplatform
|
||||
|
||||
## Installation
|
||||
|
||||
Wails uses cgo to bind to the native rendering engines so a number of platform dependent libraries are needed as well as an installation of Go. The basic requirements are:
|
||||
|
||||
- Go 1.11 or above
|
||||
- npm
|
||||
|
||||
### MacOS
|
||||
|
||||
Make sure you have the xcode command line tools installed. This can be done by running:
|
||||
|
||||
`xcode-select --install`
|
||||
|
||||
### Linux
|
||||
|
||||
#### Ubuntu 18.04
|
||||
|
||||
`sudo apt install pkg-config build-essential libgtk-3-dev libwebkit2gtk-4.0-dev`
|
||||
|
||||
Note: If you have successfully installed these dependencies on a different flavour of Linux, please consider submitting a PR.
|
||||
|
||||
### Windows
|
||||
|
||||
Windows requires gcc and related tooling. The recommended download is from [http://tdm-gcc.tdragon.net/download](http://tdm-gcc.tdragon.net/download). Once this is installed, you are good to go.
|
||||
|
||||
## Installation
|
||||
|
||||
Installation is as simple as running the following command:
|
||||
|
||||
<pre style='color:white'>
|
||||
go get -u github.com/wailsapp/wails/cmd/wails
|
||||
</pre>
|
||||
|
||||
## Next Steps
|
||||
|
||||
It is recommended at this stage to read the comprehensive documentation at [https://wails.app](https://wails.app).
|
||||
|
||||
## FAQ
|
||||
|
||||
* Is this an alternative to Electron?
|
||||
|
||||
Depends on your requirements. It's designed to make it easy for Go programmers to make lightweight desktop applications or add a frontend to their existing applications. Whilst Wails does not currently offer hooks into native elements such as menus, this may change in the future.
|
||||
|
||||
* Who is this project aimed at?
|
||||
|
||||
Go programmers who want to bundle an HMTL frontend with their applications, without resorting to creating a server and opening a browser to view it.
|
||||
|
||||
## Shoulders of Giants
|
||||
|
||||
Without the following people, this project would never have existed:
|
||||
|
||||
* [Dustin Krysak](https://wiki.ubuntu.com/bashfulrobot) - His support and feedback has been immense. More patience than you can throw a stick at.
|
||||
* [Serge Zaitsev](https://github.com/zserge) - Creator of [Webview](https://github.com/zserge/webview) which Wails uses for the windowing.
|
||||
|
||||
Special Mentions:
|
||||
|
||||
* [Bill Kennedy](https://twitter.com/goinggodotnet) - Go guru, encourager and all-round nice guy, whose energy and inspiration powered me on when I had none left.
|
||||
* [Mark Bates](https://github.com/markbates) - Creator of [Packr](https://github.com/gobuffalo/packr), inspiration for packing strategies.
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
package wails
|
||||
|
||||
import (
|
||||
"github.com/wailsapp/wails/cmd"
|
||||
)
|
||||
|
||||
// -------------------------------- Compile time Flags ------------------------------
|
||||
|
||||
// BuildMode indicates what mode we are in
|
||||
var BuildMode = cmd.BuildModeProd
|
||||
|
||||
// ----------------------------------------------------------------------------------
|
||||
|
||||
// App defines the main application struct
|
||||
type App struct {
|
||||
config *AppConfig // The Application configuration object
|
||||
cli *cmd.Cli // In debug mode, we have a cli
|
||||
renderer Renderer // The renderer is what we will render the app to
|
||||
logLevel string // The log level of the app
|
||||
ipc *ipcManager // Handles the IPC calls
|
||||
log *CustomLogger // Logger
|
||||
bindingManager *bindingManager // Handles binding of Go code to renderer
|
||||
eventManager *eventManager // Handles all the events
|
||||
runtime *Runtime // The runtime object for registered structs
|
||||
|
||||
// This is a list of all the JS/CSS that needs injecting
|
||||
// It will get injected in order
|
||||
jsCache []string
|
||||
cssCache []string
|
||||
}
|
||||
|
||||
// CreateApp creates the application window with the given configuration
|
||||
// If none given, the defaults are used
|
||||
func CreateApp(optionalConfig ...*AppConfig) *App {
|
||||
var userConfig *AppConfig
|
||||
if len(optionalConfig) > 0 {
|
||||
userConfig = optionalConfig[0]
|
||||
}
|
||||
|
||||
result := &App{
|
||||
logLevel: "info",
|
||||
renderer: &webViewRenderer{},
|
||||
ipc: newIPCManager(),
|
||||
bindingManager: newBindingManager(),
|
||||
eventManager: newEventManager(),
|
||||
log: newCustomLogger("App"),
|
||||
}
|
||||
|
||||
appconfig, err := newAppConfig(userConfig)
|
||||
if err != nil {
|
||||
result.log.Fatalf("Cannot use custom HTML: %s", err.Error())
|
||||
}
|
||||
result.config = appconfig
|
||||
|
||||
// Set up the CLI if not in release mode
|
||||
if BuildMode != cmd.BuildModeProd {
|
||||
result.cli = result.setupCli()
|
||||
} else {
|
||||
// Disable Inspector in release mode
|
||||
result.config.DisableInspector = true
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
// Run the app
|
||||
func (a *App) Run() error {
|
||||
if BuildMode != cmd.BuildModeProd {
|
||||
return a.cli.Run()
|
||||
}
|
||||
|
||||
a.logLevel = "error"
|
||||
return a.start()
|
||||
}
|
||||
|
||||
func (a *App) start() error {
|
||||
|
||||
// Set the log level
|
||||
setLogLevel(a.logLevel)
|
||||
|
||||
// Log starup
|
||||
a.log.Info("Starting")
|
||||
|
||||
// Check if we are to run in headless mode
|
||||
if BuildMode == cmd.BuildModeBridge {
|
||||
a.renderer = &Headless{}
|
||||
}
|
||||
|
||||
// Initialise the renderer
|
||||
err := a.renderer.Initialise(a.config, a.ipc, a.eventManager)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Start event manager and give it our renderer
|
||||
a.eventManager.start(a.renderer)
|
||||
|
||||
// Start the IPC Manager and give it the event manager and binding manager
|
||||
a.ipc.start(a.eventManager, a.bindingManager)
|
||||
|
||||
// Create the runtime
|
||||
a.runtime = newRuntime(a.eventManager, a.renderer)
|
||||
|
||||
// Start binding manager and give it our renderer
|
||||
err = a.bindingManager.start(a.renderer, a.runtime)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Inject CSS
|
||||
a.renderer.AddCSSList(a.cssCache)
|
||||
|
||||
// Inject JS
|
||||
a.renderer.AddJSList(a.jsCache)
|
||||
|
||||
// Run the renderer
|
||||
a.renderer.Run()
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// Bind allows the user to bind the given object
|
||||
// with the application
|
||||
func (a *App) Bind(object interface{}) {
|
||||
a.bindingManager.bind(object)
|
||||
}
|
||||
|
||||
// AddJS adds a piece of Javascript to a cache that
|
||||
// gets injected at runtime
|
||||
func (a *App) AddJS(js string) {
|
||||
a.jsCache = append(a.jsCache, js)
|
||||
}
|
||||
|
||||
// AddCSS adds a CSS string to a cache that
|
||||
// gets injected at runtime
|
||||
func (a *App) AddCSS(js string) {
|
||||
a.cssCache = append(a.cssCache, js)
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user