Compare commits
3 Commits
patch-1
...
feature/v2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
480dcb7895 | ||
|
|
c8d89cf002 | ||
|
|
fc669ede37 |
12
.github/FUNDING.yml
vendored
@@ -1,12 +0,0 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: [ leaanthony ]
|
||||
patreon: # Replace with a single Patreon username
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
|
||||
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
|
||||
liberapay: # Replace with a single Liberapay username
|
||||
issuehunt: # Replace with a single IssueHunt username
|
||||
otechie: # Replace with a single Otechie username
|
||||
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
|
||||
4
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@@ -8,7 +8,7 @@ assignees: ''
|
||||
---
|
||||
|
||||
#####################################################
|
||||
**V1 users: If you have a technical issue, please do not open a bug this way!**
|
||||
**If you have a technical issue, please do not open a bug this way!**
|
||||
Please use the `wails issue` command!
|
||||
If you do not do this then the issue may be closed automatically.
|
||||
|
||||
@@ -33,7 +33,7 @@ A clear and concise description of what you expected to happen.
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
**System Details**
|
||||
V2 users: Please add the output of `wails doctor`.
|
||||
Please provide your platform, GO version and variables, etc
|
||||
|
||||
**Additional context**
|
||||
Add any other context about the problem here.
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
name: Deploy mirror | 部署镜像
|
||||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
# pull_request:
|
||||
# branches: [ main ]
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
name: Automatic deployment | 自动部署
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository == 'misitebao/wails'
|
||||
|
||||
steps:
|
||||
- name: Checkout | 切换到部署分支
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
ref: "master"
|
||||
submodules: true
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Build Site | 构建网站
|
||||
run: |
|
||||
cd website &&
|
||||
npm install && npm run build
|
||||
|
||||
- name: Deploy to Server | 部署到服务器
|
||||
uses: hengkx/ssh-deploy@v1.0.1
|
||||
with:
|
||||
HOST: ${{ secrets.DEPLOY_HOST }}
|
||||
USERNAME: ${{ secrets.DEPLOY_HOST_USER }}
|
||||
PASSWORD: ${{ secrets.DEPLOY_HOST_PASSWORD }}
|
||||
SOURCE: "website/build"
|
||||
TARGET: "/www/wwwroot/wails.top"
|
||||
8
.github/workflows/latest-pre.yml
vendored
@@ -1,10 +1,8 @@
|
||||
name: latest pre-release
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
tags:
|
||||
- '**-pre**'
|
||||
- '**-pre**'
|
||||
jobs:
|
||||
|
||||
build:
|
||||
@@ -15,10 +13,10 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.16
|
||||
- name: Set up Go 1.13
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.16
|
||||
go-version: 1.13
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
|
||||
6
.github/workflows/pr.yml
vendored
@@ -13,10 +13,10 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.16
|
||||
- name: Set up Go 1.13
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.16
|
||||
go-version: 1.13
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
@@ -29,4 +29,4 @@ jobs:
|
||||
run: go build -v ./cmd/wails
|
||||
|
||||
- name: Test
|
||||
run: ./wails version
|
||||
run: ./wails version
|
||||
6
.github/workflows/release.yml
vendored
@@ -15,10 +15,10 @@ jobs:
|
||||
os: [ubuntu-latest, windows-latest, macOS-latest]
|
||||
steps:
|
||||
|
||||
- name: Set up Go 1.16
|
||||
- name: Set up Go 1.13
|
||||
uses: actions/setup-go@v1
|
||||
with:
|
||||
go-version: 1.16
|
||||
go-version: 1.13
|
||||
id: go
|
||||
|
||||
- name: Check out code into the Go module directory
|
||||
@@ -31,4 +31,4 @@ jobs:
|
||||
run: go build -v ./cmd/wails
|
||||
|
||||
- name: Test
|
||||
run: ./wails version
|
||||
run: ./wails version
|
||||
29
.github/workflows/runtime.yml
vendored
@@ -1,29 +0,0 @@
|
||||
name: Runtime
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- v2-alpha
|
||||
paths:
|
||||
- 'v2/internal/frontend/runtime/**'
|
||||
jobs:
|
||||
rebuild-runtime:
|
||||
name: Rebuild the runtime
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 14.17.6
|
||||
cache: 'npm'
|
||||
cache-dependency-path: v2/internal/frontend/runtime/package-lock.json
|
||||
- run: npm install
|
||||
working-directory: v2/internal/frontend/runtime
|
||||
- run: npm run build
|
||||
working-directory: v2/internal/frontend/runtime
|
||||
|
||||
- name: Commit changes
|
||||
uses: devops-infra/action-commit-push@master
|
||||
with:
|
||||
github_token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
commit_prefix: "[AUTO]"
|
||||
commit_message: "The runtime was rebuilt"
|
||||
4
.gitignore
vendored
@@ -27,7 +27,3 @@ v2/pkg/parser/testproject/frontend/wails
|
||||
v2/test/kitchensink/frontend/public
|
||||
v2/test/kitchensink/build/darwin/desktop/kitchensink
|
||||
v2/test/kitchensink/frontend/package.json.md5
|
||||
/v2/internal/ffenestri/windows/test/cmake-build-debug/
|
||||
!v2/internal/ffenestri/windows/x64/webview2.dll
|
||||
!v2/internal/ffenestri/windows/x64/WebView2Loader.dll
|
||||
.idea/
|
||||
|
||||
@@ -31,18 +31,13 @@ Wails is what it is because of the time and effort given by these great people.
|
||||
* [Christopher Murphy](https://github.com/Splode)
|
||||
* [Zámbó, Levente](https://github.com/Lyimmi)
|
||||
* [artem](https://github.com/Unix4ever)
|
||||
* [Tim Kipp](https://github.com/timkippdev)
|
||||
* [Dmitry Gomzyakov](https://github.com/kyoto44)
|
||||
* [Arthur Wiebe](https://github.com/artooro)
|
||||
* [Ilgıt Yıldırım](https://github.com/ilgityildirim)
|
||||
* [Altynbek](https://github.com/gelleson)
|
||||
* [Kyle](https://github.com/kmuchmore)
|
||||
* [Balakrishna Prasad Ganne](https://github.com/aayush420)
|
||||
* [Charaf Rezrazi](https://github.com/Rezrazi)
|
||||
* [misitebao](https://github.com/misitebao)
|
||||
* [Elie Grenon](https://github.com/DrunkenPoney)
|
||||
* [SophieAu](https://github.com/SophieAu)
|
||||
* [Alexander Matviychuk](https://github.com/alexmat)
|
||||
* [RH12503](https://github.com/RH12503)
|
||||
* [hi019](https://github.com/hi019)
|
||||
* [Igor Minen](https://github.com/Igogrek)
|
||||
* [Tim Kipp](https://github.com/timkippdev)
|
||||
* [Dmitry Gomzyakov](https://github.com/kyoto44)
|
||||
* [Arthur Wiebe](https://github.com/artooro)
|
||||
* [Ilgıt Yıldırım](https://github.com/ilgityildirim)
|
||||
* [Altynbek](https://github.com/gelleson)
|
||||
* [Kyle](https://github.com/kmuchmore)
|
||||
* [Balakrishna Prasad Ganne](https://github.com/aayush420)
|
||||
* [Charaf Rezrazi](https://github.com/Rezrazi)
|
||||
* [misitebao](https://github.com/misitebao)
|
||||
* [Elie Grenon](https://github.com/DrunkenPoney)
|
||||
366
README.md
@@ -1,96 +1,26 @@
|
||||
<p align="center" style="text-align: center">
|
||||
<img src="logo.png" width="55%"><br/>
|
||||
<img src="logo_cropped.png" width="40%"><br/>
|
||||
</p>
|
||||
<p align="center">
|
||||
Build desktop applications using Go & Web Technologies.<br/><br/>
|
||||
<a href="https://github.com/wailsapp/wails/blob/master/LICENSE">
|
||||
<img src="https://img.shields.io/badge/License-MIT-blue.svg">
|
||||
</a>
|
||||
<a href="https://goreportcard.com/report/github.com/wailsapp/wails">
|
||||
<img src="https://goreportcard.com/badge/github.com/wailsapp/wails"/>
|
||||
</a>
|
||||
<a href="http://godoc.org/github.com/wailsapp/wails">
|
||||
<img src="https://img.shields.io/badge/godoc-reference-blue.svg"/>
|
||||
</a>
|
||||
<a href="https://www.codefactor.io/repository/github/wailsapp/wails">
|
||||
<img src="https://www.codefactor.io/repository/github/wailsapp/wails/badge" alt="CodeFactor" />
|
||||
</a>
|
||||
<a href="https://github.com/wailsapp/wails/issues">
|
||||
<img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="CodeFactor" />
|
||||
</a>
|
||||
<a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fwailsapp%2Fwails?ref=badge_shield" alt="FOSSA Status">
|
||||
<img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fwailsapp%2Fwails.svg?type=shield"/>
|
||||
</a>
|
||||
<a href="https://houndci.com">
|
||||
<img src="https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg"/>
|
||||
</a>
|
||||
<a href="https://github.com/avelino/awesome-go" rel="nofollow">
|
||||
<img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome"/>
|
||||
</a>
|
||||
<a href="https://github.com/wailsapp/wails/workflows/release/badge.svg?branch=master" rel="nofollow">
|
||||
<img src="https://github.com/wailsapp/wails/workflows/release/badge.svg?branch=master" alt="Release Pipelines"/>
|
||||
</a>
|
||||
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>
|
||||
<a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fwailsapp%2Fwails?ref=badge_shield" alt="FOSSA Status"><img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fwailsapp%2Fwails.svg?type=shield"/></a>
|
||||
<a href="https://houndci.com"><img src="https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg"/></a>
|
||||
<a href="https://github.com/avelino/awesome-go" rel="nofollow"><img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome"></a>
|
||||
<a href="https://github.com/wailsapp/wails/workflows/release/badge.svg?branch=master" rel="nofollow"><img src="https://github.com/wailsapp/wails/workflows/release/badge.svg?branch=master" alt="Release Pipelines"></a>
|
||||
</p>
|
||||
|
||||
<span id="nav-1"></span>
|
||||
|
||||
## Internationalization
|
||||
|
||||
[English](README.md) | [简体中文](README.zh-Hans.md)
|
||||
|
||||
<span id="nav-2"></span>
|
||||
|
||||
## Table of Contents
|
||||
|
||||
<details>
|
||||
<summary>Click me to Open/Close the directory listing</summary>
|
||||
|
||||
- [1. Internationalization](#nav-1)
|
||||
- [2. Table of Contents](#nav-2)
|
||||
- [3. Introduction](#nav-3)
|
||||
- [3.1 Official Website](#nav-3-1)
|
||||
- [4. Features](#nav-4)
|
||||
- [5. Sponsors](#nav-5)
|
||||
- [6. Installation](#nav-6)
|
||||
- [6.1 MacOS](#nav-6-1)
|
||||
- [6.2 Linux](#nav-6-2)
|
||||
- [6.2.1 Debian/Ubuntu](#nav-6-2-1)
|
||||
- [6.2.2 Arch Linux / ArchLabs / Ctlos Linux](#nav-6-2-2)
|
||||
- [6.2.3 Centos](#nav-6-2-3)
|
||||
- [6.2.4 Fedora](#nav-6-2-4)
|
||||
- [6.2.5 VoidLinux & VoidLinux-musl](#nav-6-2-5)
|
||||
- [6.2.6 Gentoo](#nav-6-2-6)
|
||||
- [6.3 Windows](#nav-6-3)
|
||||
- [7. Usage](#nav-7)
|
||||
- [7.1 Next Steps](#nav-7-1)
|
||||
- [8. FAQ](#nav-8)
|
||||
- [9. Contributors](#nav-9)
|
||||
- [10. Special Mentions](#nav-10)
|
||||
- [12. Special Thanks](#nav-11)
|
||||
|
||||
</details>
|
||||
|
||||
<span id="nav-3"></span>
|
||||
|
||||
## Introductions
|
||||
|
||||
The traditional method of providing web interfaces to Go programs is via a built-in web server. Wails offers a different
|
||||
approach: it provides the ability to wrap both Go code and a web frontend into a single binary. Tools are provided to
|
||||
make this easy for you by handling project creation, compilation and bundling. All you have to do is get creative!
|
||||
|
||||
<span id="nav-3-1"></span>
|
||||
|
||||
### Official Website
|
||||
The 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).
|
||||
|
||||
Click [here](https://wails.io) if you are interested in trying out v2 Beta for Windows.
|
||||
|
||||
<span id="nav-4"></span>
|
||||
|
||||
## Features
|
||||
|
||||
- Use standard Go for the backend
|
||||
- Use standard Go libraries/frameworks for the backend
|
||||
- Use any frontend technology to build your UI
|
||||
- Quickly create Vue, Vuetify or React frontends for your Go programs
|
||||
- Expose Go methods/functions to the frontend via a single bind command
|
||||
@@ -100,135 +30,22 @@ Click [here](https://wails.io) if you are interested in trying out v2 Beta for W
|
||||
- Powerful cli tool
|
||||
- Multiplatform
|
||||
|
||||
<span id="nav-5"></span>
|
||||
|
||||
## Sponsors
|
||||
|
||||
This project is supported by these kind people / companies:
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.easywebadv.it/" style="width:150px;">
|
||||
<img src="website/static/img/easyweb.png" width="150"/>
|
||||
</a>
|
||||
</p>
|
||||
<br/>
|
||||
<br/>
|
||||
<a href="https://github.com/sponsors/leaanthony" style="width:100px;">
|
||||
<img src="sponsors/silver%20sponsor.png" width="100"/>
|
||||
</a>
|
||||
<a href="https://github.com/letheanVPN" style="width:100px;">
|
||||
<img src="https://github.com/letheanVPN.png?size=100" width="100"/>
|
||||
</a>
|
||||
<br/>
|
||||
<br/>
|
||||
<a href="https://github.com/sponsors/leaanthony" style="width:100px;">
|
||||
<img src="sponsors/bronze%20sponsor.png" width="100"/>
|
||||
</a>
|
||||
<a href="https://github.com/snider" style="width:100px;">
|
||||
<img src="https://github.com/snider.png?size=100" width="100"/>
|
||||
</a>
|
||||
<a href="https://github.com/codydbentley" style="width:100px">
|
||||
<img src="https://github.com/codydbentley.png?size=100" width="100"/>
|
||||
</a>
|
||||
<a href="https://github.com/CrackDavid" style="width:100px">
|
||||
<img src="https://github.com/CrackDavid.png?size=100" width="100"/>
|
||||
</a>
|
||||
<br/>
|
||||
<br/>
|
||||
<a href="https://github.com/matryer" style="width:100px">
|
||||
<img src="https://github.com/matryer.png" width="100"/>
|
||||
</a>
|
||||
<a href="https://www.jetbrains.com?from=Wails" style="width:100px">
|
||||
<img src="/assets/images/jetbrains-grayscale.png" width="100"/>
|
||||
</a>
|
||||
<a href="https://github.com/tc-hib" style="width:55px">
|
||||
<img src="https://github.com/tc-hib.png?size=55" width="55"/>
|
||||
</a>
|
||||
<a href="https://github.com/picatz" style="width:50px">
|
||||
<img src="https://github.com/picatz.png?size=50" width="50"/>
|
||||
</a>
|
||||
<a href="https://github.com/tylertravisty" style="width:50px">
|
||||
<img src="https://github.com/tylertravisty.png?size=50" width="50"/>
|
||||
</a>
|
||||
<a href="https://github.com/akhudek" style="width:50px">
|
||||
<img src="https://github.com/akhudek.png?size=50" width="50"/>
|
||||
</a>
|
||||
<a href="https://github.com/trea" style="width:50px">
|
||||
<img src="https://github.com/trea.png?size=50" width="50"/>
|
||||
</a>
|
||||
<a href="https://github.com/LanguageAgnostic" style="width:55px">
|
||||
<img src="https://github.com/LanguageAgnostic.png?size=55" width="55"/>
|
||||
</a>
|
||||
<a href="https://github.com/fcjr" style="width:55px">
|
||||
<img src="https://github.com/fcjr.png?size=55" width="55"/>
|
||||
</a>
|
||||
<a href="https://github.com/nickarellano" style="width:60px">
|
||||
<img src="https://github.com/nickarellano.png?size=60" width="60"/>
|
||||
</a>
|
||||
<a href="https://github.com/bglw" style="width:65px">
|
||||
<img src="https://github.com/bglw.png?size=65" width="65"/>
|
||||
</a>
|
||||
<a href="https://github.com/jugglingjsons" style="width:50px">
|
||||
<img src="https://github.com/jugglingjsons.png?size=50" width="50"/>
|
||||
</a>
|
||||
<a href="https://github.com/marcus-crane" style="width:65px">
|
||||
<img src="https://github.com/marcus-crane.png?size=65" width="65"/>
|
||||
</a>
|
||||
<a href="https://github.com/bbergshaven" style="width:45px">
|
||||
<img src="https://github.com/bbergshaven.png?size=45" width="45"/>
|
||||
</a>
|
||||
<a href="https://github.com/Gilgames000" style="width:45px">
|
||||
<img src="https://github.com/Gilgames000.png?size=45" width="45"/>
|
||||
</a>
|
||||
<a href="https://github.com/ilgityildirim" style="width:50px">
|
||||
<img src="https://github.com/ilgityildirim.png?size=50" width="50"/>
|
||||
</a>
|
||||
<a href="https://github.com/questrail" style="width:50px">
|
||||
<img src="https://github.com/questrail.png?size=50" width="50"/>
|
||||
</a>
|
||||
<a href="https://github.com/DonTomato" style="width:45px">
|
||||
<img src="https://github.com/DonTomato.png?size=45" width="45"/>
|
||||
</a>
|
||||
<a href="https://github.com/taigrr" style="width:45px">
|
||||
<img src="https://github.com/taigrr.png?size=45" width="45"/>
|
||||
</a>
|
||||
<a href="https://github.com/charlie-dee" style="width:55px">
|
||||
<img src="https://github.com/charlie-dee.png?size=55" width="55"/>
|
||||
</a>
|
||||
<a href="https://github.com/EdenNetworkItalia" style="width:65px">
|
||||
<img src="https://github.com/EdenNetworkItalia.png?size=65" width="65"/>
|
||||
</a>
|
||||
<a href="https://github.com/michaelolson1996" style="width:55px">
|
||||
<img src="https://github.com/michaelolson1996.png?size=55" width="55"/>
|
||||
</a>
|
||||
<a href="https://github.com/GargantuaX" style="width:45px">
|
||||
<img src="https://github.com/GargantuaX.png?size=45" width="45"/>
|
||||
</a>
|
||||
|
||||
<span id="nav-6"></span>
|
||||
|
||||
## 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:
|
||||
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.16
|
||||
- Go 1.13
|
||||
- npm
|
||||
|
||||
<span id="nav-6-1"></span>
|
||||
|
||||
### MacOS
|
||||
|
||||
Make sure you have the xcode command line tools installed. This can be done by running:
|
||||
|
||||
`xcode-select --install`
|
||||
|
||||
<span id="nav-6-2"></span>
|
||||
|
||||
### Linux
|
||||
|
||||
<span id="nav-6-2-1"></span>
|
||||
|
||||
#### Debian/Ubuntu
|
||||
|
||||
`sudo apt install libgtk-3-dev libwebkit2gtk-4.0-dev`
|
||||
@@ -237,9 +54,7 @@ _Debian: 8, 9, 10_
|
||||
|
||||
_Ubuntu: 16.04, 18.04, 19.04_
|
||||
|
||||
_Also succesfully tested on: Zorin 15, Parrot 4.7, Linuxmint 19, Elementary 5, Kali, Neon_, Pop!\_OS
|
||||
|
||||
<span id="nav-6-2-2"></span>
|
||||
_Also succesfully tested on: Zorin 15, Parrot 4.7, Linuxmint 19, Elementary 5, Kali, Neon_, Pop!_OS
|
||||
|
||||
#### Arch Linux / ArchLabs / Ctlos Linux
|
||||
|
||||
@@ -247,173 +62,100 @@ _Also succesfully tested on: Zorin 15, Parrot 4.7, Linuxmint 19, Elementary 5, K
|
||||
|
||||
_Also succesfully test on: Manjaro & ArcoLinux_
|
||||
|
||||
<span id="nav-6-2-3"></span>
|
||||
|
||||
#### Centos
|
||||
|
||||
`sudo yum install webkitgtk3-devel gtk3-devel`
|
||||
|
||||
_CentOS 6, 7_
|
||||
|
||||
<span id="nav-6-2-4"></span>
|
||||
|
||||
#### Fedora
|
||||
|
||||
`sudo yum install webkit2gtk3-devel gtk3-devel`
|
||||
|
||||
_Fedora 29, 30_
|
||||
|
||||
<span id="nav-6-2-5"></span>
|
||||
|
||||
#### VoidLinux & VoidLinux-musl
|
||||
|
||||
`xbps-install gtk+3-devel webkit2gtk-devel`
|
||||
|
||||
<span id="nav-6-2-6"></span>
|
||||
|
||||
#### Gentoo
|
||||
|
||||
`sudo emerge gtk+:3 webkit-gtk`
|
||||
|
||||
<span id="nav-6-3"></span>
|
||||
|
||||
### 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.
|
||||
Windows requires gcc and related tooling. The recommended download is from [http://tdm-gcc.tdragon.net/download](http://tdm-gcc.tdragon.net/download). Once this is installed, you are good to go.
|
||||
|
||||
<span id="nav-7"></span>
|
||||
|
||||
## Usage
|
||||
## Installation
|
||||
|
||||
**Ensure Go modules are enabled: GO111MODULE=on and go/bin is in your PATH variable.**
|
||||
|
||||
Installation is as simple as running the following command:
|
||||
|
||||
```
|
||||
<pre style='color:white'>
|
||||
go get -u github.com/wailsapp/wails/cmd/wails
|
||||
```
|
||||
</pre>
|
||||
|
||||
<span id="nav-7-1"></span>
|
||||
|
||||
### Next Steps
|
||||
## Next Steps
|
||||
|
||||
It is recommended at this stage to read the comprehensive documentation at [https://wails.app](https://wails.app).
|
||||
|
||||
<span id="nav-8"></span>
|
||||
|
||||
## FAQ
|
||||
|
||||
- Is this an alternative to Electron?
|
||||
* 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.
|
||||
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?
|
||||
* Who is this project aimed at?
|
||||
|
||||
Go programmers who want to bundle an HTML/JS/CSS frontend with their applications, without resorting to creating a
|
||||
server and opening a browser to view it.
|
||||
Go programmers who want to bundle an HTML/JS/CSS frontend with their applications, without resorting to creating a server and opening a browser to view it.
|
||||
|
||||
- What's with the name?
|
||||
* What's with the name?
|
||||
|
||||
When I saw WebView, I thought "What I really want is tooling around building a WebView app, a bit like Rails is to
|
||||
Ruby". So initially it was a play on words (Webview on Rails). It just so happened to also be a homophone of the
|
||||
English name for the [Country](https://en.wikipedia.org/wiki/Wales) I am from. So it stuck.
|
||||
When I saw WebView, I thought "What I really want is tooling around building a WebView app, a bit like Rails is to Ruby". So initially it was a play on words (Webview on Rails). It just so happened to also be a homophone of the English name for the [Country](https://en.wikipedia.org/wiki/Wales) I am from. So it stuck.
|
||||
|
||||
<span id="nav-9"></span>
|
||||
|
||||
## Contributors
|
||||
|
||||
<a href="https://github.com/qaisjp"><img src="https://github.com/qaisjp.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/alee792"><img src="https://github.com/alee792.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/lanzafame"><img src="https://github.com/lanzafame.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/mattn"><img src="https://github.com/mattn.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/0xflotus"><img src="https://github.com/0xflotus.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/mdhender"><img src="https://github.com/mdhender.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/fishfishfish2104"><img src="https://github.com/fishfishfish2104.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/intelwalk"><img src="https://github.com/intelwalk.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/ocelotsloth"><img src="https://github.com/ocelotsloth.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/bh90210"><img src="https://github.com/bh90210.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/iceleo-com"><img src="https://github.com/iceleo-com.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/fallendusk"><img src="https://github.com/fallendusk.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Chronophylos"><img src="https://github.com/Chronophylos.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Vaelatern"><img src="https://github.com/Vaelatern.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/mewmew"><img src="https://github.com/mewmew.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/kraney"><img src="https://github.com/kraney.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/JackMordaunt"><img src="https://github.com/JackMordaunt.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/MichaelHipp"><img src="https://github.com/MichaelHipp.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/tmclane"><img src="https://github.com/tmclane.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Rested"><img src="https://github.com/Rested.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Jarek-SRT"><img src="https://github.com/Jarek-SRT.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/konez2k"><img src="https://github.com/konez2k.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/sayuthisobri"><img src="https://github.com/sayuthisobri.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/dedo1911"><img src="https://github.com/dedo1911.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/fdidron"><img src="https://github.com/fdidron.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Splode"><img src="https://github.com/Splode.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Lyimmi"><img src="https://github.com/Lyimmi.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Unix4ever"><img src="https://github.com/Unix4ever.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/timkippdev"><img src="https://github.com/timkippdev.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/kyoto44"><img src="https://github.com/kyoto44.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/artooro"><img src="https://github.com/artooro.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/ilgityildirim"><img src="https://github.com/ilgityildirim.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/gelleson"><img src="https://github.com/gelleson.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/kmuchmore"><img src="https://github.com/kmuchmore.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/aayush420"><img src="https://github.com/aayush420.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Rezrazi"><img src="https://github.com/Rezrazi.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/misitebao"><img src="https://github.com/misitebao.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/DrunkenPoney"><img src="https://github.com/DrunkenPoney.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/SophieAu"><img src="https://github.com/SophieAu.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/alexmat"><img src="https://github.com/alexmat.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/RH12503"><img src="https://github.com/RH12503.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/hi019"><img src="https://github.com/hi019.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Igogrek"><img src="https://github.com/Igogrek.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/aschey"><img src="https://github.com/aschey.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/akhudek"><img src="https://github.com/akhudek.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/s12chung"><img src="https://github.com/s12chung.png?size=40" width="40"/></a>
|
||||
|
||||
<span id="nav-10"></span>
|
||||
|
||||
## Special Mentions
|
||||
## 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 (Not long now Dustin!).
|
||||
- [Serge Zaitsev](https://github.com/zserge) - Creator of [Webview](https://github.com/zserge/webview) which Wails uses
|
||||
for the windowing.
|
||||
- [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.
|
||||
* [Dustin Krysak](https://wiki.ubuntu.com/bashfulrobot) - His support and feedback has been immense. More patience than you can throw a stick at (Not long now Dustin!).
|
||||
* [Serge Zaitsev](https://github.com/zserge) - Creator of [Webview](https://github.com/zserge/webview) which Wails uses for the windowing.
|
||||
|
||||
And without [these people](CONTRIBUTORS.md), it wouldn't be what it is today. A huge thank you to each and every one of you!
|
||||
|
||||
Special Mentions:
|
||||
|
||||
* [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.
|
||||
|
||||
This project was mainly coded to the following albums:
|
||||
|
||||
- [Manic Street Preachers - Resistance Is Futile](https://open.spotify.com/album/1R2rsEUqXjIvAbzM0yHrxA)
|
||||
- [Manic Street Preachers - This Is My Truth, Tell Me Yours](https://open.spotify.com/album/4VzCL9kjhgGQeKCiojK1YN)
|
||||
- [The Midnight - Endless Summer](https://open.spotify.com/album/4Krg8zvprquh7TVn9OxZn8)
|
||||
- [Gary Newman - Savage (Songs from a Broken World)](https://open.spotify.com/album/3kMfsD07Q32HRWKRrpcexr)
|
||||
- [Steve Vai - Passion & Warfare](https://open.spotify.com/album/0oL0OhrE2rYVns4IGj8h2m)
|
||||
- [Ben Howard - Every Kingdom](https://open.spotify.com/album/1nJsbWm3Yy2DW1KIc1OKle)
|
||||
- [Ben Howard - Noonday Dream](https://open.spotify.com/album/6astw05cTiXEc2OvyByaPs)
|
||||
- [Adwaith - Melyn](https://open.spotify.com/album/2vBE40Rp60tl7rNqIZjaXM)
|
||||
- [Gwidaith Hen Fran - Cedors Hen Wrach](https://open.spotify.com/album/3v2hrfNGINPLuDP0YDTOjm)
|
||||
- [Metallica - Metallica](https://open.spotify.com/album/2Kh43m04B1UkVcpcRa1Zug)
|
||||
- [Bloc Party - Silent Alarm](https://open.spotify.com/album/6SsIdN05HQg2GwYLfXuzLB)
|
||||
- [Maxthor - Another World](https://open.spotify.com/album/3tklE2Fgw1hCIUstIwPBJF)
|
||||
- [Alun Tan Lan - Y Distawrwydd](https://open.spotify.com/album/0c32OywcLpdJCWWMC6vB8v)
|
||||
* [Manic Street Preachers - Resistance Is Futile](https://open.spotify.com/album/1R2rsEUqXjIvAbzM0yHrxA)
|
||||
* [Manic Street Preachers - This Is My Truth, Tell Me Yours](https://open.spotify.com/album/4VzCL9kjhgGQeKCiojK1YN)
|
||||
* [The Midnight - Endless Summer](https://open.spotify.com/album/4Krg8zvprquh7TVn9OxZn8)
|
||||
* [Gary Newman - Savage (Songs from a Broken World)](https://open.spotify.com/album/3kMfsD07Q32HRWKRrpcexr)
|
||||
* [Steve Vai - Passion & Warfare](https://open.spotify.com/album/0oL0OhrE2rYVns4IGj8h2m)
|
||||
* [Ben Howard - Every Kingdom](https://open.spotify.com/album/1nJsbWm3Yy2DW1KIc1OKle)
|
||||
* [Ben Howard - Noonday Dream](https://open.spotify.com/album/6astw05cTiXEc2OvyByaPs)
|
||||
* [Adwaith - Melyn](https://open.spotify.com/album/2vBE40Rp60tl7rNqIZjaXM)
|
||||
* [Gwidaith Hen Fran - Cedors Hen Wrach](https://open.spotify.com/album/3v2hrfNGINPLuDP0YDTOjm)
|
||||
* [Metallica - Metallica](https://open.spotify.com/album/2Kh43m04B1UkVcpcRa1Zug)
|
||||
* [Bloc Party - Silent Alarm](https://open.spotify.com/album/6SsIdN05HQg2GwYLfXuzLB)
|
||||
* [Maxthor - Another World](https://open.spotify.com/album/3tklE2Fgw1hCIUstIwPBJF)
|
||||
* [Alun Tan Lan - Y Distawrwydd](https://open.spotify.com/album/0c32OywcLpdJCWWMC6vB8v)
|
||||
|
||||
<span id="nav-11"></span>
|
||||
## Licensing
|
||||
|
||||
[](https://app.fossa.io/projects/git%2Bgithub.com%2Fwailsapp%2Fwails?ref=badge_large)
|
||||
|
||||
## Special Thanks
|
||||
|
||||
<p align="center" style="text-align: center">
|
||||
<a href="https://pace.dev"><img src="/assets/images/pace.jpeg"/></a><br/>
|
||||
A <i>huge</i> thanks to <a href="https://pace.dev">Pace</a> for sponsoring the project and helping the efforts to get Wails ported to Apple Silicon!<br/><br/>
|
||||
A *huge* thanks to <a href="https://pace.dev"><img src="pace.jpeg"/> Pace</a> for sponsoring the project and helping the efforts to get Wails ported to Apple Silicon!<br/><br/>
|
||||
If you are looking for a Project Management tool that's powerful but quick and easy to use, check them out!<br/><br/>
|
||||
</p>
|
||||
|
||||
<p align="center" style="text-align: center">
|
||||
A special thank you to JetBrains for donating licenses to us!<br/><br/>
|
||||
Please click the logo to let them know your appreciation!<br/><br/>
|
||||
<a href="https://www.jetbrains.com?from=Wails"><img src="/assets/images/jetbrains-grayscale.png" width="30%"></a>
|
||||
<a href="https://www.jetbrains.com?from=Wails"><img src="jetbrains-grayscale.png" width="30%"></a>
|
||||
</p>
|
||||
|
||||
@@ -1,412 +0,0 @@
|
||||
<p align="center" style="text-align: center">
|
||||
<img src="logo.png" width="55%"><br/>
|
||||
</p>
|
||||
<p align="center">
|
||||
使用 Go 和 Web 技术构建桌面应用程序。<br/><br/>
|
||||
<a href="https://github.com/wailsapp/wails/blob/master/LICENSE">
|
||||
<img src="https://img.shields.io/badge/License-MIT-blue.svg">
|
||||
</a>
|
||||
<a href="https://goreportcard.com/report/github.com/wailsapp/wails">
|
||||
<img src="https://goreportcard.com/badge/github.com/wailsapp/wails"/>
|
||||
</a>
|
||||
<a href="http://godoc.org/github.com/wailsapp/wails">
|
||||
<img src="https://img.shields.io/badge/godoc-reference-blue.svg"/>
|
||||
</a>
|
||||
<a href="https://www.codefactor.io/repository/github/wailsapp/wails">
|
||||
<img src="https://www.codefactor.io/repository/github/wailsapp/wails/badge" alt="CodeFactor" />
|
||||
</a>
|
||||
<a href="https://github.com/wailsapp/wails/issues">
|
||||
<img src="https://img.shields.io/badge/contributions-welcome-brightgreen.svg?style=flat" alt="CodeFactor" />
|
||||
</a>
|
||||
<a href="https://app.fossa.io/projects/git%2Bgithub.com%2Fwailsapp%2Fwails?ref=badge_shield" alt="FOSSA Status">
|
||||
<img src="https://app.fossa.io/api/projects/git%2Bgithub.com%2Fwailsapp%2Fwails.svg?type=shield"/>
|
||||
</a>
|
||||
<a href="https://houndci.com">
|
||||
<img src="https://img.shields.io/badge/Reviewed_by-Hound-8E64B0.svg"/>
|
||||
</a>
|
||||
<a href="https://github.com/avelino/awesome-go" rel="nofollow">
|
||||
<img src="https://cdn.rawgit.com/sindresorhus/awesome/d7305f38d29fed78fa85652e3a63e154dd8e8829/media/badge.svg" alt="Awesome"/>
|
||||
</a>
|
||||
<a href="https://github.com/wailsapp/wails/workflows/release/badge.svg?branch=master" rel="nofollow">
|
||||
<img src="https://github.com/wailsapp/wails/workflows/release/badge.svg?branch=master" alt="Release Pipelines"/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<span id="nav-1"></span>
|
||||
|
||||
## 国际化
|
||||
|
||||
[English](README.md) | [简体中文](README.zh-Hans.md)
|
||||
|
||||
<span id="nav-2"></span>
|
||||
|
||||
## 内容目录
|
||||
|
||||
<details>
|
||||
<summary>点我 打开/关闭 目录列表</summary>
|
||||
|
||||
- [1. 国际化](#nav-1)
|
||||
- [2. 内容目录](#nav-2)
|
||||
- [3. 项目介绍](#nav-3)
|
||||
- [3.1 官方网站](#nav-3-1)
|
||||
- [4. 功能](#nav-4)
|
||||
- [5. 赞助商](#nav-5)
|
||||
- [6. 安装](#nav-6)
|
||||
- [6.1 MacOS](#nav-6-1)
|
||||
- [6.2 Linux](#nav-6-2)
|
||||
- [6.2.1 Debian/Ubuntu](#nav-6-2-1)
|
||||
- [6.2.2 Arch Linux / ArchLabs / Ctlos Linux](#nav-6-2-2)
|
||||
- [6.2.3 Centos](#nav-6-2-3)
|
||||
- [6.2.4 Fedora](#nav-6-2-4)
|
||||
- [6.2.5 VoidLinux & VoidLinux-musl](#nav-6-2-5)
|
||||
- [6.2.6 Gentoo](#nav-6-2-6)
|
||||
- [6.3 Windows](#nav-6-3)
|
||||
- [7. 使用方法](#nav-7)
|
||||
- [7.1 下一步](#nav-7-1)
|
||||
- [8. 常见问题](#nav-8)
|
||||
- [9. 贡献者](#nav-9)
|
||||
- [10. 特别提及](#nav-10)
|
||||
- [12. 特别感谢](#nav-11)
|
||||
|
||||
</details>
|
||||
|
||||
<span id="nav-3"></span>
|
||||
|
||||
## 项目介绍
|
||||
|
||||
为 Go 程序提供 Web 界面的传统方法是通过内置 Web 服务器。Wails 提供了一种不同的方法:它提供了将 Go 代码和 Web
|
||||
前端一起打包成单个二进制文件的能力。通过提供的工具,可以很轻松的完成项目的创建、编译和打包。你所要做的就是发挥想象力!
|
||||
|
||||
<span id="nav-3-1"></span>
|
||||
|
||||
### 官方网站
|
||||
|
||||
官方文档可以在 [https://wails.app](https://wails.app) 中找到。
|
||||
|
||||
如果您对适用于 Windows 的 v2 测试版感兴趣,可以点击[此处](https://wails.io)查看。
|
||||
|
||||
镜像网站:
|
||||
|
||||
- [中国大陆镜像站点 - https://wails.top](https://wails.top)
|
||||
|
||||
<span id="nav-4"></span>
|
||||
|
||||
## 功能
|
||||
|
||||
- 后端使用标准 Go
|
||||
- 使用任意前端技术构建 UI 界面
|
||||
- 快速为您的 Go 应用生成 Vue、Vuetify、React 前端代码
|
||||
- 通过简单的绑定命令将 Go 方法暴露到前端
|
||||
- 使用原生渲染引擎 - 无嵌入式浏览器
|
||||
- 共享事件系统
|
||||
- 原生文件系统对话框
|
||||
- 强大的命令行工具
|
||||
- 跨多个平台
|
||||
|
||||
<span id="nav-5"></span>
|
||||
|
||||
## 赞助商
|
||||
|
||||
这个项目由以下这些人或者公司支持:
|
||||
|
||||
<p align="center">
|
||||
<a href="https://www.easywebadv.it/" style="width:100px;">
|
||||
<img src="website/static/img/easyweb.png" width="120"/>
|
||||
</a>
|
||||
</p>
|
||||
<br/>
|
||||
<br/>
|
||||
<a href="https://github.com/sponsors/leaanthony" style="width:100px;">
|
||||
<img src="sponsors/silver%20sponsor.png" width="100"/>
|
||||
</a>
|
||||
<a href="https://github.com/letheanVPN" style="width:100px;">
|
||||
<img src="https://github.com/letheanVPN.png?size=100" width="100"/>
|
||||
</a>
|
||||
<br/>
|
||||
<br/>
|
||||
<a href="https://github.com/sponsors/leaanthony" style="width:100px;">
|
||||
<img src="sponsors/bronze%20sponsor.png" width="100"/>
|
||||
</a>
|
||||
<a href="https://github.com/snider" style="width:100px;">
|
||||
<img src="https://github.com/snider.png?size=100" width="100"/>
|
||||
</a>
|
||||
<a href="https://github.com/codydbentley" style="width:100px">
|
||||
<img src="https://github.com/codydbentley.png?size=100" width="100"/>
|
||||
</a>
|
||||
<a href="https://github.com/CrackDavid" style="width:100px">
|
||||
<img src="https://github.com/CrackDavid.png?size=100" width="100"/>
|
||||
</a>
|
||||
<br/>
|
||||
<br/>
|
||||
<a href="https://github.com/matryer" style="width:100px">
|
||||
<img src="https://github.com/matryer.png" width="100"/>
|
||||
</a>
|
||||
<a href="https://www.jetbrains.com?from=Wails" style="width:100px">
|
||||
<img src="/assets/images/jetbrains-grayscale.png" width="100"/>
|
||||
</a>
|
||||
<a href="https://github.com/tc-hib" style="width:55px">
|
||||
<img src="https://github.com/tc-hib.png?size=55" width="55"/>
|
||||
</a>
|
||||
<a href="https://github.com/picatz" style="width:50px">
|
||||
<img src="https://github.com/picatz.png?size=50" width="50"/>
|
||||
</a>
|
||||
<a href="https://github.com/tylertravisty" style="width:50px">
|
||||
<img src="https://github.com/tylertravisty.png?size=50" width="50"/>
|
||||
</a>
|
||||
<a href="https://github.com/akhudek" style="width:50px">
|
||||
<img src="https://github.com/akhudek.png?size=50" width="50"/>
|
||||
</a>
|
||||
<a href="https://github.com/trea" style="width:50px">
|
||||
<img src="https://github.com/trea.png?size=50" width="50"/>
|
||||
</a>
|
||||
<a href="https://github.com/LanguageAgnostic" style="width:55px">
|
||||
<img src="https://github.com/LanguageAgnostic.png?size=55" width="55"/>
|
||||
</a>
|
||||
<a href="https://github.com/fcjr" style="width:55px">
|
||||
<img src="https://github.com/fcjr.png?size=55" width="55"/>
|
||||
</a>
|
||||
<a href="https://github.com/nickarellano" style="width:60px">
|
||||
<img src="https://github.com/nickarellano.png?size=60" width="60"/>
|
||||
</a>
|
||||
<a href="https://github.com/bglw" style="width:65px">
|
||||
<img src="https://github.com/bglw.png?size=65" width="65"/>
|
||||
</a>
|
||||
<a href="https://github.com/jugglingjsons" style="width:50px">
|
||||
<img src="https://github.com/jugglingjsons.png?size=50" width="50"/>
|
||||
</a>
|
||||
<a href="https://github.com/marcus-crane" style="width:65px">
|
||||
<img src="https://github.com/marcus-crane.png?size=65" width="65"/>
|
||||
</a>
|
||||
<a href="https://github.com/bbergshaven" style="width:45px">
|
||||
<img src="https://github.com/bbergshaven.png?size=45" width="45"/>
|
||||
</a>
|
||||
<a href="https://github.com/Gilgames000" style="width:45px">
|
||||
<img src="https://github.com/Gilgames000.png?size=45" width="45"/>
|
||||
</a>
|
||||
<a href="https://github.com/ilgityildirim" style="width:50px">
|
||||
<img src="https://github.com/ilgityildirim.png?size=50" width="50"/>
|
||||
</a>
|
||||
<a href="https://github.com/questrail" style="width:50px">
|
||||
<img src="https://github.com/questrail.png?size=50" width="50"/>
|
||||
</a>
|
||||
<a href="https://github.com/DonTomato" style="width:45px">
|
||||
<img src="https://github.com/DonTomato.png?size=45" width="45"/>
|
||||
</a>
|
||||
<a href="https://github.com/taigrr" style="width:45px">
|
||||
<img src="https://github.com/taigrr.png?size=45" width="45"/>
|
||||
</a>
|
||||
<a href="https://github.com/charlie-dee" style="width:55px">
|
||||
<img src="https://github.com/charlie-dee.png?size=55" width="55"/>
|
||||
</a>
|
||||
<a href="https://github.com/EdenNetworkItalia" style="width:65px">
|
||||
<img src="https://github.com/EdenNetworkItalia.png?size=65" width="65"/>
|
||||
</a>
|
||||
<a href="https://github.com/michaelolson1996" style="width:55px">
|
||||
<img src="https://github.com/michaelolson1996.png?size=55" width="55"/>
|
||||
</a>
|
||||
<a href="https://github.com/GargantuaX" style="width:45px">
|
||||
<img src="https://github.com/GargantuaX.png?size=45" width="45"/>
|
||||
</a>
|
||||
|
||||
<span id="nav-6"></span>
|
||||
|
||||
## 安装
|
||||
|
||||
Wails 使用 cgo 与原生渲染引擎结合,因此需要依赖一些平台的库以及 Go 的安装。基本要求是:
|
||||
|
||||
- Go 1.16
|
||||
- npm
|
||||
|
||||
<span id="nav-6-1"></span>
|
||||
|
||||
### MacOS
|
||||
|
||||
请确保已安装 xcode 命令行工具。这可以通过运行下面的命令来完成:
|
||||
|
||||
`xcode-select --install`
|
||||
|
||||
<span id="nav-6-2"></span>
|
||||
|
||||
### Linux
|
||||
|
||||
<span id="nav-6-2-1"></span>
|
||||
|
||||
#### Debian/Ubuntu
|
||||
|
||||
`sudo apt install libgtk-3-dev libwebkit2gtk-4.0-dev`
|
||||
|
||||
_Debian: 8, 9, 10_
|
||||
|
||||
_Ubuntu: 16.04, 18.04, 19.04_
|
||||
|
||||
_也成功测试了: Zorin 15, Parrot 4.7, Linuxmint 19, Elementary 5, Kali, Neon_, Pop!\_OS
|
||||
|
||||
<span id="nav-6-2-2"></span>
|
||||
|
||||
#### Arch Linux / ArchLabs / Ctlos Linux
|
||||
|
||||
`sudo pacman -S webkit2gtk gtk3`
|
||||
|
||||
_也成功测试了: Manjaro & ArcoLinux_
|
||||
|
||||
<span id="nav-6-2-3"></span>
|
||||
|
||||
#### Centos
|
||||
|
||||
`sudo yum install webkitgtk3-devel gtk3-devel`
|
||||
|
||||
_CentOS 6, 7_
|
||||
|
||||
<span id="nav-6-2-4"></span>
|
||||
|
||||
#### Fedora
|
||||
|
||||
`sudo yum install webkit2gtk3-devel gtk3-devel`
|
||||
|
||||
_Fedora 29, 30_
|
||||
|
||||
<span id="nav-6-2-5"></span>
|
||||
|
||||
#### VoidLinux & VoidLinux-musl
|
||||
|
||||
`xbps-install gtk+3-devel webkit2gtk-devel`
|
||||
|
||||
<span id="nav-6-2-6"></span>
|
||||
|
||||
#### Gentoo
|
||||
|
||||
`sudo emerge gtk+:3 webkit-gtk`
|
||||
|
||||
<span id="nav-6-3"></span>
|
||||
|
||||
### Windows
|
||||
|
||||
Windows 需要 GCC 和相关工具。 建议从 [http://tdm-gcc.tdragon.net/download](http://tdm-gcc.tdragon.net/download) 下载, 安装完成,您就可以开始了。
|
||||
|
||||
<span id="nav-7"></span>
|
||||
|
||||
## 使用方法
|
||||
|
||||
**确保 Go modules 是开启的:GO111MODULE=on 并且 go/bin 在您的 PATH 变量中。**
|
||||
|
||||
安装很简单,运行以下命令:
|
||||
|
||||
```
|
||||
go get -u github.com/wailsapp/wails/cmd/wails
|
||||
```
|
||||
|
||||
<span id="nav-7-1"></span>
|
||||
|
||||
### 下一步
|
||||
|
||||
建议在此时阅读 [https://wails.app](https://wails.app) 上面的文档.
|
||||
|
||||
<span id="nav-8"></span>
|
||||
|
||||
## 常见问题
|
||||
|
||||
- 它是 Electron 的替代品吗?
|
||||
|
||||
取决于您的要求。它旨在使 Go 程序员可以轻松制作轻量级桌面应用程序或在其现有应用程序中添加前端。尽管 Wails 当前不提供对诸如菜单之类的原生元素的钩子,但将来可能会改变。
|
||||
|
||||
- 这个项目针对的是哪些人?
|
||||
|
||||
希望将 HTML / JS / CSS 前端与其应用程序捆绑在一起的程序员,而不是借助创建服务并打开浏览器进行查看的方式。
|
||||
|
||||
- 名字怎么来的?
|
||||
|
||||
当我看到 WebView 时,我想"我真正想要的是围绕构建 WebView 应用程序工作,有点像 Rails 对于 Ruby"。因此,最初它是一个文字游戏(Webview on
|
||||
Rails)。碰巧也是我来自的 [国家](https://en.wikipedia.org/wiki/Wales) 的英文名字的同音。所以就是它了。
|
||||
|
||||
<span id="nav-9"></span>
|
||||
|
||||
## 贡献者
|
||||
|
||||
<a href="https://github.com/qaisjp"><img src="https://github.com/qaisjp.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/alee792"><img src="https://github.com/alee792.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/lanzafame"><img src="https://github.com/lanzafame.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/mattn"><img src="https://github.com/mattn.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/0xflotus"><img src="https://github.com/0xflotus.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/mdhender"><img src="https://github.com/mdhender.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/fishfishfish2104"><img src="https://github.com/fishfishfish2104.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/intelwalk"><img src="https://github.com/intelwalk.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/ocelotsloth"><img src="https://github.com/ocelotsloth.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/bh90210"><img src="https://github.com/bh90210.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/iceleo-com"><img src="https://github.com/iceleo-com.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/fallendusk"><img src="https://github.com/fallendusk.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Chronophylos"><img src="https://github.com/Chronophylos.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Vaelatern"><img src="https://github.com/Vaelatern.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/mewmew"><img src="https://github.com/mewmew.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/kraney"><img src="https://github.com/kraney.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/JackMordaunt"><img src="https://github.com/JackMordaunt.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/MichaelHipp"><img src="https://github.com/MichaelHipp.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/tmclane"><img src="https://github.com/tmclane.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Rested"><img src="https://github.com/Rested.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Jarek-SRT"><img src="https://github.com/Jarek-SRT.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/konez2k"><img src="https://github.com/konez2k.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/sayuthisobri"><img src="https://github.com/sayuthisobri.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/dedo1911"><img src="https://github.com/dedo1911.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/fdidron"><img src="https://github.com/fdidron.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Splode"><img src="https://github.com/Splode.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Lyimmi"><img src="https://github.com/Lyimmi.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Unix4ever"><img src="https://github.com/Unix4ever.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/timkippdev"><img src="https://github.com/timkippdev.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/kyoto44"><img src="https://github.com/kyoto44.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/artooro"><img src="https://github.com/artooro.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/ilgityildirim"><img src="https://github.com/ilgityildirim.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/gelleson"><img src="https://github.com/gelleson.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/kmuchmore"><img src="https://github.com/kmuchmore.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/aayush420"><img src="https://github.com/aayush420.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Rezrazi"><img src="https://github.com/Rezrazi.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/misitebao"><img src="https://github.com/misitebao.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/DrunkenPoney"><img src="https://github.com/DrunkenPoney.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/SophieAu"><img src="https://github.com/SophieAu.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/alexmat"><img src="https://github.com/alexmat.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/RH12503"><img src="https://github.com/RH12503.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/hi019"><img src="https://github.com/hi019.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/Igogrek"><img src="https://github.com/Igogrek.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/aschey"><img src="https://github.com/aschey.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/akhudek"><img src="https://github.com/akhudek.png?size=40" width="40"/></a>
|
||||
<a href="https://github.com/s12chung"><img src="https://github.com/s12chung.png?size=40" width="40"/></a>
|
||||
|
||||
<span id="nav-10"></span>
|
||||
|
||||
## 特别提及
|
||||
|
||||
如果没有以下人员,此项目或许永远不会存在:
|
||||
|
||||
- [Dustin Krysak](https://wiki.ubuntu.com/bashfulrobot) - 他的支持和反馈是巨大的。
|
||||
- [Serge Zaitsev](https://github.com/zserge) - Wails 窗口所使用的 [Webview](https://github.com/zserge/webview) 的作者。
|
||||
- [Byron](https://github.com/bh90210) - 有时,Byron 一个人保持这个项目活跃着。没有他令人难以置信的投入,我们永远不会得到 v1 。
|
||||
|
||||
编写项目代码时伴随着以下专辑:
|
||||
|
||||
- [Manic Street Preachers - Resistance Is Futile](https://open.spotify.com/album/1R2rsEUqXjIvAbzM0yHrxA)
|
||||
- [Manic Street Preachers - This Is My Truth, Tell Me Yours](https://open.spotify.com/album/4VzCL9kjhgGQeKCiojK1YN)
|
||||
- [The Midnight - Endless Summer](https://open.spotify.com/album/4Krg8zvprquh7TVn9OxZn8)
|
||||
- [Gary Newman - Savage (Songs from a Broken World)](https://open.spotify.com/album/3kMfsD07Q32HRWKRrpcexr)
|
||||
- [Steve Vai - Passion & Warfare](https://open.spotify.com/album/0oL0OhrE2rYVns4IGj8h2m)
|
||||
- [Ben Howard - Every Kingdom](https://open.spotify.com/album/1nJsbWm3Yy2DW1KIc1OKle)
|
||||
- [Ben Howard - Noonday Dream](https://open.spotify.com/album/6astw05cTiXEc2OvyByaPs)
|
||||
- [Adwaith - Melyn](https://open.spotify.com/album/2vBE40Rp60tl7rNqIZjaXM)
|
||||
- [Gwidaith Hen Fran - Cedors Hen Wrach](https://open.spotify.com/album/3v2hrfNGINPLuDP0YDTOjm)
|
||||
- [Metallica - Metallica](https://open.spotify.com/album/2Kh43m04B1UkVcpcRa1Zug)
|
||||
- [Bloc Party - Silent Alarm](https://open.spotify.com/album/6SsIdN05HQg2GwYLfXuzLB)
|
||||
- [Maxthor - Another World](https://open.spotify.com/album/3tklE2Fgw1hCIUstIwPBJF)
|
||||
- [Alun Tan Lan - Y Distawrwydd](https://open.spotify.com/album/0c32OywcLpdJCWWMC6vB8v)
|
||||
|
||||
<span id="nav-11"></span>
|
||||
|
||||
## 特别感谢
|
||||
|
||||
<p align="center" style="text-align: center">
|
||||
<a href="https://pace.dev"><img src="/assets/images/pace.jpeg"/></a><br/>
|
||||
<i>非常</i> 感谢<a href="https://pace.dev">Pace</a>对项目的赞助,并帮助将 Wails 移植到 Apple Silicon !<br/><br/>
|
||||
如果您正在寻找一个强大并且快速和易于使用的项目管理工具,可以看看他们!<br/><br/>
|
||||
</p>
|
||||
|
||||
<p align="center" style="text-align: center">
|
||||
特别感谢 JetBrains 向我们捐赠许可!<br/><br/>
|
||||
请点击 logo 让他们知道你的感激之情!<br/><br/>
|
||||
<a href="https://www.jetbrains.com?from=Wails"><img src="/assets/images/jetbrains-grayscale.png" width="30%"></a>
|
||||
</p>
|
||||
@@ -1,4 +1,3 @@
|
||||
//go:build linux || darwin || !windows
|
||||
// +build linux darwin !windows
|
||||
|
||||
package wails
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
//go:build windows || !linux || !darwin
|
||||
// +build windows !linux !darwin
|
||||
|
||||
package wails
|
||||
|
||||
|
Before Width: | Height: | Size: 34 KiB |
10
cmd/cmd-mewn.go
Normal file
21
cmd/fs.go
@@ -6,6 +6,7 @@ import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path"
|
||||
@@ -49,7 +50,7 @@ func (fs *FSHelper) FileExists(path string) bool {
|
||||
|
||||
// FindFile returns the first occurrence of match inside path.
|
||||
func (fs *FSHelper) FindFile(path, match string) (string, error) {
|
||||
files, err := os.ReadDir(path)
|
||||
files, err := ioutil.ReadDir(path)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
@@ -68,7 +69,7 @@ func (fs *FSHelper) FindFile(path, match string) (string, error) {
|
||||
func (fs *FSHelper) CreateFile(filename string, data []byte) error {
|
||||
// Ensure directory exists
|
||||
fs.MkDirs(filepath.Dir(filename))
|
||||
return os.WriteFile(filename, data, 0644)
|
||||
return ioutil.WriteFile(filename, data, 0644)
|
||||
}
|
||||
|
||||
// MkDirs creates the given nested directories.
|
||||
@@ -148,11 +149,21 @@ func (fs *FSHelper) LocalDir(dir string) (*Dir, error) {
|
||||
}, err
|
||||
}
|
||||
|
||||
// LoadRelativeFile loads the given file relative to the caller's directory
|
||||
func (fs *FSHelper) LoadRelativeFile(relativePath string) ([]byte, error) {
|
||||
_, filename, _, _ := runtime.Caller(0)
|
||||
fullPath, err := filepath.Abs(filepath.Join(path.Dir(filename), relativePath))
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return ioutil.ReadFile(fullPath)
|
||||
}
|
||||
|
||||
// GetSubdirs will return a list of FQPs to subdirectories in the given directory
|
||||
func (d *Dir) GetSubdirs() (map[string]string, error) {
|
||||
|
||||
// Read in the directory information
|
||||
fileInfo, err := os.ReadDir(d.fullPath)
|
||||
fileInfo, err := ioutil.ReadDir(d.fullPath)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -204,7 +215,7 @@ func (fs *FSHelper) SaveAsJSON(data interface{}, filename string) error {
|
||||
e.SetIndent("", " ")
|
||||
e.Encode(data)
|
||||
|
||||
err := os.WriteFile(filename, buf.Bytes(), 0755)
|
||||
err := ioutil.WriteFile(filename, buf.Bytes(), 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -220,7 +231,7 @@ func (fs *FSHelper) LoadAsString(filename string) (string, error) {
|
||||
|
||||
// LoadAsBytes returns the contents of the file as a byte slice
|
||||
func (fs *FSHelper) LoadAsBytes(filename string) ([]byte, error) {
|
||||
return os.ReadFile(filename)
|
||||
return ioutil.ReadFile(filename)
|
||||
}
|
||||
|
||||
// FileMD5 returns the md5sum of the given file
|
||||
|
||||
@@ -3,7 +3,7 @@ package cmd
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"sort"
|
||||
)
|
||||
@@ -24,11 +24,11 @@ func (g *GitHubHelper) GetVersionTags() ([]*SemanticVersion, error) {
|
||||
result := []*SemanticVersion{}
|
||||
var err error
|
||||
|
||||
resp, err := http.Get("https://api.github.com/repos/wailsapp/wails/releases")
|
||||
resp, err := http.Get("https://api.github.com/repos/wailsapp/wails/tags")
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
body, err := io.ReadAll(resp.Body)
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return result, err
|
||||
}
|
||||
|
||||
139
cmd/helpers.go
@@ -2,6 +2,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"os/exec"
|
||||
"os/user"
|
||||
@@ -11,12 +12,13 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"github.com/leaanthony/mewn"
|
||||
"github.com/leaanthony/mewn/lib"
|
||||
"github.com/leaanthony/slicer"
|
||||
"github.com/leaanthony/spinner"
|
||||
wailsruntime "github.com/wailsapp/wails/runtime"
|
||||
)
|
||||
|
||||
const xgoVersion = "1.16.3"
|
||||
const xgoVersion = "1.0.1"
|
||||
|
||||
var fs = NewFSHelper()
|
||||
|
||||
@@ -46,7 +48,7 @@ func InstallGoDependencies(verbose bool) error {
|
||||
depSpinner.SetSpinSpeed(50)
|
||||
depSpinner.Start()
|
||||
}
|
||||
err := NewProgramHelper(verbose).RunCommand("go mod tidy")
|
||||
err := NewProgramHelper(verbose).RunCommand("go get")
|
||||
if err != nil {
|
||||
if !verbose {
|
||||
depSpinner.Error()
|
||||
@@ -59,6 +61,30 @@ func InstallGoDependencies(verbose bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// EmbedAssets will embed the built frontend assets via mewn.
|
||||
func EmbedAssets() ([]string, error) {
|
||||
mewnFiles := lib.GetMewnFiles([]string{}, false)
|
||||
|
||||
referencedAssets, err := lib.GetReferencedAssets(mewnFiles)
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
|
||||
targetFiles := []string{}
|
||||
|
||||
for _, referencedAsset := range referencedAssets {
|
||||
packfileData, err := lib.GeneratePackFileString(referencedAsset, false)
|
||||
if err != nil {
|
||||
return []string{}, err
|
||||
}
|
||||
targetFile := filepath.Join(referencedAsset.BaseDir, referencedAsset.PackageName+"-mewn.go")
|
||||
targetFiles = append(targetFiles, targetFile)
|
||||
ioutil.WriteFile(targetFile, []byte(packfileData), 0644)
|
||||
}
|
||||
|
||||
return targetFiles, nil
|
||||
}
|
||||
|
||||
func InitializeCrossCompilation(verbose bool) error {
|
||||
// Check Docker
|
||||
if err := CheckIfInstalled("docker"); err != nil {
|
||||
@@ -101,16 +127,13 @@ func BuildDocker(binaryName string, buildMode string, projectOptions *ProjectOpt
|
||||
// Check build directory
|
||||
buildDirectory := filepath.Join(fs.Cwd(), "build")
|
||||
if !fs.DirExists(buildDirectory) {
|
||||
err := fs.MkDir(buildDirectory)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
fs.MkDir(buildDirectory)
|
||||
}
|
||||
|
||||
buildCommand := slicer.String()
|
||||
userid := 1000
|
||||
currentUser, _ := user.Current()
|
||||
if i, err := strconv.Atoi(currentUser.Uid); err == nil {
|
||||
user, _ := user.Current()
|
||||
if i, err := strconv.Atoi(user.Uid); err == nil {
|
||||
userid = i
|
||||
}
|
||||
for _, arg := range []string{
|
||||
@@ -175,6 +198,11 @@ func BuildDocker(binaryName string, buildMode string, projectOptions *ProjectOpt
|
||||
// BuildNative builds on the target platform itself.
|
||||
func BuildNative(binaryName string, forceRebuild bool, buildMode string, projectOptions *ProjectOptions) error {
|
||||
|
||||
// Check Mewn is installed
|
||||
if err := CheckMewn(projectOptions.Verbose); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if err := CheckWindres(); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -247,6 +275,12 @@ func BuildNative(binaryName string, forceRebuild bool, buildMode string, project
|
||||
func BuildApplication(binaryName string, forceRebuild bool, buildMode string, packageApp bool, projectOptions *ProjectOptions) error {
|
||||
var err error
|
||||
|
||||
// embed resources
|
||||
targetFiles, err := EmbedAssets()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if projectOptions.CrossCompile {
|
||||
if err := InitializeCrossCompilation(projectOptions.Verbose); err != nil {
|
||||
return err
|
||||
@@ -262,6 +296,20 @@ func BuildApplication(binaryName string, forceRebuild bool, buildMode string, pa
|
||||
}
|
||||
}
|
||||
|
||||
// cleanup temporary embedded assets
|
||||
defer func() {
|
||||
for _, filename := range targetFiles {
|
||||
if err := os.Remove(filename); err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
// Removed by popular demand
|
||||
// TODO: Potentially add a flag to cleanup
|
||||
// if projectOptions.Platform == "windows" {
|
||||
// helper.CleanWindows(projectOptions)
|
||||
// }
|
||||
}()
|
||||
|
||||
if projectOptions.CrossCompile {
|
||||
err = BuildDocker(binaryName, buildMode, projectOptions)
|
||||
} else {
|
||||
@@ -326,6 +374,30 @@ func BuildFrontend(projectOptions *ProjectOptions) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// CheckMewn checks if mewn is installed and if not, attempts to fetch it
|
||||
func CheckMewn(verbose bool) (err error) {
|
||||
programHelper := NewProgramHelper(verbose)
|
||||
if !programHelper.IsInstalled("mewn") {
|
||||
var buildSpinner *spinner.Spinner
|
||||
if !verbose {
|
||||
buildSpinner = spinner.New()
|
||||
buildSpinner.SetSpinSpeed(50)
|
||||
buildSpinner.Start("Installing Mewn asset packer...")
|
||||
}
|
||||
err := programHelper.InstallGoPackage("github.com/leaanthony/mewn/cmd/mewn")
|
||||
if err != nil {
|
||||
if buildSpinner != nil {
|
||||
buildSpinner.Error()
|
||||
}
|
||||
return err
|
||||
}
|
||||
if buildSpinner != nil {
|
||||
buildSpinner.Success()
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// CheckWindres checks if Windres is installed and if not, aborts
|
||||
func CheckWindres() (err error) {
|
||||
if runtime.GOOS != "windows" { // FIXME: Handle windows cross-compile for windows!
|
||||
@@ -421,18 +493,11 @@ func InstallFrontendDeps(projectDir string, projectOptions *ProjectOptions, forc
|
||||
}
|
||||
|
||||
// Update md5sum file
|
||||
err := os.WriteFile(md5sumFile, []byte(packageJSONMD5), 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
ioutil.WriteFile(md5sumFile, []byte(packageJSONMD5), 0644)
|
||||
}
|
||||
|
||||
// Install the runtime
|
||||
if caller == "build" {
|
||||
err = InstallProdRuntime(projectDir, projectOptions)
|
||||
} else {
|
||||
err = InstallBridge(projectDir, projectOptions)
|
||||
}
|
||||
err = InstallRuntime(caller, projectDir, projectOptions)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -445,17 +510,28 @@ func InstallFrontendDeps(projectDir string, projectOptions *ProjectOptions, forc
|
||||
return nil
|
||||
}
|
||||
|
||||
// InstallRuntime installs the correct runtime for the type of build
|
||||
func InstallRuntime(caller string, projectDir string, projectOptions *ProjectOptions) error {
|
||||
if caller == "build" {
|
||||
return InstallProdRuntime(projectDir, projectOptions)
|
||||
}
|
||||
|
||||
return InstallBridge(projectDir, projectOptions)
|
||||
}
|
||||
|
||||
// InstallBridge installs the relevant bridge javascript library
|
||||
func InstallBridge(projectDir string, projectOptions *ProjectOptions) error {
|
||||
bridgeFileData := mewn.String("../runtime/assets/bridge.js")
|
||||
bridgeFileTarget := filepath.Join(projectDir, projectOptions.FrontEnd.Dir, "node_modules", "@wailsapp", "runtime", "init.js")
|
||||
err := fs.CreateFile(bridgeFileTarget, wailsruntime.BridgeJS)
|
||||
err := fs.CreateFile(bridgeFileTarget, []byte(bridgeFileData))
|
||||
return err
|
||||
}
|
||||
|
||||
// InstallProdRuntime installs the production runtime
|
||||
func InstallProdRuntime(projectDir string, projectOptions *ProjectOptions) error {
|
||||
prodInit := mewn.String("../runtime/js/runtime/init.js")
|
||||
bridgeFileTarget := filepath.Join(projectDir, projectOptions.FrontEnd.Dir, "node_modules", "@wailsapp", "runtime", "init.js")
|
||||
err := fs.CreateFile(bridgeFileTarget, wailsruntime.InitJS)
|
||||
err := fs.CreateFile(bridgeFileTarget, []byte(prodInit))
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -475,22 +551,7 @@ func ServeProject(projectOptions *ProjectOptions, logger *Logger) error {
|
||||
}
|
||||
|
||||
logger.Yellow("Serving Application: " + location)
|
||||
var args []string
|
||||
if len(os.Args) > 2 {
|
||||
foundArgSep := false
|
||||
for index, arg := range os.Args[2:] {
|
||||
if arg == "--" {
|
||||
foundArgSep = true
|
||||
continue
|
||||
}
|
||||
if foundArgSep {
|
||||
args = os.Args[index:]
|
||||
break
|
||||
}
|
||||
}
|
||||
logger.Yellow("Passing arguments: %+v", args)
|
||||
}
|
||||
cmd := exec.Command(location, args...)
|
||||
cmd := exec.Command(location)
|
||||
cmd.Stdout = os.Stdout
|
||||
cmd.Stderr = os.Stderr
|
||||
err = cmd.Run()
|
||||
@@ -534,9 +595,3 @@ func ldFlags(po *ProjectOptions, buildMode string) string {
|
||||
}
|
||||
return ldflags
|
||||
}
|
||||
|
||||
func getGitConfigValue(key string) (string, error) {
|
||||
output, err := exec.Command("git", "config", "--get", "--null", key).Output()
|
||||
// When using --null git appends a null character (\u0000) to the command output
|
||||
return strings.TrimRight(string(output), "\u0000"), err
|
||||
}
|
||||
|
||||
46
cmd/linux.go
@@ -2,6 +2,7 @@ package cmd
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/url"
|
||||
"os"
|
||||
"runtime"
|
||||
@@ -66,16 +67,6 @@ const (
|
||||
Ctlos
|
||||
// EndeavourOS linux distribution
|
||||
EndeavourOS
|
||||
// Crux linux distribution
|
||||
Crux
|
||||
// RHEL distribution
|
||||
RHEL
|
||||
// NixOS distribution
|
||||
NixOS
|
||||
// Artix linux distribution
|
||||
ArtixLinux
|
||||
//Uos distribution
|
||||
Uos
|
||||
)
|
||||
|
||||
// DistroInfo contains all the information relating to a linux distribution
|
||||
@@ -96,7 +87,7 @@ func GetLinuxDistroInfo() *DistroInfo {
|
||||
}
|
||||
_, err := os.Stat("/etc/os-release")
|
||||
if !os.IsNotExist(err) {
|
||||
osRelease, _ := os.ReadFile("/etc/os-release")
|
||||
osRelease, _ := ioutil.ReadFile("/etc/os-release")
|
||||
result = parseOsRelease(string(osRelease))
|
||||
}
|
||||
return result
|
||||
@@ -138,8 +129,6 @@ func parseOsRelease(osRelease string) *DistroInfo {
|
||||
result.Distribution = Fedora
|
||||
case "centos":
|
||||
result.Distribution = CentOS
|
||||
case "rhel":
|
||||
result.Distribution = RHEL
|
||||
case "arch":
|
||||
result.Distribution = Arch
|
||||
case "archlabs":
|
||||
@@ -186,14 +175,6 @@ func parseOsRelease(osRelease string) *DistroInfo {
|
||||
result.Distribution = Solus
|
||||
case "endeavouros":
|
||||
result.Distribution = EndeavourOS
|
||||
case "crux":
|
||||
result.Distribution = Crux
|
||||
case "nixos":
|
||||
result.Distribution = NixOS
|
||||
case "artix":
|
||||
result.Distribution = ArtixLinux
|
||||
case "uos":
|
||||
result.Distribution = Uos
|
||||
default:
|
||||
result.Distribution = Unknown
|
||||
}
|
||||
@@ -274,29 +255,6 @@ func RpmInstalled(packageName string) (bool, error) {
|
||||
return exitCode == 0, nil
|
||||
}
|
||||
|
||||
// PrtGetInstalled uses prt-get to see if a package is installed
|
||||
func PrtGetInstalled(packageName string) (bool, error) {
|
||||
program := NewProgramHelper()
|
||||
prtget := program.FindProgram("prt-get")
|
||||
if prtget == nil {
|
||||
return false, fmt.Errorf("cannot check dependencies: prt-get not found")
|
||||
}
|
||||
_, _, exitCode, _ := prtget.Run("isinst", packageName)
|
||||
return exitCode == 0, nil
|
||||
}
|
||||
|
||||
// NixEnvInstalled uses nix-env to see if a package is installed
|
||||
func NixEnvInstalled(packageName string) (bool, error) {
|
||||
program := NewProgramHelper()
|
||||
nixEnv := program.FindProgram("nix-env")
|
||||
if nixEnv == nil {
|
||||
return false, fmt.Errorf("cannot check dependencies: nix-env not found")
|
||||
}
|
||||
packageName = strings.ReplaceAll(packageName, "+", `\+`)
|
||||
_, _, exitCode, _ := nixEnv.Run("-q", packageName)
|
||||
return exitCode == 0, nil
|
||||
}
|
||||
|
||||
// RequestSupportForDistribution promts the user to submit a request to support their
|
||||
// currently unsupported distribution
|
||||
func RequestSupportForDistribution(distroInfo *DistroInfo) error {
|
||||
|
||||
@@ -1,15 +1,11 @@
|
||||
package cmd
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"log"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
//go:embed linuxdb.yaml
|
||||
var LinuxDBYaml []byte
|
||||
|
||||
// LinuxDB is the database for linux distribution data.
|
||||
type LinuxDB struct {
|
||||
Distributions map[string]*Distribution `yaml:"distributions"`
|
||||
@@ -82,10 +78,14 @@ func (l *LinuxDB) GetDistro(distro string) *Distribution {
|
||||
// NewLinuxDB creates a new LinuxDB instance from the bundled
|
||||
// linuxdb.yaml file.
|
||||
func NewLinuxDB() *LinuxDB {
|
||||
data, err := fs.LoadRelativeFile("./linuxdb.yaml")
|
||||
if err != nil {
|
||||
log.Fatal("Could not load linuxdb.yaml")
|
||||
}
|
||||
result := LinuxDB{
|
||||
Distributions: make(map[string]*Distribution),
|
||||
}
|
||||
err := result.ImportData(LinuxDBYaml)
|
||||
err = result.ImportData(data)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
|
||||
@@ -100,15 +100,6 @@ distributions:
|
||||
gccversioncommand: *gccdumpfullversion
|
||||
programs: *debiandefaultprograms
|
||||
libraries: *debiandefaultlibraries
|
||||
uos:
|
||||
id: uos
|
||||
releases:
|
||||
default:
|
||||
version: default
|
||||
name: Uos
|
||||
gccversioncommand: *gccdumpfullversion
|
||||
programs: *debiandefaultprograms
|
||||
libraries: *debiandefaultlibraries
|
||||
void:
|
||||
id: void
|
||||
releases:
|
||||
@@ -147,25 +138,6 @@ distributions:
|
||||
help: Please install with `sudo yum install gtk3-devel` and try again
|
||||
- name: webkitgtk3-devel
|
||||
help: Please install with `sudo yum install webkitgtk3-devel` and try again
|
||||
rhel:
|
||||
id: rhel
|
||||
releases:
|
||||
default:
|
||||
version: default
|
||||
name: Red Hat Enterprise Linux
|
||||
gccversioncommand: *gccdumpversion
|
||||
programs:
|
||||
- name: gcc
|
||||
help: Please install with `sudo yum install gcc-c++ make` and try again
|
||||
- name: pkg-config
|
||||
help: Please install with `sudo yum install pkgconf-pkg-config` and try again
|
||||
- name: npm
|
||||
help: Please install with `sudo yum install epel-release && sudo yum install nodejs` and try again
|
||||
libraries:
|
||||
- name: gtk3-devel
|
||||
help: Please install with `sudo yum install gtk3-devel` and try again
|
||||
- name: webkitgtk3-devel
|
||||
help: Please install with `sudo yum install webkitgtk3-devel` and try again
|
||||
fedora:
|
||||
id: fedora
|
||||
releases:
|
||||
@@ -222,15 +194,6 @@ distributions:
|
||||
gccversioncommand: *gccdumpversion
|
||||
programs: *archdefaultprograms
|
||||
libraries: *archdefaultlibraries
|
||||
artix:
|
||||
id: artix
|
||||
releases:
|
||||
default:
|
||||
version: default
|
||||
name: Artix Linux
|
||||
gccversioncommand: *gccdumpversion
|
||||
programs: *archdefaultprograms
|
||||
libraries: *archdefaultlibraries
|
||||
ctlos:
|
||||
id: ctlos
|
||||
releases:
|
||||
@@ -336,49 +299,11 @@ distributions:
|
||||
- name: webkit2gtk3-devel
|
||||
help: Please install with `sudo zypper in webkit2gtk3-devel` and try again
|
||||
opensuse-leap:
|
||||
id: opensuse-leap
|
||||
releases:
|
||||
default:
|
||||
version: default
|
||||
name: openSUSE Leap
|
||||
gccversioncommand: *gccdumpfullversion
|
||||
programs: *opensusedefaultprograms
|
||||
libraries: *opensusedefaultlibraries
|
||||
crux:
|
||||
id: crux
|
||||
releases:
|
||||
default:
|
||||
version: default
|
||||
name: Crux Linux
|
||||
gccversioncommand: *gccdumpversion
|
||||
programs:
|
||||
- name: gcc
|
||||
help: Please install with `sudo prt-get depinst gcc-c++ make` and try again
|
||||
- name: pkg-config
|
||||
help: Please install with `sudo prt-get depinst pkg-config` and try again
|
||||
- name: npm
|
||||
help: Please install with `sudo prt-get depinst nodejs` and try again
|
||||
libraries:
|
||||
- name: gtk3
|
||||
help: Please install with `sudo prt-get depinst gtk3` and try again
|
||||
- name: webkitgtk
|
||||
help: Please install with `sudo prt-get depinst webkitgtk` and try again
|
||||
nixos:
|
||||
id: nixos
|
||||
releases:
|
||||
default:
|
||||
version: default
|
||||
name: NixOS
|
||||
gccversioncommand: *gccdumpversion
|
||||
programs:
|
||||
- name: gcc
|
||||
help: Please install with `nix-env -iA nixos.gcc`
|
||||
- name: pkg-config
|
||||
help: Please install with `nix-env -iA nixos.pkg-config`
|
||||
- name: npm
|
||||
help: Please install with `nix-env -iA nixos.nodejs`
|
||||
libraries:
|
||||
- name: gtk+3
|
||||
help: Please install with `nix-env -iA nixos.gtk3`
|
||||
- name: webkitgtk
|
||||
help: Please install with `nix-env -iA nixos.nodePackages.webkitgtk`
|
||||
id: opensuse-leap
|
||||
releases:
|
||||
default:
|
||||
version: default
|
||||
name: openSUSE Leap
|
||||
gccversioncommand: *gccdumpfullversion
|
||||
programs: *opensusedefaultprograms
|
||||
libraries: *opensusedefaultlibraries
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
"fmt"
|
||||
"image"
|
||||
"image/png"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
@@ -243,7 +244,7 @@ func (b *PackageHelper) packageOSX(po *ProjectOptions) error {
|
||||
// No - create a new plist from our defaults
|
||||
tmpl := template.New("infoPlist")
|
||||
plistFile := filepath.Join(b.getPackageFileBaseDir(), "info.plist")
|
||||
infoPlist, err := os.ReadFile(plistFile)
|
||||
infoPlist, err := ioutil.ReadFile(plistFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -257,13 +258,13 @@ func (b *PackageHelper) packageOSX(po *ProjectOptions) error {
|
||||
}
|
||||
|
||||
// Save to the package
|
||||
err = os.WriteFile(plistFilename, tpl.Bytes(), 0644)
|
||||
err = ioutil.WriteFile(plistFilename, tpl.Bytes(), 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Also write to project directory for customisation
|
||||
err = os.WriteFile(customPlist, tpl.Bytes(), 0644)
|
||||
err = ioutil.WriteFile(customPlist, tpl.Bytes(), 0644)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -313,12 +314,10 @@ func (b *PackageHelper) PackageWindows(po *ProjectOptions, cleanUp bool) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Generate icon from PNG if it doesn't exist
|
||||
if !fs.FileExists(basename + ".ico") {
|
||||
err = generateWindowsIcon(icon, basename+".ico")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// Generate icon from PNG
|
||||
err = generateWindowsIcon(icon, basename+".ico")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Copy manifest
|
||||
@@ -335,12 +334,12 @@ func (b *PackageHelper) PackageWindows(po *ProjectOptions, cleanUp bool) error {
|
||||
tgtRCFile := filepath.Join(outputDir, basename+".rc")
|
||||
if !b.fs.FileExists(tgtRCFile) {
|
||||
srcRCfile := filepath.Join(b.getPackageFileBaseDir(), "wails.rc")
|
||||
rcfilebytes, err := os.ReadFile(srcRCfile)
|
||||
rcfilebytes, err := ioutil.ReadFile(srcRCfile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
rcfiledata := strings.Replace(string(rcfilebytes), "$NAME$", basename, -1)
|
||||
err = os.WriteFile(tgtRCFile, []byte(rcfiledata), 0755)
|
||||
err = ioutil.WriteFile(tgtRCFile, []byte(rcfiledata), 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -355,7 +354,7 @@ func (b *PackageHelper) PackageWindows(po *ProjectOptions, cleanUp bool) error {
|
||||
"docker", "run", "--rm",
|
||||
"-v", outputDir + ":/build",
|
||||
"--entrypoint", "/bin/sh",
|
||||
"wailsapp/xgo:1.16.3",
|
||||
"wailsapp/xgo:latest",
|
||||
"-c", "/usr/bin/x86_64-w64-mingw32-windres -o /build/" + basename + "-res.syso /build/" + basename + ".rc",
|
||||
}
|
||||
if err := NewProgramHelper().RunCommandArray(args); err != nil {
|
||||
@@ -388,11 +387,11 @@ func (b *PackageHelper) copyIcon() (string, error) {
|
||||
|
||||
// Install default icon
|
||||
iconfile := filepath.Join(b.getPackageFileBaseDir(), "icon.png")
|
||||
iconData, err := os.ReadFile(iconfile)
|
||||
iconData, err := ioutil.ReadFile(iconfile)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
err = os.WriteFile(srcIcon, iconData, 0644)
|
||||
err = ioutil.WriteFile(srcIcon, iconData, 0644)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package cmd
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
@@ -309,14 +310,14 @@ func (po *ProjectOptions) WriteProjectConfig() error {
|
||||
return err
|
||||
}
|
||||
|
||||
return os.WriteFile(targetFile, filedata, 0600)
|
||||
return ioutil.WriteFile(targetFile, filedata, 0600)
|
||||
}
|
||||
|
||||
// LoadConfig loads the project configuration file from the
|
||||
// given directory
|
||||
func (po *ProjectOptions) LoadConfig(projectDir string) error {
|
||||
targetFile := filepath.Join(projectDir, "project.json")
|
||||
rawBytes, err := os.ReadFile(targetFile)
|
||||
rawBytes, err := ioutil.ReadFile(targetFile)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package cmd
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -98,16 +99,11 @@ func (s *SystemHelper) setup() error {
|
||||
|
||||
if config.Name != "" {
|
||||
systemConfig["name"] = PromptRequired("What is your name", config.Name)
|
||||
} else if n, err := getGitConfigValue("user.name"); err == nil && n != "" {
|
||||
systemConfig["name"] = PromptRequired("What is your name", n)
|
||||
} else {
|
||||
systemConfig["name"] = PromptRequired("What is your name")
|
||||
}
|
||||
|
||||
if config.Email != "" {
|
||||
systemConfig["email"] = PromptRequired("What is your email address", config.Email)
|
||||
} else if e, err := getGitConfigValue("user.email"); err == nil && e != "" {
|
||||
systemConfig["email"] = PromptRequired("What is your email address", e)
|
||||
} else {
|
||||
systemConfig["email"] = PromptRequired("What is your email address")
|
||||
}
|
||||
@@ -123,7 +119,7 @@ func (s *SystemHelper) setup() error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = os.WriteFile(s.wailsSystemConfig, configData, 0755)
|
||||
err = ioutil.WriteFile(s.wailsSystemConfig, configData, 0755)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -184,7 +180,7 @@ func (s *SystemHelper) Initialise() error {
|
||||
return s.setup()
|
||||
}
|
||||
|
||||
// SystemConfig - Defines system wide configuration data
|
||||
// SystemConfig - Defines system wode configuration data
|
||||
type SystemConfig struct {
|
||||
Name string `json:"name"`
|
||||
Email string `json:"email"`
|
||||
@@ -206,11 +202,11 @@ func (sc *SystemConfig) Save(filename string) error {
|
||||
}
|
||||
|
||||
// Write it out to the config file
|
||||
return os.WriteFile(filename, theJSON, 0644)
|
||||
return ioutil.WriteFile(filename, theJSON, 0644)
|
||||
}
|
||||
|
||||
func (sc *SystemConfig) load(filename string) error {
|
||||
configData, err := os.ReadFile(filename)
|
||||
configData, err := ioutil.ReadFile(filename)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -278,11 +274,11 @@ func CheckDependencies(logger *Logger) (bool, error) {
|
||||
distroInfo := GetLinuxDistroInfo()
|
||||
|
||||
switch distroInfo.Distribution {
|
||||
case Ubuntu, Debian, Zorin, Parrot, Linuxmint, Elementary, Kali, Neon, Deepin, Raspbian, PopOS, Uos:
|
||||
case Ubuntu, Debian, Zorin, Parrot, Linuxmint, Elementary, Kali, Neon, Deepin, Raspbian, PopOS:
|
||||
libraryChecker = DpkgInstalled
|
||||
case Arch, ArcoLinux, ArchLabs, Ctlos, Manjaro, ManjaroARM, EndeavourOS, ArtixLinux:
|
||||
case Arch, ArcoLinux, ArchLabs, Ctlos, Manjaro, ManjaroARM, EndeavourOS:
|
||||
libraryChecker = PacmanInstalled
|
||||
case CentOS, Fedora, Tumbleweed, Leap, RHEL:
|
||||
case CentOS, Fedora, Tumbleweed, Leap:
|
||||
libraryChecker = RpmInstalled
|
||||
case Gentoo:
|
||||
libraryChecker = EqueryInstalled
|
||||
@@ -290,10 +286,6 @@ func CheckDependencies(logger *Logger) (bool, error) {
|
||||
libraryChecker = XbpsInstalled
|
||||
case Solus:
|
||||
libraryChecker = EOpkgInstalled
|
||||
case Crux:
|
||||
libraryChecker = PrtGetInstalled
|
||||
case NixOS:
|
||||
libraryChecker = NixEnvInstalled
|
||||
default:
|
||||
return false, RequestSupportForDistribution(distroInfo)
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ import (
|
||||
"bytes"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
"strings"
|
||||
@@ -125,7 +125,7 @@ func (t *TemplateHelper) LoadMetadata(dir string) (*TemplateMetadata, error) {
|
||||
if !t.fs.FileExists(templateFile) {
|
||||
return nil, nil
|
||||
}
|
||||
rawJSON, err := os.ReadFile(templateFile)
|
||||
rawJSON, err := ioutil.ReadFile(templateFile)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"version": "0.0.0",
|
||||
"scripts": {
|
||||
"ng": "npx ng",
|
||||
"serve": "npx ng serve --poll=2000 --host=0.0.0.0",
|
||||
"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",
|
||||
"test": "npx ng test",
|
||||
"lint": "npx ng lint",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"github.com/leaanthony/mewn"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
@@ -9,14 +9,11 @@ func basic() string {
|
||||
return "World!"
|
||||
}
|
||||
|
||||
//go:embed frontend/dist/my-app/main.js
|
||||
var js string
|
||||
|
||||
//go:embed frontend/dist/my-app/styles.css
|
||||
var css string
|
||||
|
||||
func main() {
|
||||
|
||||
js := mewn.String("./frontend/dist/my-app/main.js")
|
||||
css := mewn.String("./frontend/dist/my-app/styles.css")
|
||||
|
||||
app := wails.CreateApp(&wails.AppConfig{
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
"author": "bh90210 <ktc@pm.me>",
|
||||
"created": "2019-06-15 18:23:48.666414555 +0300 EEST m=+223.934866008",
|
||||
"frontenddir": "frontend",
|
||||
"serve": "npm run serve",
|
||||
"serve": "npx ng serve --poll=2000",
|
||||
"bridge": "src",
|
||||
"wailsdir": ""
|
||||
}
|
||||
@@ -12,7 +12,7 @@
|
||||
"@wailsapp/runtime": "^1.0.10"
|
||||
},
|
||||
"scripts": {
|
||||
"serve": "react-scripts start",
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"github.com/leaanthony/mewn"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
@@ -9,14 +9,11 @@ func basic() string {
|
||||
return "World!"
|
||||
}
|
||||
|
||||
//go:embed frontend/build/static/js/main.js
|
||||
var js string
|
||||
|
||||
//go:embed frontend/build/static/css/main.css
|
||||
var css string
|
||||
|
||||
func main() {
|
||||
|
||||
js := mewn.String("./frontend/build/static/js/main.js")
|
||||
css := mewn.String("./frontend/build/static/css/main.css")
|
||||
|
||||
app := wails.CreateApp(&wails.AppConfig{
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"author": "bh90210 <ktc@pm.me>",
|
||||
"created": "2019-06-07 18:23:48.666414555 +0300 EEST m=+223.934866008",
|
||||
"frontenddir": "frontend",
|
||||
"serve": "npm run serve",
|
||||
"serve": "npm run start",
|
||||
"bridge": "src",
|
||||
"wailsdir": ""
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"author": "{{.Author.Name}}<{{.Author.Email}}>",
|
||||
"scripts": {
|
||||
"build": "rollup -c",
|
||||
"serve": "rollup -c -w",
|
||||
"dev": "rollup -c -w",
|
||||
"start": "sirv public"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@@ -2,7 +2,7 @@ import svelte from 'rollup-plugin-svelte';
|
||||
import resolve from '@rollup/plugin-node-resolve';
|
||||
import commonjs from '@rollup/plugin-commonjs';
|
||||
import livereload from 'rollup-plugin-livereload';
|
||||
import {terser} from 'rollup-plugin-terser';
|
||||
import { terser } from 'rollup-plugin-terser';
|
||||
import image from '@rollup/plugin-image';
|
||||
import babel from 'rollup-plugin-babel';
|
||||
import polyfill from 'rollup-plugin-polyfill';
|
||||
@@ -80,6 +80,7 @@ export default {
|
||||
{
|
||||
targets: '> 0.25%, not dead, IE 11',
|
||||
modules: false,
|
||||
spec: true,
|
||||
useBuiltIns: 'usage',
|
||||
forceAllTransforms: true,
|
||||
corejs: 3,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"github.com/leaanthony/mewn"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
@@ -9,13 +9,9 @@ func basic() string {
|
||||
return "World!"
|
||||
}
|
||||
|
||||
//go:embed frontend/public/build/bundle.js
|
||||
var js string
|
||||
|
||||
//go:embed frontend/public/build/bundle.css
|
||||
var css string
|
||||
|
||||
func main() {
|
||||
js := mewn.String("./frontend/public/build/bundle.js")
|
||||
css := mewn.String("./frontend/public/build/bundle.css")
|
||||
|
||||
app := wails.CreateApp(&wails.AppConfig{
|
||||
Width: 1024,
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"author": "Tim Kipp <timkipp.22.developer@gmail.com>",
|
||||
"created": "2020-09-06 13:06:10.469848 -0700 PDT m=+213.578828559",
|
||||
"frontenddir": "frontend",
|
||||
"serve": "npm run serve",
|
||||
"serve": "npm run dev",
|
||||
"bridge": "src",
|
||||
"wailsdir": ""
|
||||
}
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"github.com/leaanthony/mewn"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
//go:embed frontend/build/main.js
|
||||
var js string
|
||||
|
||||
//go:embed frontend/build/main.css
|
||||
var css string
|
||||
|
||||
func main() {
|
||||
|
||||
js := mewn.String("./frontend/build/main.js")
|
||||
css := mewn.String("./frontend/build/main.css")
|
||||
|
||||
app := wails.CreateApp(&wails.AppConfig{
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"github.com/leaanthony/mewn"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
@@ -9,14 +9,11 @@ func basic() string {
|
||||
return "Hello World!"
|
||||
}
|
||||
|
||||
//go:embed frontend/dist/app.js
|
||||
var js string
|
||||
|
||||
//go:embed frontend/dist/app.css
|
||||
var css string
|
||||
|
||||
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,
|
||||
|
||||
23
cmd/templates/vue3-js/frontend/.gitignore
vendored
@@ -1,23 +0,0 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
@@ -1,29 +0,0 @@
|
||||
# vue-js
|
||||
|
||||
## Project setup
|
||||
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
|
||||
```
|
||||
npm run lint
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
||||
@@ -1,5 +0,0 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
}
|
||||
12312
cmd/templates/vue3-js/frontend/package-lock.json
generated
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"name": "{{.NPMProjectName}}",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@wailsapp/runtime": "^1.1.1",
|
||||
"core-js": "^3.6.5",
|
||||
"vue": "^3.0.0",
|
||||
"vue-router": "^4.0.0-0",
|
||||
"vuex": "^4.0.0-0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "~4.5.0",
|
||||
"@vue/cli-plugin-eslint": "~4.5.0",
|
||||
"@vue/cli-plugin-router": "~4.5.0",
|
||||
"@vue/cli-plugin-vuex": "~4.5.0",
|
||||
"@vue/cli-service": "~4.5.0",
|
||||
"@vue/compiler-sfc": "^3.0.0",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^6.7.2",
|
||||
"eslint-plugin-vue": "^7.0.0",
|
||||
"stylus": "^0.54.7",
|
||||
"stylus-loader": "^3.0.2"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:vue/vue3-essential",
|
||||
"eslint:recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"parser": "babel-eslint"
|
||||
},
|
||||
"rules": {}
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not dead"
|
||||
]
|
||||
}
|
||||
|
Before Width: | Height: | Size: 4.2 KiB |
@@ -1,18 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta content="IE=edge" http-equiv="X-UA-Compatible">
|
||||
<meta content="width=device-width,initial-scale=1.0" name="viewport">
|
||||
<link href="<%= BASE_URL %>favicon.ico" rel="icon">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled.
|
||||
Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,30 +0,0 @@
|
||||
<template>
|
||||
<div id="nav">
|
||||
<router-link to="/">Home</router-link> |
|
||||
<router-link to="/about">About</router-link>
|
||||
</div>
|
||||
<router-view />
|
||||
</template>
|
||||
|
||||
<style lang="stylus">
|
||||
#app {
|
||||
font-family: Avenir, Helvetica, Arial, sans-serif;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
text-align: center;
|
||||
color: #2c3e50;
|
||||
}
|
||||
|
||||
#nav {
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
#nav a {
|
||||
font-weight: bold;
|
||||
color: #2c3e50;
|
||||
}
|
||||
|
||||
#nav a.router-link-exact-active {
|
||||
color: #42b983;
|
||||
}
|
||||
</style>
|
||||
|
Before Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 6.7 KiB |
@@ -1,32 +0,0 @@
|
||||
<template>
|
||||
<div class="hello">
|
||||
<h1>{{ msg }}</h1>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "HelloWorld",
|
||||
props: {
|
||||
msg: String,
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
h3 {
|
||||
margin: 40px 0 0;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
li {
|
||||
display: inline-block;
|
||||
margin: 0 10px;
|
||||
}
|
||||
a {
|
||||
color: #42b983;
|
||||
}
|
||||
</style>
|
||||
@@ -1,14 +0,0 @@
|
||||
import {createApp} from 'vue'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import store from './store'
|
||||
|
||||
// import wails runtime
|
||||
import * as Wails from '@wailsapp/runtime';
|
||||
|
||||
Wails.Init(() => {
|
||||
createApp(App)
|
||||
.use(store)
|
||||
.use(router)
|
||||
.mount('#app')
|
||||
})
|
||||
@@ -1,25 +0,0 @@
|
||||
import {createMemoryHistory, createRouter} from 'vue-router'
|
||||
import Home from '../views/Home.vue'
|
||||
import About from '../views/About.vue'
|
||||
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'Home',
|
||||
component: Home
|
||||
},
|
||||
{
|
||||
path: '/about',
|
||||
name: 'About',
|
||||
// You can only use pre-loading to add routes, not the on-demand loading method.
|
||||
component: About
|
||||
}
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
history: createMemoryHistory(),
|
||||
routes
|
||||
})
|
||||
|
||||
export default router
|
||||
@@ -1,8 +0,0 @@
|
||||
import {createStore} from 'vuex'
|
||||
|
||||
export default createStore({
|
||||
state: {},
|
||||
mutations: {},
|
||||
actions: {},
|
||||
modules: {}
|
||||
})
|
||||
@@ -1,5 +0,0 @@
|
||||
<template>
|
||||
<div class="about">
|
||||
<h1>This is an about page</h1>
|
||||
</div>
|
||||
</template>
|
||||
@@ -1,42 +0,0 @@
|
||||
<template>
|
||||
<div class="home">
|
||||
<img
|
||||
@click="getMessage"
|
||||
alt="Vue logo"
|
||||
src="../assets/appicon.png"
|
||||
:style="{ height: '400px' }"
|
||||
/>
|
||||
<HelloWorld :msg="message" />
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from "vue";
|
||||
import HelloWorld from "@/components/HelloWorld.vue";
|
||||
|
||||
export default {
|
||||
name: "Home",
|
||||
components: {
|
||||
HelloWorld,
|
||||
},
|
||||
setup() {
|
||||
const message = ref("Click the Icon");
|
||||
|
||||
const getMessage = () => {
|
||||
window.backend
|
||||
.basic()
|
||||
.then((res) => {
|
||||
message.value = res;
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
};
|
||||
|
||||
return {
|
||||
message: message,
|
||||
getMessage: getMessage,
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
@@ -1,42 +0,0 @@
|
||||
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
|
||||
}
|
||||
};
|
||||
@@ -1,5 +0,0 @@
|
||||
module {{.BinaryName}}
|
||||
|
||||
require (
|
||||
github.com/wailsapp/wails {{.WailsVersion}}
|
||||
)
|
||||
@@ -1,30 +0,0 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
func basic() string {
|
||||
return "Hello World!"
|
||||
}
|
||||
|
||||
//go:embed frontend/dist/app.js
|
||||
var js string
|
||||
|
||||
//go:embed frontend/dist/app.css
|
||||
var css string
|
||||
|
||||
func main() {
|
||||
|
||||
app := wails.CreateApp(&wails.AppConfig{
|
||||
Width: 1024,
|
||||
Height: 768,
|
||||
Title: "{{.Name}}",
|
||||
JS: js,
|
||||
CSS: css,
|
||||
Colour: "#131313",
|
||||
})
|
||||
app.Bind(basic)
|
||||
app.Run()
|
||||
}
|
||||
@@ -1,18 +0,0 @@
|
||||
{
|
||||
"name": "Vue3 JS",
|
||||
"version": "1.0.0",
|
||||
"shortdescription": "A template based on Vue 3, Vue-router, Vuex, and Webpack5",
|
||||
"description": "A template based on Vue 3, Vue-router, Vuex, and Webpack5",
|
||||
"install": "npm install",
|
||||
"build": "npm run build",
|
||||
"author": "Misitebao <i@misitebao.com>",
|
||||
"created": "2021-05-02 17:25:55",
|
||||
"frontenddir": "frontend",
|
||||
"serve": "npm run serve",
|
||||
"bridge": "src",
|
||||
"wailsdir": "",
|
||||
"platforms": [
|
||||
"linux",
|
||||
"darwin"
|
||||
]
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"github.com/leaanthony/mewn"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
@@ -9,14 +9,11 @@ func basic() string {
|
||||
return "Hello World!"
|
||||
}
|
||||
|
||||
//go:embed frontend/dist/app.js
|
||||
var js string
|
||||
|
||||
//go:embed frontend/dist/app.css
|
||||
var css string
|
||||
|
||||
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,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"github.com/leaanthony/mewn"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
@@ -9,14 +9,11 @@ func basic() string {
|
||||
return "Hello World!"
|
||||
}
|
||||
|
||||
//go:embed frontend/dist/app.js
|
||||
var js string
|
||||
|
||||
//go:embed frontend/dist/app.css
|
||||
var css string
|
||||
|
||||
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,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
_ "embed"
|
||||
"github.com/leaanthony/mewn"
|
||||
"github.com/wailsapp/wails"
|
||||
)
|
||||
|
||||
@@ -9,14 +9,11 @@ func basic() string {
|
||||
return "Hello World!"
|
||||
}
|
||||
|
||||
//go:embed frontend/dist/app.js
|
||||
var js string
|
||||
|
||||
//go:embed frontend/dist/app.css
|
||||
var css string
|
||||
|
||||
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,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package cmd
|
||||
|
||||
// Version - Wails version
|
||||
const Version = "v1.16.9"
|
||||
const Version = "v1.11.0"
|
||||
|
||||
@@ -39,6 +39,12 @@ Create your first project by running 'wails init'.`
|
||||
return err
|
||||
}
|
||||
|
||||
// Check Mewn
|
||||
err = cmd.CheckMewn(false)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Check for errors
|
||||
// CheckDependencies() returns !errors
|
||||
// so to get the right message in this
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
//go:build dev
|
||||
// +build dev
|
||||
|
||||
package main
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
//go:build dev
|
||||
// +build dev
|
||||
|
||||
package main
|
||||
|
||||
@@ -3,6 +3,7 @@ package main
|
||||
import (
|
||||
"bufio"
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -304,7 +305,7 @@ func updateWailsVersion(currentVersion, latestVersion *semver.Version) error {
|
||||
new := fmt.Sprintf("%s v%s", wailsModule, latestVersion)
|
||||
|
||||
goMod = strings.Replace(goMod, old, new, -1)
|
||||
err := os.WriteFile(goModFile, []byte(goMod), 0600)
|
||||
err := ioutil.WriteFile(goModFile, []byte(goMod), 0600)
|
||||
if err != nil {
|
||||
checkSpinner.Error()
|
||||
return err
|
||||
@@ -342,7 +343,7 @@ func patchMainJS() error {
|
||||
newStartLine := `Wails.Init`
|
||||
mainJSContents = strings.Replace(mainJSContents, oldStartLine, newStartLine, -1)
|
||||
|
||||
err := os.WriteFile(mainJSFile, []byte(mainJSContents), 0600)
|
||||
err := ioutil.WriteFile(mainJSFile, []byte(mainJSContents), 0600)
|
||||
if err != nil {
|
||||
checkSpinner.Error()
|
||||
return err
|
||||
|
||||
@@ -15,7 +15,6 @@ func init() {
|
||||
projectOptions := projectHelper.NewProjectOptions()
|
||||
commandDescription := `Generates a new Wails project using the given flags.
|
||||
Any flags that are required and not given will be prompted for.`
|
||||
build := false
|
||||
|
||||
initCommand := app.Command("init", "Initialises a new Wails project").
|
||||
LongDescription(commandDescription).
|
||||
@@ -24,8 +23,7 @@ Any flags that are required and not given will be prompted for.`
|
||||
StringFlag("template", "Template name", &projectOptions.Template).
|
||||
StringFlag("name", "Project name", &projectOptions.Name).
|
||||
StringFlag("description", "Project description", &projectOptions.Description).
|
||||
StringFlag("output", "Output binary name", &projectOptions.BinaryName).
|
||||
BoolFlag("build", "Build project after generating", &build)
|
||||
StringFlag("output", "Output binary name", &projectOptions.BinaryName)
|
||||
|
||||
initCommand.Action(func() error {
|
||||
|
||||
@@ -66,10 +64,6 @@ Any flags that are required and not given will be prompted for.`
|
||||
return err
|
||||
}
|
||||
genSpinner.Success()
|
||||
if !build {
|
||||
logger.Yellow("Project '%s' initialised. Run `wails build` to build it.", projectOptions.Name)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Build the project
|
||||
cwd, _ := os.Getwd()
|
||||
|
||||
@@ -2,7 +2,6 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
@@ -53,10 +52,7 @@ func init() {
|
||||
|
||||
var b strings.Builder
|
||||
for _, plat := range getSupportedPlatforms() {
|
||||
_, err := fmt.Fprintf(&b, " - %s\n", plat)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Fprintf(&b, " - %s\n", plat)
|
||||
}
|
||||
initCmd.StringFlag("x",
|
||||
fmt.Sprintf("Cross-compile application to specified platform via xgo\n%s", b.String()),
|
||||
@@ -84,7 +80,7 @@ func init() {
|
||||
fs := cmd.NewFSHelper()
|
||||
err := projectOptions.LoadConfig(fs.Cwd())
|
||||
if err != nil {
|
||||
return fmt.Errorf("unable to find 'project.json'. Please check you are in a Wails project directory")
|
||||
return fmt.Errorf("Unable to find 'project.json'. Please check you are in a Wails project directory")
|
||||
}
|
||||
|
||||
// Set firebug flag
|
||||
@@ -147,6 +143,12 @@ func init() {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Ensure that runtime init.js is the production version
|
||||
err = cmd.InstallProdRuntime(projectDir, projectOptions)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
// Move to project directory
|
||||
|
||||
@@ -27,13 +27,19 @@ func init() {
|
||||
logger.PrintSmallBanner(message)
|
||||
fmt.Println()
|
||||
|
||||
// Check Mewn is installed
|
||||
err := cmd.CheckMewn(verbose)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Project options
|
||||
projectOptions := &cmd.ProjectOptions{}
|
||||
|
||||
// Check we are in project directory
|
||||
// Check project.json loads correctly
|
||||
fs := cmd.NewFSHelper()
|
||||
err := projectOptions.LoadConfig(fs.Cwd())
|
||||
err = projectOptions.LoadConfig(fs.Cwd())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
@@ -112,7 +112,7 @@ To help you in this process, we will ask for some information, add Go/Wails deta
|
||||
os.Exit(1)
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
template, _ := io.ReadAll(resp.Body)
|
||||
template, _ := ioutil.ReadAll(resp.Body)
|
||||
body := string(template)
|
||||
body = "**Description**\n" + (strings.Split(body, "**Description**")[1])
|
||||
fullURL := "https://github.com/wailsapp/wails/issues/new?"
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
//go:build windows
|
||||
// +build windows
|
||||
|
||||
package cmd
|
||||
|
||||
55
config.go
@@ -31,18 +31,6 @@ type AppConfig struct {
|
||||
// Indicates whether your app should be resizable
|
||||
Resizable bool
|
||||
|
||||
// Minimum width of a resizable window. If set, MinHeight should also be set.
|
||||
MinWidth int
|
||||
|
||||
// Minimum height of a resizable window. If set, MinWidth should also be set.
|
||||
MinHeight int
|
||||
|
||||
// Maximum width of a resizable window. If set, MaxHeight should also be set.
|
||||
MaxWidth int
|
||||
|
||||
// Maximum height of a resizable window. If set, MaxWidth should also be set.
|
||||
MaxHeight int
|
||||
|
||||
// Indicated if the devtools should be disabled
|
||||
DisableInspector bool
|
||||
}
|
||||
@@ -77,26 +65,6 @@ func (a *AppConfig) GetResizable() bool {
|
||||
return a.Resizable
|
||||
}
|
||||
|
||||
// GetMinWidth returns the minimum width of the window
|
||||
func (a *AppConfig) GetMinWidth() int {
|
||||
return a.MinWidth
|
||||
}
|
||||
|
||||
// GetMinHeight returns the minimum height of the window
|
||||
func (a *AppConfig) GetMinHeight() int {
|
||||
return a.MinHeight
|
||||
}
|
||||
|
||||
// GetMaxWidth returns the maximum width of the window
|
||||
func (a *AppConfig) GetMaxWidth() int {
|
||||
return a.MaxWidth
|
||||
}
|
||||
|
||||
// GetMaxHeight returns the maximum height of the window
|
||||
func (a *AppConfig) GetMaxHeight() int {
|
||||
return a.MaxHeight
|
||||
}
|
||||
|
||||
// GetDisableInspector returns true if the inspector should be disabled
|
||||
func (a *AppConfig) GetDisableInspector() bool {
|
||||
return a.DisableInspector
|
||||
@@ -147,23 +115,6 @@ func (a *AppConfig) merge(in *AppConfig) error {
|
||||
if in.Height != 0 {
|
||||
a.Height = in.Height
|
||||
}
|
||||
|
||||
if in.MinWidth != 0 {
|
||||
a.MinWidth = in.MinWidth
|
||||
}
|
||||
|
||||
if in.MinHeight != 0 {
|
||||
a.MinHeight = in.MinHeight
|
||||
}
|
||||
|
||||
if in.MaxWidth != 0 {
|
||||
a.MaxWidth = in.MaxWidth
|
||||
}
|
||||
|
||||
if in.MaxHeight != 0 {
|
||||
a.MaxHeight = in.MaxHeight
|
||||
}
|
||||
|
||||
a.Resizable = in.Resizable
|
||||
a.DisableInspector = in.DisableInspector
|
||||
|
||||
@@ -176,12 +127,8 @@ func newConfig(userConfig *AppConfig) (*AppConfig, error) {
|
||||
Width: 800,
|
||||
Height: 600,
|
||||
Resizable: true,
|
||||
MinWidth: -1,
|
||||
MinHeight: -1,
|
||||
MaxWidth: -1,
|
||||
MaxHeight: -1,
|
||||
Title: "My Wails App",
|
||||
Colour: "",
|
||||
Colour: "#FFF", // White by default
|
||||
HTML: defaultHTML,
|
||||
}
|
||||
|
||||
|
||||
10
go.mod
@@ -5,9 +5,11 @@ require (
|
||||
github.com/abadojack/whatlanggo v1.0.1
|
||||
github.com/fatih/color v1.7.0
|
||||
github.com/go-playground/colors v1.2.0
|
||||
github.com/gorilla/websocket v1.4.1
|
||||
github.com/gorilla/websocket v1.4.0
|
||||
github.com/jackmordaunt/icns v1.0.0
|
||||
github.com/kennygrant/sanitize v1.2.4
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
|
||||
github.com/leaanthony/mewn v0.10.7
|
||||
github.com/leaanthony/slicer v1.4.0
|
||||
github.com/leaanthony/spinner v0.5.3
|
||||
github.com/mattn/go-colorable v0.1.1 // indirect
|
||||
@@ -15,15 +17,15 @@ require (
|
||||
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
|
||||
github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4
|
||||
github.com/pkg/errors v0.8.1 // indirect
|
||||
github.com/sirupsen/logrus v1.8.1
|
||||
github.com/sirupsen/logrus v1.4.1
|
||||
github.com/stretchr/testify v1.3.0 // indirect
|
||||
github.com/syossan27/tebata v0.0.0-20180602121909-b283fe4bc5ba
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344 // indirect
|
||||
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359
|
||||
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c
|
||||
golang.org/x/text v0.3.0
|
||||
gopkg.in/AlecAivazis/survey.v1 v1.8.4
|
||||
gopkg.in/yaml.v3 v3.0.0-20190709130402-674ba3eaed22
|
||||
)
|
||||
|
||||
go 1.16
|
||||
go 1.13
|
||||
|
||||
22
go.sum
@@ -11,8 +11,8 @@ github.com/fatih/color v1.7.0 h1:DkWD4oS2D8LGGgTQ6IvwJJXSL5Vp2ffcQg58nFV38Ys=
|
||||
github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=
|
||||
github.com/go-playground/colors v1.2.0 h1:0EdjTXKrr2g1L/LQTYtIqabeHpZuGZz1U4osS1T8+5M=
|
||||
github.com/go-playground/colors v1.2.0/go.mod h1:miw1R2JIE19cclPxsXqNdzLZsk4DP4iF+m88bRc7kfM=
|
||||
github.com/gorilla/websocket v1.4.1 h1:q7AeDBpnBk8AogcD4DSag/Ukw/KV+YhzLj2bP5HvKCM=
|
||||
github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q=
|
||||
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ=
|
||||
github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174 h1:WlZsjVhE8Af9IcZDGgJGQpNflI3+MJSBhsgT5PCtzBQ=
|
||||
github.com/hinshun/vt10x v0.0.0-20180616224451-1954e6464174/go.mod h1:DqJ97dSdRW1W22yXSB90986pcOyQ7r45iio1KN2ez1A=
|
||||
github.com/jackmordaunt/icns v1.0.0 h1:RYSxplerf/l/DUd09AHtITwckkv/mqjVv4DjYdPmAMQ=
|
||||
@@ -21,8 +21,13 @@ github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51 h1:Z9n2FFNU
|
||||
github.com/kballard/go-shellquote v0.0.0-20180428030007-95032a82bc51/go.mod h1:CzGEWj7cYgsdH8dAjBGEr58BoE7ScuLd+fwFZ44+/x8=
|
||||
github.com/kennygrant/sanitize v1.2.4 h1:gN25/otpP5vAsO2djbMhF/LQX6R7+O1TB4yv8NzpJ3o=
|
||||
github.com/kennygrant/sanitize v1.2.4/go.mod h1:LGsjYYtgxbetdg5owWB2mpgUL6e2nfw2eObZ0u0qvak=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2 h1:DB17ag19krx9CFsz4o3enTrPXyIXCl+2iCXH/aMAp9s=
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
||||
github.com/kr/pty v1.1.1 h1:VkoXIwSboBpnk99O/KFauAEILuNHv5DVFKZMBN/gUgw=
|
||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
||||
github.com/leaanthony/mewn v0.10.7 h1:jCcNJyIUOpwj+I5SuATvCugDjHkoo+j6ubEOxxrxmPA=
|
||||
github.com/leaanthony/mewn v0.10.7/go.mod h1:CRkTx8unLiSSilu/Sd7i1LwrdaAL+3eQ3ses99qGMEQ=
|
||||
github.com/leaanthony/slicer v1.4.0 h1:Q9u4w+UBU4WHjXnEDdz+eRLMKF/rnyosRBiqULnc1J8=
|
||||
github.com/leaanthony/slicer v1.4.0/go.mod h1:FwrApmf8gOrpzEWM2J/9Lh79tyq8KTX5AzRtwV7m4AY=
|
||||
github.com/leaanthony/spinner v0.5.3 h1:IMTvgdQCec5QA4qRy0wil4XsRP+QcG1OwLWVK/LPZ5Y=
|
||||
@@ -49,9 +54,10 @@ github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I=
|
||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||
github.com/sirupsen/logrus v1.8.1 h1:dJKuHgqk1NNQlqoA6BTlM1Wf9DOH3NBjQyu0h9+AZZE=
|
||||
github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
|
||||
github.com/sirupsen/logrus v1.4.1 h1:GL2rEmy6nsikmW0r8opw9JIRScdMF5hA8cOYLH7In1k=
|
||||
github.com/sirupsen/logrus v1.4.1/go.mod h1:ni0Sbl8bgC9z8RoU9G6nDWqqs/fq4eDPysMBDgk/93Q=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.2.1/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
|
||||
@@ -60,6 +66,7 @@ github.com/syossan27/tebata v0.0.0-20180602121909-b283fe4bc5ba h1:2DHfQOxcpWdGf5
|
||||
github.com/syossan27/tebata v0.0.0-20180602121909-b283fe4bc5ba/go.mod h1:iLnlXG2Pakcii2CU0cbY07DRCSvpWNa7nFxtevhOChk=
|
||||
golang.org/x/crypto v0.0.0-20190123085648-057139ce5d2b/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8 h1:6WW6V3x1P/jokJBpRQYUJnMHRP6isStQwCozxnU7XQw=
|
||||
golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
|
||||
@@ -67,14 +74,15 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344 h1:vGXIOMxbNfDTk/aXCmfdLgkrSV+Z2tcbze+pEc3v5W4=
|
||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
||||
golang.org/x/sys v0.0.0-20180606202747-9527bec2660b/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20181228144115-9a3f9b0469bb/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
|
||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359 h1:2B5p2L5IfGiD7+b9BOoRMC6DgObAVZV+Fsp050NqXik=
|
||||
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c h1:UIcGWL6/wpCfyGuJnRFJRurA+yj8RrW7Q6x2YMCXt6c=
|
||||
golang.org/x/sys v0.0.0-20200724161237-0e2f3a69832c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/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=
|
||||
|
||||
|
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
@@ -6,7 +6,6 @@ import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/wailsapp/wails/lib/logger"
|
||||
)
|
||||
@@ -28,10 +27,6 @@ func newBoundFunction(object interface{}) (*boundFunction, error) {
|
||||
objectType := reflect.TypeOf(object)
|
||||
|
||||
name := runtime.FuncForPC(objectValue.Pointer()).Name()
|
||||
if strings.Contains(name, "/") {
|
||||
parts := strings.Split(name, "/")
|
||||
name = parts[len(parts)-1]
|
||||
}
|
||||
|
||||
result := &boundFunction{
|
||||
fullName: name,
|
||||
|
||||
@@ -2,6 +2,7 @@ package binding
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"reflect"
|
||||
@@ -114,15 +115,15 @@ func (b *Manager) generateTypescriptDefinitions() error {
|
||||
|
||||
for structname, methodList := range b.structList {
|
||||
structname = strings.SplitN(structname, ".", 2)[1]
|
||||
output.WriteString(fmt.Sprintf("interface %s {\n", structname))
|
||||
output.WriteString(fmt.Sprintf("Interface %s {\n", structname))
|
||||
for _, method := range methodList {
|
||||
output.WriteString(fmt.Sprintf("\t%s(...args : any[]):Promise<any>\n", method))
|
||||
output.WriteString(fmt.Sprintf("\t%s: (...args : any[]) => Promise\n", method))
|
||||
}
|
||||
output.WriteString("}\n")
|
||||
}
|
||||
|
||||
output.WriteString("\n")
|
||||
output.WriteString("interface Backend {\n")
|
||||
output.WriteString("Interface Backend {\n")
|
||||
|
||||
for structname := range b.structList {
|
||||
structname = strings.SplitN(structname, ".", 2)[1]
|
||||
@@ -135,15 +136,14 @@ declare global {
|
||||
interface Window {
|
||||
backend: Backend;
|
||||
}
|
||||
}
|
||||
export {};`
|
||||
}`
|
||||
output.WriteString(globals)
|
||||
|
||||
b.log.Info("Written Typescript file: " + typescriptDefinitionFilename)
|
||||
|
||||
dir := filepath.Dir(typescriptDefinitionFilename)
|
||||
os.MkdirAll(dir, 0755)
|
||||
return os.WriteFile(typescriptDefinitionFilename, []byte(output.String()), 0755)
|
||||
return ioutil.WriteFile(typescriptDefinitionFilename, []byte(output.String()), 0755)
|
||||
}
|
||||
|
||||
// bind the given struct method
|
||||
|
||||
@@ -18,7 +18,6 @@ type Manager struct {
|
||||
log *logger.CustomLogger
|
||||
renderer interfaces.Renderer // Messages will be dispatched to the frontend
|
||||
wg sync.WaitGroup
|
||||
mu sync.Mutex
|
||||
}
|
||||
|
||||
// NewManager creates a new event manager with a 100 event buffer
|
||||
@@ -43,32 +42,32 @@ func (e *Manager) PushEvent(eventData *messages.EventData) {
|
||||
// means it does not expire (default).
|
||||
type eventListener struct {
|
||||
callback func(...interface{}) // Function to call with emitted event data
|
||||
counter uint // Expire after counter callbacks. 0 = infinite
|
||||
counter int // Expire after counter callbacks. 0 = infinite
|
||||
expired bool // Indicates if the listener has expired
|
||||
}
|
||||
|
||||
// Creates a new event listener from the given callback function
|
||||
func (e *Manager) addEventListener(eventName string, callback func(...interface{}), counter uint) error {
|
||||
func (e *Manager) addEventListener(eventName string, callback func(...interface{}), counter int) error {
|
||||
|
||||
// Sanity check inputs
|
||||
if callback == nil {
|
||||
return fmt.Errorf("nil callback bassed to addEventListener")
|
||||
}
|
||||
|
||||
// Check event has been registered before
|
||||
if e.listeners[eventName] == nil {
|
||||
e.listeners[eventName] = []*eventListener{}
|
||||
}
|
||||
|
||||
// Create the callback
|
||||
listener := &eventListener{
|
||||
callback: callback,
|
||||
counter: counter,
|
||||
}
|
||||
e.mu.Lock()
|
||||
// Check event has been registered before
|
||||
if e.listeners[eventName] == nil {
|
||||
e.listeners[eventName] = []*eventListener{}
|
||||
}
|
||||
|
||||
// Register listener
|
||||
e.listeners[eventName] = append(e.listeners[eventName], listener)
|
||||
e.mu.Unlock()
|
||||
|
||||
// All good mate
|
||||
return nil
|
||||
}
|
||||
@@ -76,30 +75,7 @@ func (e *Manager) addEventListener(eventName string, callback func(...interface{
|
||||
// On adds a listener for the given event
|
||||
func (e *Manager) On(eventName string, callback func(...interface{})) {
|
||||
// Add a persistent eventListener (counter = 0)
|
||||
err := e.addEventListener(eventName, callback, 0)
|
||||
if err != nil {
|
||||
e.log.Error(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
// Once adds a listener for the given event that will auto remove
|
||||
// after one callback
|
||||
func (e *Manager) Once(eventName string, callback func(...interface{})) {
|
||||
// Add a persistent eventListener (counter = 0)
|
||||
err := e.addEventListener(eventName, callback, 1)
|
||||
if err != nil {
|
||||
e.log.Error(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
// OnMultiple adds a listener for the given event that will trigger
|
||||
// at most <counter> times.
|
||||
func (e *Manager) OnMultiple(eventName string, callback func(...interface{}), counter uint) {
|
||||
// Add a persistent eventListener (counter = 0)
|
||||
err := e.addEventListener(eventName, callback, counter)
|
||||
if err != nil {
|
||||
e.log.Error(err.Error())
|
||||
}
|
||||
e.addEventListener(eventName, callback, 0)
|
||||
}
|
||||
|
||||
// Emit broadcasts the given event to the subscribed listeners
|
||||
@@ -132,24 +108,20 @@ func (e *Manager) Start(renderer interfaces.Renderer) {
|
||||
})
|
||||
|
||||
// Notify renderer
|
||||
err := e.renderer.NotifyEvent(event)
|
||||
if err != nil {
|
||||
e.log.Error(err.Error())
|
||||
}
|
||||
e.renderer.NotifyEvent(event)
|
||||
|
||||
e.mu.Lock()
|
||||
// Notify Go listeners
|
||||
var listenersToRemove []*eventListener
|
||||
|
||||
// Iterate listeners
|
||||
for _, listener := range e.listeners[event.Name] {
|
||||
|
||||
if !listener.expired {
|
||||
// Call listener, perhaps with data
|
||||
if event.Data == nil {
|
||||
go listener.callback()
|
||||
} else {
|
||||
unpacked := event.Data.([]interface{})
|
||||
go listener.callback(unpacked...)
|
||||
}
|
||||
// Call listener, perhaps with data
|
||||
if event.Data == nil {
|
||||
go listener.callback()
|
||||
} else {
|
||||
unpacked := event.Data.([]interface{})
|
||||
go listener.callback(unpacked...)
|
||||
}
|
||||
|
||||
// Update listen counter
|
||||
@@ -161,8 +133,15 @@ func (e *Manager) Start(renderer interfaces.Renderer) {
|
||||
}
|
||||
}
|
||||
|
||||
e.mu.Unlock()
|
||||
|
||||
// Remove expired listeners in place
|
||||
if len(listenersToRemove) > 0 {
|
||||
listeners := e.listeners[event.Name][:0]
|
||||
for _, listener := range listeners {
|
||||
if !listener.expired {
|
||||
listeners = append(listeners, listener)
|
||||
}
|
||||
}
|
||||
}
|
||||
case <-e.quitChannel:
|
||||
e.running = false
|
||||
}
|
||||
|
||||
@@ -5,10 +5,6 @@ type AppConfig interface {
|
||||
GetWidth() int
|
||||
GetHeight() int
|
||||
GetTitle() string
|
||||
GetMinWidth() int
|
||||
GetMinHeight() int
|
||||
GetMaxWidth() int
|
||||
GetMaxHeight() int
|
||||
GetResizable() bool
|
||||
GetHTML() string
|
||||
GetDisableInspector() bool
|
||||
|
||||
@@ -6,8 +6,6 @@ import "github.com/wailsapp/wails/lib/messages"
|
||||
type EventManager interface {
|
||||
PushEvent(*messages.EventData)
|
||||
Emit(eventName string, optionalData ...interface{})
|
||||
OnMultiple(eventName string, callback func(...interface{}), counter uint)
|
||||
Once(eventName string, callback func(...interface{}))
|
||||
On(eventName string, callback func(...interface{}))
|
||||
Start(Renderer)
|
||||
Shutdown()
|
||||
|
||||
@@ -22,10 +22,6 @@ type Renderer interface {
|
||||
|
||||
// Window Runtime
|
||||
SetColour(string) error
|
||||
|
||||
SetMinSize(width, height int)
|
||||
SetMaxSize(width, height int)
|
||||
|
||||
Fullscreen()
|
||||
UnFullscreen()
|
||||
SetTitle(title string)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package interfaces
|
||||
|
||||
// Runtime interface
|
||||
type Runtime interface{}
|
||||
type Runtime interface {}
|
||||
@@ -186,18 +186,6 @@ func (h *Bridge) SetColour(colour string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetMinSize is unsupported for Bridge but required
|
||||
// for the Renderer interface
|
||||
func (h *Bridge) SetMinSize(width, height int) {
|
||||
h.log.Warn("SetMinSize() unsupported in bridge mode")
|
||||
}
|
||||
|
||||
// SetMaxSize is unsupported for Bridge but required
|
||||
// for the Renderer interface
|
||||
func (h *Bridge) SetMaxSize(width, height int) {
|
||||
h.log.Warn("SetMaxSize() unsupported in bridge mode")
|
||||
}
|
||||
|
||||
// Fullscreen is unsupported for Bridge but required
|
||||
// for the Renderer interface
|
||||
func (h *Bridge) Fullscreen() {
|
||||
|
||||
9
lib/renderer/bridge/renderer-mewn.go
Normal file
@@ -3,9 +3,8 @@ package renderer
|
||||
import (
|
||||
"time"
|
||||
|
||||
"github.com/wailsapp/wails/runtime"
|
||||
|
||||
"github.com/gorilla/websocket"
|
||||
"github.com/leaanthony/mewn"
|
||||
"github.com/wailsapp/wails/lib/interfaces"
|
||||
"github.com/wailsapp/wails/lib/logger"
|
||||
)
|
||||
@@ -59,7 +58,8 @@ func (s *session) start(firstSession bool) {
|
||||
s.log.Infof("Connected to frontend.")
|
||||
go s.writePump()
|
||||
|
||||
s.evalJS(runtime.WailsJS, wailsRuntimeMessage)
|
||||
wailsRuntime := mewn.String("../../runtime/assets/wails.js")
|
||||
s.evalJS(wailsRuntime, wailsRuntimeMessage)
|
||||
|
||||
// Inject bindings
|
||||
for _, binding := range s.bindingCache {
|
||||
|
||||
10
lib/renderer/renderer-mewn.go
Normal file
@@ -8,9 +8,8 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/wailsapp/wails/runtime"
|
||||
|
||||
"github.com/go-playground/colors"
|
||||
"github.com/leaanthony/mewn"
|
||||
"github.com/wailsapp/wails/lib/interfaces"
|
||||
"github.com/wailsapp/wails/lib/logger"
|
||||
"github.com/wailsapp/wails/lib/messages"
|
||||
@@ -24,13 +23,12 @@ import (
|
||||
var UseFirebug = ""
|
||||
|
||||
type WebView struct {
|
||||
window wv.WebView // The webview object
|
||||
ipc interfaces.IPCManager
|
||||
log *logger.CustomLogger
|
||||
config interfaces.AppConfig
|
||||
eventManager interfaces.EventManager
|
||||
bindingCache []string
|
||||
maximumSizeSet bool
|
||||
window wv.WebView // The webview object
|
||||
ipc interfaces.IPCManager
|
||||
log *logger.CustomLogger
|
||||
config interfaces.AppConfig
|
||||
eventManager interfaces.EventManager
|
||||
bindingCache []string
|
||||
}
|
||||
|
||||
// NewWebView returns a new WebView struct
|
||||
@@ -54,37 +52,10 @@ func (w *WebView) Initialise(config interfaces.AppConfig, ipc interfaces.IPCMana
|
||||
// Save the config
|
||||
w.config = config
|
||||
|
||||
width := config.GetWidth()
|
||||
height := config.GetHeight()
|
||||
|
||||
// Clamp width and height
|
||||
minWidth, minHeight := config.GetMinWidth(), config.GetMinHeight()
|
||||
maxWidth, maxHeight := config.GetMaxWidth(), config.GetMaxHeight()
|
||||
setMinSize := minWidth != -1 && minHeight != -1
|
||||
setMaxSize := maxWidth != -1 && maxHeight != -1
|
||||
|
||||
if setMinSize {
|
||||
if width < minWidth {
|
||||
width = minWidth
|
||||
}
|
||||
if height < minHeight {
|
||||
height = minHeight
|
||||
}
|
||||
}
|
||||
|
||||
if setMaxSize {
|
||||
if width > maxWidth {
|
||||
width = maxWidth
|
||||
}
|
||||
if height > maxHeight {
|
||||
height = maxHeight
|
||||
}
|
||||
}
|
||||
|
||||
// Create the WebView instance
|
||||
w.window = wv.NewWebview(wv.Settings{
|
||||
Width: width,
|
||||
Height: height,
|
||||
Width: config.GetWidth(),
|
||||
Height: config.GetHeight(),
|
||||
Title: config.GetTitle(),
|
||||
Resizable: config.GetResizable(),
|
||||
URL: config.GetHTML(),
|
||||
@@ -94,31 +65,12 @@ func (w *WebView) Initialise(config interfaces.AppConfig, ipc interfaces.IPCMana
|
||||
},
|
||||
})
|
||||
|
||||
// Set minimum and maximum sizes
|
||||
if setMinSize {
|
||||
w.SetMinSize(minWidth, minHeight)
|
||||
}
|
||||
if setMaxSize {
|
||||
w.SetMaxSize(maxWidth, maxHeight)
|
||||
}
|
||||
|
||||
// Set minimum and maximum sizes
|
||||
if setMinSize {
|
||||
w.SetMinSize(minWidth, minHeight)
|
||||
}
|
||||
if setMaxSize {
|
||||
w.SetMaxSize(maxWidth, maxHeight)
|
||||
}
|
||||
|
||||
// SignalManager.OnExit(w.Exit)
|
||||
|
||||
// Set colour
|
||||
color := config.GetColour()
|
||||
if color != "" {
|
||||
err := w.SetColour(color)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err := w.SetColour(config.GetColour())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
w.log.Info("Initialised")
|
||||
@@ -231,8 +183,8 @@ func (w *WebView) Run() error {
|
||||
}
|
||||
|
||||
// Runtime assets
|
||||
w.log.DebugFields("Injecting wails JS runtime", logger.Fields{"js": runtime.WailsJS})
|
||||
w.evalJS(runtime.WailsJS)
|
||||
wailsRuntime := mewn.String("../../runtime/assets/wails.js")
|
||||
w.evalJS(wailsRuntime)
|
||||
|
||||
// Ping the wait channel when the wails runtime is loaded
|
||||
w.eventManager.On("wails:loaded", func(...interface{}) {
|
||||
@@ -255,9 +207,10 @@ func (w *WebView) Run() error {
|
||||
w.injectCSS(w.config.GetCSS())
|
||||
} else {
|
||||
// Use default wails css
|
||||
w.log.Debug("Injecting Default Wails CSS")
|
||||
defaultCSS := mewn.String("../../runtime/assets/wails.css")
|
||||
|
||||
w.log.Debug("Injecting Default Wails CSS: " + runtime.WailsCSS)
|
||||
w.injectCSS(runtime.WailsCSS)
|
||||
w.injectCSS(defaultCSS)
|
||||
}
|
||||
|
||||
// Inject user JS
|
||||
@@ -303,9 +256,6 @@ func (w *WebView) SelectFile(title string, filter string) string {
|
||||
wg.Done()
|
||||
})
|
||||
}()
|
||||
|
||||
defer w.focus() // Ensure the main window is put back into focus afterwards
|
||||
|
||||
wg.Wait()
|
||||
return result
|
||||
}
|
||||
@@ -324,9 +274,6 @@ func (w *WebView) SelectDirectory() string {
|
||||
wg.Done()
|
||||
})
|
||||
}()
|
||||
|
||||
defer w.focus() // Ensure the main window is put back into focus afterwards
|
||||
|
||||
wg.Wait()
|
||||
return result
|
||||
}
|
||||
@@ -345,20 +292,10 @@ func (w *WebView) SelectSaveFile(title string, filter string) string {
|
||||
wg.Done()
|
||||
})
|
||||
}()
|
||||
|
||||
defer w.focus() // Ensure the main window is put back into focus afterwards
|
||||
|
||||
wg.Wait()
|
||||
return result
|
||||
}
|
||||
|
||||
// focus puts the main window into focus
|
||||
func (w *WebView) focus() {
|
||||
w.window.Dispatch(func() {
|
||||
w.window.Focus()
|
||||
})
|
||||
}
|
||||
|
||||
// callback sends a callback to the frontend
|
||||
func (w *WebView) callback(data string) error {
|
||||
callbackCMD := fmt.Sprintf("window.wails._.Callback('%s');", data)
|
||||
@@ -400,37 +337,11 @@ func (w *WebView) NotifyEvent(event *messages.EventData) error {
|
||||
return w.evalJS(message)
|
||||
}
|
||||
|
||||
// SetMinSize sets the minimum size of a resizable window
|
||||
func (w *WebView) SetMinSize(width, height int) {
|
||||
if w.config.GetResizable() == false {
|
||||
w.log.Warn("Cannot call SetMinSize() - App.Resizable = false")
|
||||
return
|
||||
}
|
||||
w.window.Dispatch(func() {
|
||||
w.window.SetMinSize(width, height)
|
||||
})
|
||||
}
|
||||
|
||||
// SetMaxSize sets the maximum size of a resizable window
|
||||
func (w *WebView) SetMaxSize(width, height int) {
|
||||
if w.config.GetResizable() == false {
|
||||
w.log.Warn("Cannot call SetMaxSize() - App.Resizable = false")
|
||||
return
|
||||
}
|
||||
w.maximumSizeSet = true
|
||||
w.window.Dispatch(func() {
|
||||
w.window.SetMaxSize(width, height)
|
||||
})
|
||||
}
|
||||
|
||||
// Fullscreen makes the main window go fullscreen
|
||||
func (w *WebView) Fullscreen() {
|
||||
if w.config.GetResizable() == false {
|
||||
w.log.Warn("Cannot call Fullscreen() - App.Resizable = false")
|
||||
return
|
||||
} else if w.maximumSizeSet {
|
||||
w.log.Warn("Cannot call Fullscreen() - Maximum size of window set")
|
||||
return
|
||||
}
|
||||
w.window.Dispatch(func() {
|
||||
w.window.SetFullscreen(true)
|
||||
|
||||
@@ -65,18 +65,6 @@ static inline void CgoWebViewSetTitle(void *w, char *title) {
|
||||
webview_set_title((struct webview *)w, title);
|
||||
}
|
||||
|
||||
static inline void CgoWebViewFocus(void *w) {
|
||||
webview_focus((struct webview *)w);
|
||||
}
|
||||
|
||||
static inline void CgoWebViewMinSize(void *w, int width, int height) {
|
||||
webview_minsize((struct webview *)w, width, height);
|
||||
}
|
||||
|
||||
static inline void CgoWebViewMaxSize(void *w, int width, int height) {
|
||||
webview_maxsize((struct webview *)w, width, height);
|
||||
}
|
||||
|
||||
static inline void CgoWebViewSetFullscreen(void *w, int fullscreen) {
|
||||
webview_set_fullscreen((struct webview *)w, fullscreen);
|
||||
}
|
||||
@@ -182,16 +170,6 @@ type WebView interface {
|
||||
// SetTitle() changes window title. This method must be called from the main
|
||||
// thread only. See Dispatch() for more details.
|
||||
SetTitle(title string)
|
||||
|
||||
// Focus() puts the main window into focus
|
||||
Focus()
|
||||
|
||||
// SetMinSize() sets the minimum size of the window
|
||||
SetMinSize(width, height int)
|
||||
|
||||
// SetMaxSize() sets the maximum size of the window
|
||||
SetMaxSize(width, height int)
|
||||
|
||||
// SetFullscreen() controls window full-screen mode. This method must be
|
||||
// called from the main thread only. See Dispatch() for more details.
|
||||
SetFullscreen(fullscreen bool)
|
||||
@@ -329,18 +307,6 @@ func (w *webview) SetColor(r, g, b, a uint8) {
|
||||
C.CgoWebViewSetColor(w.w, C.uint8_t(r), C.uint8_t(g), C.uint8_t(b), C.uint8_t(a))
|
||||
}
|
||||
|
||||
func (w *webview) Focus() {
|
||||
C.CgoWebViewFocus(w.w)
|
||||
}
|
||||
|
||||
func (w *webview) SetMinSize(width, height int) {
|
||||
C.CgoWebViewMinSize(w.w, C.int(width), C.int(height))
|
||||
}
|
||||
|
||||
func (w *webview) SetMaxSize(width, height int) {
|
||||
C.CgoWebViewMaxSize(w.w, C.int(width), C.int(height))
|
||||
}
|
||||
|
||||
func (w *webview) SetFullscreen(fullscreen bool) {
|
||||
C.CgoWebViewSetFullscreen(w.w, C.int(boolToInt(fullscreen)))
|
||||
}
|
||||
@@ -387,9 +353,7 @@ func _webviewDispatchGoCallback(index unsafe.Pointer) {
|
||||
f = fns[uintptr(index)]
|
||||
delete(fns, uintptr(index))
|
||||
m.Unlock()
|
||||
if f != nil {
|
||||
f()
|
||||
}
|
||||
f()
|
||||
}
|
||||
|
||||
//export _webviewExternalInvokeCallback
|
||||
@@ -405,7 +369,5 @@ func _webviewExternalInvokeCallback(w unsafe.Pointer, data unsafe.Pointer) {
|
||||
}
|
||||
}
|
||||
m.Unlock()
|
||||
if cb != nil {
|
||||
cb(wv, C.GoString((*C.char)(data)))
|
||||
}
|
||||
cb(wv, C.GoString((*C.char)(data)))
|
||||
}
|
||||
|
||||
@@ -54,11 +54,6 @@ extern "C"
|
||||
int ready;
|
||||
int js_busy;
|
||||
int should_exit;
|
||||
|
||||
int min_width;
|
||||
int min_height;
|
||||
int max_width;
|
||||
int max_height;
|
||||
};
|
||||
#elif defined(WEBVIEW_WINAPI)
|
||||
#define CINTERFACE
|
||||
@@ -80,11 +75,6 @@ struct webview_priv
|
||||
DWORD saved_style;
|
||||
DWORD saved_ex_style;
|
||||
RECT saved_rect;
|
||||
|
||||
int min_width;
|
||||
int min_height;
|
||||
int max_width;
|
||||
int max_height;
|
||||
};
|
||||
#elif defined(WEBVIEW_COCOA)
|
||||
#import <Cocoa/Cocoa.h>
|
||||
@@ -178,9 +168,6 @@ struct webview_priv
|
||||
WEBVIEW_API int webview_eval(struct webview *w, const char *js);
|
||||
WEBVIEW_API int webview_inject_css(struct webview *w, const char *css);
|
||||
WEBVIEW_API void webview_set_title(struct webview *w, const char *title);
|
||||
WEBVIEW_API void webview_focus(struct webview *w);
|
||||
WEBVIEW_API void webview_minsize(struct webview *w, int width, int height);
|
||||
WEBVIEW_API void webview_maxsize(struct webview *w, int width, int height);
|
||||
WEBVIEW_API void webview_set_fullscreen(struct webview *w, int fullscreen);
|
||||
WEBVIEW_API void webview_set_color(struct webview *w, uint8_t r, uint8_t g,
|
||||
uint8_t b, uint8_t a);
|
||||
@@ -342,12 +329,6 @@ struct webview_priv
|
||||
w->priv.should_exit = 0;
|
||||
w->priv.queue = g_async_queue_new();
|
||||
w->priv.window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
|
||||
|
||||
w->priv.min_width = -1;
|
||||
w->priv.min_height = -1;
|
||||
w->priv.max_width = -1;
|
||||
w->priv.max_height = -1;
|
||||
|
||||
gtk_window_set_title(GTK_WINDOW(w->priv.window), w->title);
|
||||
|
||||
if (w->resizable)
|
||||
@@ -415,49 +396,6 @@ struct webview_priv
|
||||
gtk_window_set_title(GTK_WINDOW(w->priv.window), title);
|
||||
}
|
||||
|
||||
WEBVIEW_API void webview_focus(struct webview *w)
|
||||
{
|
||||
gtk_window_present(GTK_WINDOW(w->priv.window));
|
||||
}
|
||||
|
||||
WEBVIEW_API void webview_minsize(struct webview *w, int width, int height) {
|
||||
|
||||
w->priv.min_width = width;
|
||||
w->priv.min_height = height;
|
||||
|
||||
GdkGeometry hints;
|
||||
GdkWindowHints usedHints = (GdkWindowHints) GDK_HINT_MIN_SIZE;
|
||||
|
||||
hints.min_width = w->priv.min_width;
|
||||
hints.min_height = w->priv.min_height;
|
||||
if (w->priv.max_width != -1) {
|
||||
hints.max_width = w->priv.max_width;
|
||||
hints.max_height = w->priv.max_height;
|
||||
usedHints = (GdkWindowHints)(GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
|
||||
}
|
||||
|
||||
gtk_window_set_geometry_hints(GTK_WINDOW(w->priv.window), w->priv.window, &hints, usedHints);
|
||||
}
|
||||
|
||||
WEBVIEW_API void webview_maxsize(struct webview *w, int width, int height) {
|
||||
|
||||
w->priv.max_width = width;
|
||||
w->priv.max_height = height;
|
||||
|
||||
GdkGeometry hints;
|
||||
GdkWindowHints usedHints = (GdkWindowHints) GDK_HINT_MAX_SIZE;
|
||||
|
||||
if (w->priv.min_width != -1) {
|
||||
hints.min_width = w->priv.min_width;
|
||||
hints.min_height = w->priv.min_height;
|
||||
usedHints = (GdkWindowHints)(GDK_HINT_MIN_SIZE | GDK_HINT_MAX_SIZE);
|
||||
}
|
||||
hints.max_width = w->priv.max_width;
|
||||
hints.max_height = w->priv.max_height;
|
||||
|
||||
gtk_window_set_geometry_hints(GTK_WINDOW(w->priv.window), w->priv.window, &hints, usedHints);
|
||||
}
|
||||
|
||||
WEBVIEW_API void webview_set_fullscreen(struct webview *w, int fullscreen)
|
||||
{
|
||||
if (fullscreen)
|
||||
@@ -514,6 +452,7 @@ struct webview_priv
|
||||
}
|
||||
gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dlg), FALSE);
|
||||
gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(dlg), FALSE);
|
||||
gtk_file_chooser_set_show_hidden(GTK_FILE_CHOOSER(dlg), TRUE);
|
||||
gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(dlg), TRUE);
|
||||
gtk_file_chooser_set_create_folders(GTK_FILE_CHOOSER(dlg), TRUE);
|
||||
gint response = gtk_dialog_run(GTK_DIALOG(dlg));
|
||||
@@ -1392,39 +1331,7 @@ struct webview_priv
|
||||
case WM_CREATE:
|
||||
w = (struct webview *)((CREATESTRUCT *)lParam)->lpCreateParams;
|
||||
w->priv.hwnd = hwnd;
|
||||
|
||||
return EmbedBrowserObject(w);
|
||||
case WM_GETMINMAXINFO:
|
||||
{
|
||||
if (w != NULL) {
|
||||
// get pixel density
|
||||
HDC hDC = GetDC(NULL);
|
||||
double DPIScaleX = GetDeviceCaps(hDC, 88)/96.0;
|
||||
double DPIScaleY = GetDeviceCaps(hDC, 90)/96.0;
|
||||
ReleaseDC(NULL, hDC);
|
||||
|
||||
RECT rcClient, rcWind;
|
||||
POINT ptDiff;
|
||||
GetClientRect(hwnd, &rcClient);
|
||||
GetWindowRect(hwnd, &rcWind);
|
||||
|
||||
int widthExtra = (rcWind.right - rcWind.left) - rcClient.right;
|
||||
int heightExtra = (rcWind.bottom - rcWind.top) - rcClient.bottom;
|
||||
|
||||
LPMINMAXINFO lpMMI = (LPMINMAXINFO)lParam;
|
||||
|
||||
if (w->priv.min_width != -1) {
|
||||
lpMMI->ptMinTrackSize.x = w->priv.min_width * DPIScaleX + widthExtra;
|
||||
lpMMI->ptMinTrackSize.y = w->priv.min_height * DPIScaleY + heightExtra;
|
||||
}
|
||||
if (w->priv.max_width != -1) {
|
||||
lpMMI->ptMaxTrackSize.x = w->priv.max_width * DPIScaleX + widthExtra;
|
||||
lpMMI->ptMaxTrackSize.y = w->priv.max_height * DPIScaleY + heightExtra;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
case WM_DESTROY:
|
||||
UnEmbedBrowserObject(w);
|
||||
PostQuitMessage(0);
|
||||
@@ -1489,9 +1396,6 @@ struct webview_priv
|
||||
|
||||
WEBVIEW_API int webview_init(struct webview *w)
|
||||
{
|
||||
w->priv.min_width = -1;
|
||||
w->priv.max_width = -1;
|
||||
|
||||
WNDCLASSEX wc;
|
||||
HINSTANCE hInstance;
|
||||
DWORD style;
|
||||
@@ -1737,21 +1641,6 @@ struct webview_priv
|
||||
#endif
|
||||
}
|
||||
|
||||
WEBVIEW_API void webview_focus(struct webview *w)
|
||||
{
|
||||
SetFocus(w->priv.hwnd);
|
||||
}
|
||||
|
||||
WEBVIEW_API void webview_minsize(struct webview *w, int width, int height) {
|
||||
w->priv.min_width = width;
|
||||
w->priv.min_height = height;
|
||||
}
|
||||
|
||||
WEBVIEW_API void webview_maxsize(struct webview *w, int width, int height) {
|
||||
w->priv.max_width = width;
|
||||
w->priv.max_height = height;
|
||||
}
|
||||
|
||||
WEBVIEW_API void webview_set_fullscreen(struct webview *w, int fullscreen)
|
||||
{
|
||||
if (w->priv.is_fullscreen == !!fullscreen)
|
||||
@@ -2154,10 +2043,6 @@ struct webview_priv
|
||||
objc_setAssociatedObject(w->priv.delegate, "webview", (id)(w),
|
||||
OBJC_ASSOCIATION_ASSIGN);
|
||||
|
||||
// Disable damn smart quotes
|
||||
// Credit: https://stackoverflow.com/a/31640511
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"NSAutomaticQuoteSubstitutionEnabled"];
|
||||
|
||||
NSRect r = NSMakeRect(0, 0, w->width, w->height);
|
||||
NSUInteger style = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable |
|
||||
NSWindowStyleMaskMiniaturizable;
|
||||
@@ -2323,29 +2208,6 @@ struct webview_priv
|
||||
[w->priv.window setTitle:nsTitle];
|
||||
}
|
||||
|
||||
WEBVIEW_API void webview_focus(struct webview *w)
|
||||
{
|
||||
[w->priv.window makeKeyWindow];
|
||||
}
|
||||
|
||||
WEBVIEW_API void webview_minsize(struct webview *w, int width, int height) {
|
||||
NSSize size;
|
||||
size.width = width;
|
||||
size.height = height;
|
||||
[w->priv.window setMinSize:size];
|
||||
}
|
||||
|
||||
WEBVIEW_API void webview_maxsize(struct webview *w, int width, int height) {
|
||||
NSSize size;
|
||||
size.width = width;
|
||||
size.height = height;
|
||||
[w->priv.window setMaxSize:size];
|
||||
|
||||
NSButton *button = [w->priv.window standardWindowButton:NSWindowZoomButton];
|
||||
[button performSelectorOnMainThread:@selector(setEnabled:) withObject:NO
|
||||
waitUntilDone:NO];
|
||||
}
|
||||
|
||||
WEBVIEW_API void webview_set_fullscreen(struct webview *w, int fullscreen)
|
||||
{
|
||||
int b = ((([w->priv.window styleMask] & NSWindowStyleMaskFullScreen) ==
|
||||
@@ -2430,8 +2292,6 @@ struct webview_priv
|
||||
[panel setAllowedFileTypes:fileTypes];
|
||||
}
|
||||
[panel setTreatsFilePackagesAsDirectories:YES];
|
||||
[panel setNameFieldStringValue:@"Temp"]; // Necessary to prevent crash when replacing files
|
||||
[panel setNameFieldStringValue:@"Untitled"];
|
||||
[panel beginSheetModalForWindow:w->priv.window
|
||||
completionHandler:^(NSInteger result) {
|
||||
[NSApp stopModalWithCode:result];
|
||||
|
||||
BIN
logo_cropped.png
Normal file
|
After Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 3.1 KiB |
3
package-lock.json
generated
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"lockfileVersion": 1
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
package runtime
|
||||
|
||||
import _ "embed"
|
||||
|
||||
//go:embed assets/bridge.js
|
||||
var BridgeJS []byte
|
||||
|
||||
//go:embed assets/wails.js
|
||||
var WailsJS string
|
||||
|
||||
//go:embed assets/wails.css
|
||||
var WailsCSS string
|
||||
|
||||
//go:embed js/runtime/init.js
|
||||
var InitJS []byte
|
||||
@@ -19,16 +19,6 @@ func (r *Events) On(eventName string, callback func(optionalData ...interface{})
|
||||
r.eventManager.On(eventName, callback)
|
||||
}
|
||||
|
||||
// Once pass through
|
||||
func (r *Events) Once(eventName string, callback func(optionalData ...interface{})) {
|
||||
r.eventManager.Once(eventName, callback)
|
||||
}
|
||||
|
||||
// OnMultiple pass through
|
||||
func (r *Events) OnMultiple(eventName string, callback func(optionalData ...interface{}), counter uint) {
|
||||
r.eventManager.OnMultiple(eventName, callback, counter)
|
||||
}
|
||||
|
||||
// Emit pass through
|
||||
func (r *Events) Emit(eventName string, optionalData ...interface{}) {
|
||||
r.eventManager.Emit(eventName, optionalData...)
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
"browser": true,
|
||||
"es6": true,
|
||||
"amd": true,
|
||||
"node": true
|
||||
"node": true,
|
||||
},
|
||||
"extends": "eslint:recommended",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2016,
|
||||
"sourceType": "module"
|
||||
"sourceType": "module",
|
||||
},
|
||||
"rules": {
|
||||
"indent": [
|
||||
|
||||
@@ -26,7 +26,7 @@ export function OpenURL(url) {
|
||||
* Opens the given filename using the system's default file handler
|
||||
*
|
||||
* @export
|
||||
* @param {string} filename
|
||||
* @param {sting} filename
|
||||
* @returns
|
||||
*/
|
||||
export function OpenFile(filename) {
|
||||
|
||||
@@ -62,7 +62,7 @@ if (window.crypto) {
|
||||
export function Call(bindingName, data, timeout) {
|
||||
|
||||
// Timeout infinite by default
|
||||
if (timeout == null) {
|
||||
if (timeout == null || timeout == undefined) {
|
||||
timeout = 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ function Invoke(message) {
|
||||
*
|
||||
* @export
|
||||
* @param {string} type
|
||||
* @param {Object} payload
|
||||
* @param {string} payload
|
||||
* @param {string=} callbackID
|
||||
*/
|
||||
export function SendMessage(type, payload, callbackID) {
|
||||
|
||||
@@ -1,40 +1,26 @@
|
||||
/*
|
||||
_ __ _ __
|
||||
_ __ _ __
|
||||
| | / /___ _(_) /____
|
||||
| | /| / / __ `/ / / ___/
|
||||
| |/ |/ / /_/ / / (__ )
|
||||
|__/|__/\__,_/_/_/____/
|
||||
| |/ |/ / /_/ / / (__ )
|
||||
|__/|__/\__,_/_/_/____/
|
||||
The lightweight framework for web-like apps
|
||||
(c) Lea Anthony 2019-present
|
||||
*/
|
||||
/* jshint esversion: 6 */
|
||||
import * as Log from './log';
|
||||
import * as Browser from './browser';
|
||||
import {Acknowledge, Emit, Heartbeat, Notify, On, OnMultiple} from './events';
|
||||
import {NewBinding} from './bindings';
|
||||
import {Callback} from './calls';
|
||||
import {AddScript, InjectCSS, InjectFirebug} from './utils';
|
||||
import {AddIPCListener} from './ipc';
|
||||
import { On, OnMultiple, Emit, Notify, Heartbeat, Acknowledge } from './events';
|
||||
import { NewBinding } from './bindings';
|
||||
import { Callback } from './calls';
|
||||
import { AddScript, InjectCSS, InjectFirebug } from './utils';
|
||||
import { AddIPCListener } from './ipc';
|
||||
import * as Store from './store';
|
||||
|
||||
// Initialise global if not already
|
||||
window.wails = window.wails || {};
|
||||
window.backend = {};
|
||||
|
||||
// On webkit2gtk >= 2.32, the external object is not passed to the window context.
|
||||
// However, IE will throw a strict mode error if window.external is assigned to
|
||||
// so we need to make sure that line of code isn't reached in IE
|
||||
|
||||
// Using !window.external transpiles to `window.external = window.external || ...`
|
||||
// so we have to use an explicit if statement to prevent webpack from optimizing the code.
|
||||
if (window.external == undefined) {
|
||||
window.external = {
|
||||
invoke: function (x) {
|
||||
window.webkit.messageHandlers.external.postMessage(x);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
// Setup internal calls
|
||||
var internal = {
|
||||
NewBinding,
|
||||
@@ -75,7 +61,7 @@ window.onerror = function (msg, url, lineNo, columnNo, error) {
|
||||
};
|
||||
|
||||
// Use firebug?
|
||||
if (window.usefirebug) {
|
||||
if( window.usefirebug ) {
|
||||
InjectFirebug();
|
||||
}
|
||||
|
||||
@@ -85,4 +71,4 @@ Emit('wails:loaded');
|
||||
// Nothing to init in production
|
||||
export function Init(callback) {
|
||||
callback();
|
||||
}
|
||||
}
|
||||