Compare commits

...

40 Commits

Author SHA1 Message Date
Lea Anthony
b0da974a7d [v2] v2.0.0-beta.4 2021-10-02 14:16:40 +10:00
Lea Anthony
b4dc8c252a [v2] update now uses go install 2021-10-02 14:14:07 +10:00
Lea Anthony
afb1d12c3b [v2] Add meta tag to control script injection behaviour 2021-10-02 14:04:59 +10:00
Lea Anthony
7a0cb428f2 Merge pull request #840 from codydbentley/fix-missing-comma-in-bindings
Fixed missing comma that breaks bindings with more than one package
2021-09-30 19:28:56 +10:00
Cody Bentley
e6a89790e3 Fixed missing comma that would break bindings when more than one package exists 2021-09-29 22:04:28 -06:00
Lea Anthony
daede02c16 Merge pull request #776 from wailsapp/dependabot/npm_and_yarn/runtime/js/runtime/path-parse-1.0.7
Bump path-parse from 1.0.6 to 1.0.7 in /runtime/js/runtime
2021-09-30 08:40:10 +10:00
Lea Anthony
417895f40b Merge pull request #826 from wailsapp/dependabot/npm_and_yarn/website/prismjs-1.25.0
Bump prismjs from 1.24.1 to 1.25.0 in /website
2021-09-30 08:39:41 +10:00
Lea Anthony
6bc26aa669 [v2] Add .gitignore to templates 2021-09-30 08:20:32 +10:00
Lea Anthony
a641deb388 [v2] Devserver listen to localhost 2021-09-30 08:00:50 +10:00
Lea Anthony
e013ce14a1 [v2] fix tags in dev mode 2021-09-30 07:11:49 +10:00
Lea Anthony
9930ee10da Revert "Corrected obsolete 'text/javascript' mime to 'application/javascript'"
This reverts commit 23c1ebfac9.
2021-09-30 07:07:13 +10:00
Lea Anthony
de6c57771e [website] update sponsors 2021-09-30 07:01:30 +10:00
Lea Anthony
c8359b0743 [v2] sync go.sum 2021-09-30 07:01:12 +10:00
Lea Anthony
12b7cf09e6 [v2] Support Goland IDE 2021-09-30 07:00:46 +10:00
Lea Anthony
28af34f978 [website] update installation instructions to v2.0.0-beta.3 2021-09-29 20:39:58 +10:00
Lea Anthony
49b1acc147 [v2] v2.0.0-beta.3 2021-09-29 20:24:56 +10:00
Lea Anthony
0ee3015c7d [website] update IDE flag 2021-09-29 20:19:14 +10:00
Lea Anthony
4aa1464b48 [v2] fix module version in templates. Refactor ide flag 2021-09-29 20:15:26 +10:00
Lea Anthony
7b52995c86 Merge pull request #833 from codydbentley/add-js-to-mimecache
Added JS case to mimecache
2021-09-29 18:06:47 +10:00
Cody Bentley
23c1ebfac9 Corrected obsolete 'text/javascript' mime to 'application/javascript' 2021-09-29 01:06:28 -06:00
Cody Bentley
3de31613a1 Added JS case to mimecache 2021-09-29 00:50:49 -06:00
Lea Anthony
9a54f289c4 [v2] v2.0.0-beta.2 2021-09-29 07:25:02 +10:00
Lea Anthony
4a740e6186 [v2] Fix: Remove random C imports 2021-09-28 20:00:42 +10:00
Lea Anthony
34e622455f [v2] Fix: empty content responses 2021-09-28 19:56:08 +10:00
Lea Anthony
b13d8ef9fa [mac] Guard browser.go 2021-09-28 19:44:12 +10:00
Lea Anthony
4898bfdf9c Update release.yml 2021-09-28 06:40:17 +10:00
Lea Anthony
28ff364faa Update pr.yml 2021-09-28 06:39:39 +10:00
Lea Anthony
f254cb086a Update latest-pre.yml 2021-09-28 06:32:05 +10:00
Lea Anthony
15615eb450 Merge pull request #830 from LanguageAgnostic/master
Fix browser.go - minimum version
2021-09-28 05:55:39 +10:00
Soheib El-Harrache
37987b3827 Fix browser.go
Fixed minimum version variable
2021-09-27 15:12:37 -04:00
Lea Anthony
48cf60ac7c [docs] Fix showcase 2021-09-27 23:59:43 +10:00
Lea Anthony
368195e5bd [v2] Fix stats page 2021-09-27 22:05:18 +10:00
Lea Anthony
97765c77e5 [v2] Update README 2021-09-27 21:30:57 +10:00
Lea Anthony
962ad1ea81 [v2] Fix weird chinese character bug 2021-09-27 21:26:56 +10:00
Lea Anthony
eba822da0b [v2] Update discussion board links 2021-09-27 21:22:26 +10:00
Lea Anthony
7b052e7a2d [v2] Update install guide 2021-09-27 21:19:05 +10:00
Lea Anthony
481eaa5ade [v2] beta.1 2021-09-27 21:13:54 +10:00
Lea Anthony
cf8e2ee195 Merge branch 'v2-alpha' 2021-09-27 21:06:09 +10:00
dependabot[bot]
7311868636 Bump prismjs from 1.24.1 to 1.25.0 in /website
Bumps [prismjs](https://github.com/PrismJS/prism) from 1.24.1 to 1.25.0.
- [Release notes](https://github.com/PrismJS/prism/releases)
- [Changelog](https://github.com/PrismJS/prism/blob/master/CHANGELOG.md)
- [Commits](https://github.com/PrismJS/prism/compare/v1.24.1...v1.25.0)

---
updated-dependencies:
- dependency-name: prismjs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-09-27 09:37:34 +00:00
dependabot[bot]
ed4b74f01b Bump path-parse from 1.0.6 to 1.0.7 in /runtime/js/runtime
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-12 21:19:10 +00:00
68 changed files with 709 additions and 159 deletions

View File

@@ -15,11 +15,11 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v1
with:
go-version: 1.16
id: go
- name: Set up Go 1.16
uses: actions/setup-go@v1
with:
go-version: 1.16
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1

View File

@@ -13,11 +13,11 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v1
with:
go-version: 1.16
id: go
- name: Set up Go 1.16
uses: actions/setup-go@v1
with:
go-version: 1.16
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
@@ -29,4 +29,4 @@ jobs:
run: go build -v ./cmd/wails
- name: Test
run: ./wails version
run: ./wails version

View File

@@ -15,11 +15,11 @@ jobs:
os: [ubuntu-latest, windows-latest, macOS-latest]
steps:
- name: Set up Go 1.16
uses: actions/setup-go@v1
with:
go-version: 1.16
id: go
- name: Set up Go 1.16
uses: actions/setup-go@v1
with:
go-version: 1.16
id: go
- name: Check out code into the Go module directory
uses: actions/checkout@v1
@@ -31,4 +31,4 @@ jobs:
run: go build -v ./cmd/wails
- name: Test
run: ./wails version
run: ./wails version

View File

@@ -26,6 +26,8 @@ make this easy for you by handling project creation, compilation and bundling. A
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-2"></span>
## Contents
@@ -117,7 +119,12 @@ This project is supported by these kind people / companies:
<a href="https://github.com/marcus-crane" style="width:50px;border-radius: 50%">
<img src="https://github.com/marcus-crane.png?size=50" width="50" style="border-radius: 50%"/>
</a>
<a href="https://github.com/codydbentley" style="width:65px">
<img src="https://github.com/codydbentley.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>
<span id="nav-5"></span>
## Installation

View File

@@ -260,9 +260,9 @@
}
},
"path-parse": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz",
"integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==",
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz",
"integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==",
"dev": true
},
"path-type": {

View File

@@ -145,6 +145,14 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
}
}
userTags := []string{}
for _, tag := range strings.Split(tags, " ") {
thisTag := strings.TrimSpace(tag)
if thisTag != "" {
userTags = append(userTags, thisTag)
}
}
buildOptions := &build.Options{
Logger: logger,
OutputType: "dev",
@@ -158,6 +166,7 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
IgnoreFrontend: false,
Verbosity: verbosity,
WailsJSDir: wailsjsdir,
UserTags: userTags,
}
watcher, err := fsnotify.NewWatcher()

View File

@@ -2,7 +2,7 @@ module changeme
go 1.17
require github.com/wailsapp/wails/v2 v2.0.0-beta.0
require github.com/wailsapp/wails/v2 {{.WailsVersion}}
require (
github.com/andybalholm/brotli v1.0.2 // indirect
@@ -35,4 +35,4 @@ golang.org/x/net v0.0.0-20210510120150-4163338589ed // indirect
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf // indirect
)
// replace github.com/wailsapp/wails/v2 v2.0.0-beta.0 => {{.WailsDirectory}}
// replace github.com/wailsapp/wails/v2 {{.WailsVersion}} => {{.WailsDirectory}}

View File

@@ -81,16 +81,18 @@ func AddSubCommand(app *clir.Cli, parent *clir.Command, w io.Writer) {
}
type templateData struct {
Name string
Description string
TemplateDir string
Name string
Description string
TemplateDir string
WailsVersion string
}
println("Extracting base template files...")
err = g.Extract(templateDir, &templateData{
Name: name,
TemplateDir: templateDir,
Name: name,
TemplateDir: templateDir,
WailsVersion: app.Version(),
})
if err != nil {
return err

View File

@@ -2,7 +2,12 @@ package initialise
import (
"fmt"
"github.com/flytam/filenamify"
"github.com/leaanthony/slicer"
"io"
"os"
"os/exec"
"path/filepath"
"strings"
"time"
@@ -46,8 +51,8 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
}
// VSCode project files
vscode := false
command.BoolFlag("vscode", "Generate VSCode project files", &vscode)
ide := ""
command.StringFlag("ide", "Generate IDE project files", &ide)
// List templates
list := false
@@ -75,6 +80,15 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
return nil
}
// Validate IDE option
supportedIDEs := slicer.String([]string{"vscode", "goland"})
ide = strings.ToLower(ide)
if ide != "" {
if !supportedIDEs.Contains(ide) {
return fmt.Errorf("ide '%s' not supported. Valid values: %s", ide, supportedIDEs.Join(" "))
}
}
if !quiet {
app.PrintBanner()
}
@@ -83,27 +97,47 @@ func AddSubcommand(app *clir.Cli, w io.Writer) error {
logger.Println(task)
logger.Println(strings.Repeat("-", len(task)))
projectFilename, err := filenamify.Filenamify(projectName, filenamify.Options{
Replacement: "_",
MaxLength: 255,
})
if err != nil {
return err
}
goBinary, err := exec.LookPath("go")
if err != nil {
return fmt.Errorf("unable to find Go compiler. Please download and install Go: https://golang.org/dl/")
}
// Get base path and convert to forward slashes
goPath := filepath.ToSlash(filepath.Dir(goBinary))
// Trim bin directory
goSDKPath := strings.TrimSuffix(goPath, "/bin")
// Create Template Options
options := &templates.Options{
ProjectName: projectName,
TargetDir: projectDirectory,
TemplateName: templateName,
Logger: logger,
GenerateVSCode: vscode,
InitGit: initGit,
ProjectName: projectName,
TargetDir: projectDirectory,
TemplateName: templateName,
Logger: logger,
IDE: ide,
InitGit: initGit,
ProjectNameFilename: projectFilename,
WailsVersion: app.Version(),
GoSDKPath: goSDKPath,
}
// Try to discover author details from git config
findAuthorDetails(options)
return initProject(options)
return initProject(options, quiet)
})
return nil
}
// initProject is our main init command
func initProject(options *templates.Options) error {
func initProject(options *templates.Options, quiet bool) error {
// Start Time
start := time.Now()
@@ -120,6 +154,19 @@ func initProject(options *templates.Options) error {
return err
}
// Run `go mod tidy` to ensure `go.sum` is up to date
cmd := exec.Command("go", "mod", "tidy")
cmd.Dir = options.TargetDir
cmd.Stderr = os.Stderr
if !quiet {
println("")
cmd.Stdout = os.Stdout
}
err = cmd.Run()
if err != nil {
return err
}
if options.InitGit {
err = initGit(options)
if err != nil {
@@ -127,6 +174,10 @@ func initProject(options *templates.Options) error {
}
}
if quiet {
return nil
}
// Output stats
elapsed := time.Since(start)
options.Logger.Println("")
@@ -135,9 +186,14 @@ func initProject(options *templates.Options) error {
options.Logger.Println("Project Template: " + options.TemplateName)
options.Logger.Println("Template Support: " + template.HelpURL)
if options.GenerateVSCode {
// IDE message
switch options.IDE {
case "vscode":
options.Logger.Println("VSCode config files generated.")
case "goland":
options.Logger.Println("Goland config files generated.")
}
if options.InitGit {
options.Logger.Println("Git repository initialised.")
}

View File

@@ -0,0 +1,8 @@
# Default ignored files
/shelf/
/workspace.xml
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml
# Editor-based HTTP Client requests
/httpRequests/

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/.idea/{{.ProjectNameFilename}}.iml"
filepath="$PROJECT_DIR$/.idea/{{.ProjectNameFilename}}.iml"/>
</modules>
</component>
</project>

View File

@@ -0,0 +1 @@
{{.ProjectName}}

View File

@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="Go" enabled="true" />
<component name="NewModuleRootManager">
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git"/>
</component>
</project>

View File

@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="AutoImportSettings">
<option name="autoReloadType" value="ALL"/>
</component>
<component name="GOROOT" url="file://{{.GoSDKPath}}"/>
<component name="Git.Settings">
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$"/>
</component>
<component name="GoLibraries">
<option name="indexEntireGoPath" value="false"/>
</component>
<component name="ProjectId" id="wails-{{.ProjectName}}"/>
<component name="ProjectLevelVcsManager" settingsEditedManually="true"/>
<component name="ProjectViewState">
<option name="hideEmptyMiddlePackages" value="true"/>
<option name="showLibraryContents" value="true"/>
</component>
<component name="PropertiesComponent">
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true"/>
<property name="RunOnceActivity.ShowReadmeOnStart" value="true"/>
<property name="WebServerToolWindowFactoryState" value="false"/>
<property name="com.intellij.ide.scratch.LRUPopupBuilder$1/New Scratch File" value="TEXT"/>
<property name="go.formatter.settings.were.checked" value="true"/>
<property name="go.import.settings.migrated" value="true"/>
<property name="go.modules.go.list.on.any.changes.was.set" value="true"/>
<property name="go.sdk.automatically.set" value="true"/>
<property name="go.tried.to.enable.integration.vgo.integrator" value="true"/>
<property name="last_opened_file_path" value="$PROJECT_DIR$"/>
<property name="settings.editor.selected.configurable"
value="reference.settingsdialog.IDE.editor.colors.Console Font"/>
</component>
<component name="RunManager" selected="Go Build.{{.ProjectName}} (dev)">>
<configuration name="{{.ProjectName}} (dev)" type="GoApplicationRunConfiguration" factoryName="Go Application">
<module name="{{.ProjectName}}"/>
<working_directory value="$PROJECT_DIR$"/>
<go_parameters value="-gcflags &quot;all=-N -l&quot; -tags dev -o {{.PathToDesktopBinary}}"/>
<useCustomBuildTags value="true"/>
<parameters value="-assetdir {{.AssetDir}}"/>
<envs>
<env name="CGO_ENABLED" value="&quot;{{.CGOEnabled}}&quot;"/>
</envs>
<kind value="DIRECTORY"/>
<directory value="$PROJECT_DIR$"/>
<filePath value="$PROJECT_DIR$"/>
<method v="2">
</method>
</configuration>
<configuration name="{{.ProjectName}} (production)" type="GoApplicationRunConfiguration"
factoryName="Go Application">
<module name="{{.ProjectName}}"/>
<working_directory value="$PROJECT_DIR$"/>
<go_parameters
value="-ldflags &quot;-w -s{{.WindowsFlags}}&quot; -tags desktop,production -o {{.PathToDesktopBinary}}"/>
<useCustomBuildTags value="true"/>
<envs>
<env name="CGO_ENABLED" value="&quot;{{.CGOEnabled}}&quot;"/>
</envs>
<kind value="DIRECTORY"/>
<directory value="$PROJECT_DIR$"/>
<filePath value="$PROJECT_DIR$"/>
<method v="2">
</method>
</configuration>
<list>
<item itemvalue="Go Build.{{.ProjectName}} (dev)"/>
<item itemvalue="Go Remote.Local"/>
</list>
</component>
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0"
DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true"/>
<component name="TypeScriptGeneratedFilesManager">
<option name="version" value="3"/>
</component>
<component name="Vcs.Log.Tabs.Properties">
<option name="TAB_STATES">
<map>
<entry key="MAIN">
<value>
<State/>
</value>
</entry>
</map>
</option>
<option name="oldMeFiltersMigrated" value="true"/>
</component>
<component name="VgoProject">
<integration-enabled>true</integration-enabled>
</component>
<component name="XDebuggerManager">
<breakpoint-manager>
</breakpoint-manager>
</component>
</project>

View File

@@ -42,6 +42,11 @@ type Data struct {
AuthorEmail string
AuthorNameAndEmail string
WailsDirectory string
GoSDKPath string
AssetDir string
WindowsFlags string
CGOEnabled string
OutputFile string
}
// Options for installing a template
@@ -51,13 +56,19 @@ type Options struct {
BinaryName string
TargetDir string
Logger *clilogger.CLILogger
GenerateVSCode bool
PathToDesktopBinary string
PathToServerBinary string
InitGit bool
AuthorName string
AuthorEmail string
AssetDir string
IDE string
ProjectNameFilename string // The project name but as a valid filename
WailsVersion string
GoSDKPath string
WindowsFlags string
CGOEnabled string
OutputFile string
}
// Template holds data relating to a template
@@ -241,6 +252,7 @@ func Install(options *Options) (bool, *Template, error) {
BinaryName := filepath.Base(options.TargetDir)
NPMProjectName := strings.ToLower(strings.ReplaceAll(BinaryName, " ", ""))
localWailsDirectory := fs.RelativePath("../../../../../..")
templateData := &Data{
ProjectName: options.ProjectName,
BinaryName: filepath.Base(options.TargetDir),
@@ -248,6 +260,9 @@ func Install(options *Options) (bool, *Template, error) {
WailsDirectory: localWailsDirectory,
AuthorEmail: options.AuthorEmail,
AuthorName: options.AuthorName,
WailsVersion: options.WailsVersion,
GoSDKPath: options.GoSDKPath,
AssetDir: options.AssetDir,
}
// Create a formatted name and email combo.
@@ -259,6 +274,10 @@ func Install(options *Options) (bool, *Template, error) {
}
templateData.AuthorNameAndEmail = strings.TrimSpace(templateData.AuthorNameAndEmail)
installer.RenameFiles(map[string]string{
"gitignore.txt": ".gitignore",
})
// Extract the template
err = installer.Extract(options.TargetDir, templateData)
if err != nil {
@@ -317,17 +336,58 @@ func OutputList(logger *clilogger.CLILogger) error {
func generateIDEFiles(options *Options) error {
if options.GenerateVSCode {
switch options.IDE {
case "vscode":
return generateVSCodeFiles(options)
case "goland":
return generateGolandFiles(options)
}
return nil
}
type ideOptions struct {
name string
targetDir string
options *Options
renameFiles map[string]string
ignoredFiles []string
}
func generateGolandFiles(options *Options) error {
ideoptions := ideOptions{
name: "goland",
targetDir: filepath.Join(options.TargetDir, ".idea"),
options: options,
renameFiles: map[string]string{
"projectname.iml": options.ProjectNameFilename + ".iml",
"gitignore.txt": ".gitignore",
"name": ".name",
},
}
if !options.InitGit {
ideoptions.ignoredFiles = []string{"vcs.xml"}
}
err := installIDEFiles(ideoptions)
if err != nil {
return errors.Wrap(err, "generating Goland IDE files")
}
return nil
}
func generateVSCodeFiles(options *Options) error {
ideoptions := ideOptions{
name: "vscode",
targetDir: filepath.Join(options.TargetDir, ".vscode"),
options: options,
}
return installIDEFiles(ideoptions)
targetDir := filepath.Join(options.TargetDir, ".vscode")
source, err := debme.FS(ides, "ides/vscode")
}
func installIDEFiles(o ideOptions) error {
source, err := debme.FS(ides, "ides/"+o.name)
if err != nil {
return err
}
@@ -335,14 +395,22 @@ func generateVSCodeFiles(options *Options) error {
// Use gosod to install the template
installer := gosod.New(source)
binaryName := filepath.Base(options.TargetDir)
if o.renameFiles != nil {
installer.RenameFiles(o.renameFiles)
}
for _, ignoreFile := range o.ignoredFiles {
installer.IgnoreFile(ignoreFile)
}
binaryName := filepath.Base(o.options.TargetDir)
if runtime.GOOS == "windows" {
// yay windows
binaryName += ".exe"
}
// Parse wails.json for assetdir
wailsJSONBytes, err := os.ReadFile(filepath.Join(options.TargetDir, "wails.json"))
wailsJSONBytes, err := os.ReadFile(filepath.Join(o.options.TargetDir, "wails.json"))
if err != nil {
return err
}
@@ -356,10 +424,16 @@ func generateVSCodeFiles(options *Options) error {
return fmt.Errorf("Unable to find 'assetdir' in 'wails.json' ")
}
options.AssetDir = assetDir.(string)
options.PathToDesktopBinary = filepath.ToSlash(filepath.Join("build", "bin", binaryName))
o.options.AssetDir = assetDir.(string)
o.options.PathToDesktopBinary = filepath.ToSlash(filepath.Join("build", "bin", binaryName))
err = installer.Extract(targetDir, options)
o.options.WindowsFlags = ""
o.options.CGOEnabled = "1"
if runtime.GOOS == "windows" {
o.options.WindowsFlags = " -H windowsgui"
o.options.CGOEnabled = "0"
}
err = installer.Extract(o.targetDir, o.options)
if err != nil {
return err
}

View File

@@ -0,0 +1,9 @@
# Wails bin directory
build/bin
# IDEs
.idea
.vscode
# The black hole that is...
node_modules

View File

@@ -2,7 +2,7 @@ module changeme
go 1.17
require github.com/wailsapp/wails/v2 v2.0.0-beta.0
require github.com/wailsapp/wails/v2 {{.WailsVersion}}
require (
github.com/andybalholm/brotli v1.0.2 // indirect
@@ -35,4 +35,4 @@ golang.org/x/net v0.0.0-20210510120150-4163338589ed // indirect
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf // indirect
)
// replace github.com/wailsapp/wails/v2 v2.0.0-beta.0 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2
// replace github.com/wailsapp/wails/v2 {{.WailsVersion}} => {{.WailsDirectory}}

View File

@@ -15,6 +15,7 @@ github.com/fasthttp/websocket v0.0.0-20200320073529-1554a54587ab h1:9e2joQGp642w
github.com/fasthttp/websocket v0.0.0-20200320073529-1554a54587ab/go.mod h1:smsv/h4PBEBaU0XDTY5UwJTpZv69fQ0FfcLJr21mA6Y=
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/flytam/filenamify v1.0.0/go.mod h1:Dzf9kVycwcsBlr2ATg6uxjqiFgKGH+5SKFuhdeP5zu8=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/gabriel-vasile/mimetype v1.3.1 h1:qevA6c2MtE1RorlScnixeG0VA1H4xrXyhyX3oWBynNQ=
github.com/gabriel-vasile/mimetype v1.3.1/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8=
@@ -58,8 +59,9 @@ github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/jackmordaunt/icns v1.0.0/go.mod h1:7TTQVEuGzVVfOPPlLNHJIkzA6CoV7aH1Dv9dW351oOo=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jchv/go-winloader v0.0.0-20200815041850-dec1ee9a7fd5 h1:pdFFlHXY9tZXmJz+tRSm1DzYEH4ebha7cffmm607bMU=
github.com/jchv/go-winloader v0.0.0-20200815041850-dec1ee9a7fd5/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck=
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
@@ -75,16 +77,15 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leaanthony/clir v1.0.4/go.mod h1:k/RBkdkFl18xkkACMCLt09bhiZnrGORoxmomeMvDpE0=
github.com/leaanthony/debme v1.1.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc=
github.com/leaanthony/debme v1.2.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
github.com/leaanthony/go-ansi-parser v1.0.1 h1:97v6c5kYppVsbScf4r/VZdXyQ21KQIfeQOk2DgKxGG4=
github.com/leaanthony/go-ansi-parser v1.0.1/go.mod h1:7arTzgVI47srICYhvgUV4CGd063sGEeoSlych5yeSPM=
github.com/leaanthony/go-common-file-dialog v1.0.3 h1:O0uGjKnWtdEADGrkg+TyAAbZylykMwwx/MNEXn9fp+Y=
github.com/leaanthony/go-common-file-dialog v1.0.3/go.mod h1:TGhEc9eSJgRsupZ+iH1ZgAOnEo9zp05cRH2j08RPrF0=
github.com/leaanthony/go-webview2 v0.0.0-20210914103035-f00aa774a934 h1:nK/JTPyJi5QRqYjVZjXgtN4/dhg2qtngoLxLDVn429k=
github.com/leaanthony/go-webview2 v0.0.0-20210914103035-f00aa774a934/go.mod h1:lS5ds4bruPk9d7lzdF/OH31Z0YCerI6MmHNFGsWoUnM=
github.com/leaanthony/gosod v1.0.2/go.mod h1:W8RyeSFBXu7RpIxPGEJfW4moSyGGEjlJMLV25wEbAdU=
github.com/leaanthony/go-webview2 v0.0.0-20210928094513-a94a08b538bd h1:6m4zZ/esiByaDbzgdvDxjsOaIDgtuG1q2cyhjAi6uAg=
github.com/leaanthony/go-webview2 v0.0.0-20210928094513-a94a08b538bd/go.mod h1:lS5ds4bruPk9d7lzdF/OH31Z0YCerI6MmHNFGsWoUnM=
github.com/leaanthony/gosod v1.0.3/go.mod h1:BJ2J+oHsQIyIQpnLPjnqFGTMnOZXDbvWtRCSG7jGxs4=
github.com/leaanthony/idgen v1.0.0/go.mod h1:4nBZnt8ml/f/ic/EVQuLxuj817RccT2fyrUaZFxrcVA=
github.com/leaanthony/slicer v1.5.0 h1:aHYTN8xbCCLxJmkNKiLB6tgcMARl4eWmH9/F+S/0HtY=
github.com/leaanthony/slicer v1.5.0/go.mod h1:FwrApmf8gOrpzEWM2J/9Lh79tyq8KTX5AzRtwV7m4AY=
@@ -146,6 +147,8 @@ github.com/valyala/fasthttp v1.28.0/go.mod h1:cmWIqlu99AO/RKcp1HWaViTqc57FswJOfY
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/wailsapp/wails/v2 v2.0.0-beta.3 h1:8vhBbnjpYDF6cCUwKadon7J/98UjcP1nrnptUl70Tfg=
github.com/wailsapp/wails/v2 v2.0.0-beta.3/go.mod h1:aku28riyHF2G5jmx/qtxjLWi7VwpTjhhX/HVLCptWFA=
github.com/wzshiming/ctc v1.2.3/go.mod h1:2tVAtIY7SUyraSk0JxvwmONNPFL4ARavPuEsg5+KA28=
github.com/wzshiming/winseq v0.0.0-20200112104235-db357dc107ae/go.mod h1:VTAq37rkGeV+WOybvZwjXiJOicICdpLCN8ifpISjK20=
github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0=
@@ -193,8 +196,8 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210611083646-a4fc73990273/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf h1:2ucpDCmfkl8Bd/FsLtiD653Wf96cW37s+iGx93zsu4k=
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 h1:foEbQz/B0Oz6YIqu/69kfXPYeFQAuuMYFkjaqXzl5Wo=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
@@ -222,4 +225,4 @@ gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=
nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0=

View File

@@ -0,0 +1,9 @@
# Wails bin directory
build/bin
# IDEs
.idea
.vscode
# The black hole that is...
node_modules

View File

@@ -2,7 +2,7 @@ module changeme
go 1.17
require github.com/wailsapp/wails/v2 v2.0.0-beta.0
require github.com/wailsapp/wails/v2 {{.WailsVersion}}
require (
github.com/andybalholm/brotli v1.0.2 // indirect
@@ -35,4 +35,4 @@ golang.org/x/net v0.0.0-20210510120150-4163338589ed // indirect
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf // indirect
)
// replace github.com/wailsapp/wails/v2 v2.0.0-beta.0 => C:\Users\leaan\Documents\wails-v2-beta\wails\v2
// replace github.com/wailsapp/wails/v2 {{.WailsVersion}} => {{.WailsDirectory}}

View File

@@ -15,6 +15,7 @@ github.com/fasthttp/websocket v0.0.0-20200320073529-1554a54587ab h1:9e2joQGp642w
github.com/fasthttp/websocket v0.0.0-20200320073529-1554a54587ab/go.mod h1:smsv/h4PBEBaU0XDTY5UwJTpZv69fQ0FfcLJr21mA6Y=
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/flytam/filenamify v1.0.0/go.mod h1:Dzf9kVycwcsBlr2ATg6uxjqiFgKGH+5SKFuhdeP5zu8=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/gabriel-vasile/mimetype v1.3.1 h1:qevA6c2MtE1RorlScnixeG0VA1H4xrXyhyX3oWBynNQ=
github.com/gabriel-vasile/mimetype v1.3.1/go.mod h1:fA8fi6KUiG7MgQQ+mEWotXoEOvmxRtOJlERCzSmRvr8=
@@ -58,8 +59,9 @@ github.com/imdario/mergo v0.3.12 h1:b6R2BslTbIEToALKP7LxUvijTsNI9TAe80pLWN2g/HU=
github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
github.com/jackmordaunt/icns v1.0.0/go.mod h1:7TTQVEuGzVVfOPPlLNHJIkzA6CoV7aH1Dv9dW351oOo=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jchv/go-winloader v0.0.0-20200815041850-dec1ee9a7fd5 h1:pdFFlHXY9tZXmJz+tRSm1DzYEH4ebha7cffmm607bMU=
github.com/jchv/go-winloader v0.0.0-20200815041850-dec1ee9a7fd5/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck=
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM=
@@ -75,16 +77,15 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leaanthony/clir v1.0.4/go.mod h1:k/RBkdkFl18xkkACMCLt09bhiZnrGORoxmomeMvDpE0=
github.com/leaanthony/debme v1.1.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc=
github.com/leaanthony/debme v1.2.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
github.com/leaanthony/go-ansi-parser v1.0.1 h1:97v6c5kYppVsbScf4r/VZdXyQ21KQIfeQOk2DgKxGG4=
github.com/leaanthony/go-ansi-parser v1.0.1/go.mod h1:7arTzgVI47srICYhvgUV4CGd063sGEeoSlych5yeSPM=
github.com/leaanthony/go-common-file-dialog v1.0.3 h1:O0uGjKnWtdEADGrkg+TyAAbZylykMwwx/MNEXn9fp+Y=
github.com/leaanthony/go-common-file-dialog v1.0.3/go.mod h1:TGhEc9eSJgRsupZ+iH1ZgAOnEo9zp05cRH2j08RPrF0=
github.com/leaanthony/go-webview2 v0.0.0-20210914103035-f00aa774a934 h1:nK/JTPyJi5QRqYjVZjXgtN4/dhg2qtngoLxLDVn429k=
github.com/leaanthony/go-webview2 v0.0.0-20210914103035-f00aa774a934/go.mod h1:lS5ds4bruPk9d7lzdF/OH31Z0YCerI6MmHNFGsWoUnM=
github.com/leaanthony/gosod v1.0.2/go.mod h1:W8RyeSFBXu7RpIxPGEJfW4moSyGGEjlJMLV25wEbAdU=
github.com/leaanthony/go-webview2 v0.0.0-20210928094513-a94a08b538bd h1:6m4zZ/esiByaDbzgdvDxjsOaIDgtuG1q2cyhjAi6uAg=
github.com/leaanthony/go-webview2 v0.0.0-20210928094513-a94a08b538bd/go.mod h1:lS5ds4bruPk9d7lzdF/OH31Z0YCerI6MmHNFGsWoUnM=
github.com/leaanthony/gosod v1.0.3/go.mod h1:BJ2J+oHsQIyIQpnLPjnqFGTMnOZXDbvWtRCSG7jGxs4=
github.com/leaanthony/idgen v1.0.0/go.mod h1:4nBZnt8ml/f/ic/EVQuLxuj817RccT2fyrUaZFxrcVA=
github.com/leaanthony/slicer v1.5.0 h1:aHYTN8xbCCLxJmkNKiLB6tgcMARl4eWmH9/F+S/0HtY=
github.com/leaanthony/slicer v1.5.0/go.mod h1:FwrApmf8gOrpzEWM2J/9Lh79tyq8KTX5AzRtwV7m4AY=
@@ -146,6 +147,8 @@ github.com/valyala/fasthttp v1.28.0/go.mod h1:cmWIqlu99AO/RKcp1HWaViTqc57FswJOfY
github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio=
github.com/valyala/tcplisten v1.0.0 h1:rBHj/Xf+E1tRGZyWIWwJDiRY0zc1Js+CV5DqwacVSA8=
github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=
github.com/wailsapp/wails/v2 v2.0.0-beta.3 h1:8vhBbnjpYDF6cCUwKadon7J/98UjcP1nrnptUl70Tfg=
github.com/wailsapp/wails/v2 v2.0.0-beta.3/go.mod h1:aku28riyHF2G5jmx/qtxjLWi7VwpTjhhX/HVLCptWFA=
github.com/wzshiming/ctc v1.2.3/go.mod h1:2tVAtIY7SUyraSk0JxvwmONNPFL4ARavPuEsg5+KA28=
github.com/wzshiming/winseq v0.0.0-20200112104235-db357dc107ae/go.mod h1:VTAq37rkGeV+WOybvZwjXiJOicICdpLCN8ifpISjK20=
github.com/xanzy/ssh-agent v0.3.0/go.mod h1:3s9xbODqPuuhK9JV1R321M/FlMZSBvE5aY6eAcqrDh0=
@@ -193,8 +196,8 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210611083646-a4fc73990273/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf h1:2ucpDCmfkl8Bd/FsLtiD653Wf96cW37s+iGx93zsu4k=
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 h1:foEbQz/B0Oz6YIqu/69kfXPYeFQAuuMYFkjaqXzl5Wo=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=

View File

@@ -86,7 +86,7 @@ func updateToVersion(logger *clilogger.CLILogger, targetVersion *github.Semantic
// Early exit
if targetVersionString == currentVersion {
logger.Println("Looks like you're up to date!")
logger.Println("\nLooks like you're up to date!")
return nil
}
@@ -151,14 +151,16 @@ func updateToVersion(logger *clilogger.CLILogger, targetVersion *github.Semantic
log.Fatal("Cannot find home directory! Please file a bug report!")
}
sout, serr, err := shell.RunCommand(homeDir, "go", "get", "github.com/wailsapp/wails/v2/cmd/wails@"+desiredVersion)
sout, serr, err := shell.RunCommand(homeDir, "go", "install", "github.com/wailsapp/wails/v2/cmd/wails@"+desiredVersion)
if err != nil {
logger.Println("Failed.")
logger.Println(sout + `\n` + serr)
return err
}
fmt.Println()
logger.Println("\n")
logger.Println("Wails CLI updated to " + desiredVersion)
logger.Println("Make sure you update your project go.mod file to use " + desiredVersion + ":")
logger.Println(" require github.com/wailsapp/wails/v2 " + desiredVersion)
return nil
}

View File

@@ -1,3 +1,3 @@
package main
var version = "v2.0.0-beta.0"
var version = "v2.0.0-beta.4"

View File

@@ -5,6 +5,7 @@ go 1.17
require (
github.com/Masterminds/semver v1.5.0
github.com/fatih/structtag v1.2.0
github.com/flytam/filenamify v1.0.0
github.com/fsnotify/fsnotify v1.4.9
github.com/gabriel-vasile/mimetype v1.3.1
github.com/go-git/go-billy/v5 v5.2.0 // indirect
@@ -20,8 +21,8 @@ require (
github.com/leaanthony/debme v1.2.1
github.com/leaanthony/go-ansi-parser v1.0.1
github.com/leaanthony/go-common-file-dialog v1.0.3
github.com/leaanthony/go-webview2 v0.0.0-20210914103035-f00aa774a934
github.com/leaanthony/gosod v1.0.2
github.com/leaanthony/go-webview2 v0.0.0-20210928094513-a94a08b538bd
github.com/leaanthony/gosod v1.0.3
github.com/leaanthony/idgen v1.0.0
github.com/leaanthony/slicer v1.5.0
github.com/leaanthony/typescriptify-golang-structs v0.1.7
@@ -42,7 +43,7 @@ require (
github.com/ztrue/tracerr v0.3.0
golang.org/x/mod v0.4.1 // indirect
golang.org/x/net v0.0.0-20210510120150-4163338589ed
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6
golang.org/x/tools v0.1.0
nhooyr.io/websocket v1.8.6
)
@@ -56,7 +57,7 @@ require (
github.com/go-ole/go-ole v1.2.5 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
github.com/jchv/go-winloader v0.0.0-20200815041850-dec1ee9a7fd5 // indirect
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/klauspost/compress v1.12.2 // indirect
github.com/logrusorgru/aurora v0.0.0-20181002194514-a7b3b318ed4e // indirect

View File

@@ -22,6 +22,8 @@ github.com/fasthttp/websocket v0.0.0-20200320073529-1554a54587ab/go.mod h1:smsv/
github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4=
github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94=
github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc=
github.com/flytam/filenamify v1.0.0 h1:ewx6BY2dj7U6h2zGPJmt33q/BjkSf/YsY/woQvnUNIs=
github.com/flytam/filenamify v1.0.0/go.mod h1:Dzf9kVycwcsBlr2ATg6uxjqiFgKGH+5SKFuhdeP5zu8=
github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4=
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
github.com/gabriel-vasile/mimetype v1.3.1 h1:qevA6c2MtE1RorlScnixeG0VA1H4xrXyhyX3oWBynNQ=
@@ -84,8 +86,9 @@ github.com/jackmordaunt/icns v1.0.0 h1:RYSxplerf/l/DUd09AHtITwckkv/mqjVv4DjYdPmA
github.com/jackmordaunt/icns v1.0.0/go.mod h1:7TTQVEuGzVVfOPPlLNHJIkzA6CoV7aH1Dv9dW351oOo=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A=
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
github.com/jchv/go-winloader v0.0.0-20200815041850-dec1ee9a7fd5 h1:pdFFlHXY9tZXmJz+tRSm1DzYEH4ebha7cffmm607bMU=
github.com/jchv/go-winloader v0.0.0-20200815041850-dec1ee9a7fd5/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck=
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
github.com/jessevdk/go-flags v1.5.0/go.mod h1:Fw0T6WPc1dYxT4mKEZRfG5kJhaTDP9pj1c2EWnYs/m4=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
@@ -106,17 +109,16 @@ github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
github.com/leaanthony/clir v1.0.4 h1:Dov2y9zWJmZr7CjaCe86lKa4b5CSxskGAt2yBkoDyiU=
github.com/leaanthony/clir v1.0.4/go.mod h1:k/RBkdkFl18xkkACMCLt09bhiZnrGORoxmomeMvDpE0=
github.com/leaanthony/debme v1.1.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
github.com/leaanthony/debme v1.2.1 h1:9Tgwf+kjcrbMQ4WnPcEIUcQuIZYqdWftzZkBr+i/oOc=
github.com/leaanthony/debme v1.2.1/go.mod h1:3V+sCm5tYAgQymvSOfYQ5Xx2JCr+OXiD9Jkw3otUjiA=
github.com/leaanthony/go-ansi-parser v1.0.1 h1:97v6c5kYppVsbScf4r/VZdXyQ21KQIfeQOk2DgKxGG4=
github.com/leaanthony/go-ansi-parser v1.0.1/go.mod h1:7arTzgVI47srICYhvgUV4CGd063sGEeoSlych5yeSPM=
github.com/leaanthony/go-common-file-dialog v1.0.3 h1:O0uGjKnWtdEADGrkg+TyAAbZylykMwwx/MNEXn9fp+Y=
github.com/leaanthony/go-common-file-dialog v1.0.3/go.mod h1:TGhEc9eSJgRsupZ+iH1ZgAOnEo9zp05cRH2j08RPrF0=
github.com/leaanthony/go-webview2 v0.0.0-20210914103035-f00aa774a934 h1:nK/JTPyJi5QRqYjVZjXgtN4/dhg2qtngoLxLDVn429k=
github.com/leaanthony/go-webview2 v0.0.0-20210914103035-f00aa774a934/go.mod h1:lS5ds4bruPk9d7lzdF/OH31Z0YCerI6MmHNFGsWoUnM=
github.com/leaanthony/gosod v1.0.2 h1:LtjqaIoHuoXiQXbzMPq0isjNfltSyHKhWeiU/JbmP0w=
github.com/leaanthony/gosod v1.0.2/go.mod h1:W8RyeSFBXu7RpIxPGEJfW4moSyGGEjlJMLV25wEbAdU=
github.com/leaanthony/go-webview2 v0.0.0-20210928094513-a94a08b538bd h1:6m4zZ/esiByaDbzgdvDxjsOaIDgtuG1q2cyhjAi6uAg=
github.com/leaanthony/go-webview2 v0.0.0-20210928094513-a94a08b538bd/go.mod h1:lS5ds4bruPk9d7lzdF/OH31Z0YCerI6MmHNFGsWoUnM=
github.com/leaanthony/gosod v1.0.3 h1:Fnt+/B6NjQOVuCWOKYRREZnjGyvg+mEhd1nkkA04aTQ=
github.com/leaanthony/gosod v1.0.3/go.mod h1:BJ2J+oHsQIyIQpnLPjnqFGTMnOZXDbvWtRCSG7jGxs4=
github.com/leaanthony/idgen v1.0.0 h1:IZreR+JGEzFV4yeVuBZA25gM0keUoFy+RDUldncQ+Jw=
github.com/leaanthony/idgen v1.0.0/go.mod h1:4nBZnt8ml/f/ic/EVQuLxuj817RccT2fyrUaZFxrcVA=
github.com/leaanthony/slicer v1.5.0 h1:aHYTN8xbCCLxJmkNKiLB6tgcMARl4eWmH9/F+S/0HtY=
@@ -255,8 +257,8 @@ golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210611083646-a4fc73990273/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210616045830-e2b7044e8c71/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf h1:2ucpDCmfkl8Bd/FsLtiD653Wf96cW37s+iGx93zsu4k=
golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 h1:foEbQz/B0Oz6YIqu/69kfXPYeFQAuuMYFkjaqXzl5Wo=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=

View File

@@ -4,11 +4,12 @@ import (
"bytes"
_ "embed"
"fmt"
"github.com/wailsapp/wails/v2/internal/fs"
"os"
"path/filepath"
"strings"
"github.com/wailsapp/wails/v2/internal/fs"
"github.com/leaanthony/slicer"
)
@@ -93,7 +94,7 @@ const go = {`)
output.WriteString("\n")
})
output.WriteString(fmt.Sprintf(" }\n"))
output.WriteString(fmt.Sprintf(" },\n"))
output.WriteString("\n")
})

View File

@@ -8,7 +8,7 @@ import (
)
func doInstallationStrategy(installStatus installationStatus) error {
confirmed, err := webview2runtime.Confirm("This application requires the WebView2 runtime. Press OK to open the download page. Minimum version required: "+minimumRuntimeVersion, "Missing Requirements")
confirmed, err := webview2runtime.Confirm("This application requires the WebView2 runtime. Press OK to open the download page. Minimum version required: "+MinimumRuntimeVersion, "Missing Requirements")
if err != nil {
return err
}

View File

@@ -21,63 +21,63 @@ import (
"os"
)
type AssetServer struct {
indexFile []byte
type BrowserAssetServer struct {
runtimeJS []byte
assetdir string
appOptions *options.App
}
func NewAssetServer(assetdir string, bindingsJSON string, appOptions *options.App) (*AssetServer, error) {
result := &AssetServer{
func NewBrowserAssetServer(assetdir string, bindingsJSON string, appOptions *options.App) (*BrowserAssetServer, error) {
result := &BrowserAssetServer{
assetdir: assetdir,
appOptions: appOptions,
}
err := result.init()
if err != nil {
return nil, err
}
var buffer bytes.Buffer
buffer.WriteString(`window.wailsbindings='` + bindingsJSON + `';` + "\n")
buffer.Write(runtime.RuntimeDesktopJS)
result.runtimeJS = buffer.Bytes()
err = result.init()
return result, err
return result, nil
}
func (a *AssetServer) loadFileFromDisk(filename string) ([]byte, error) {
func (a *BrowserAssetServer) loadFileFromDisk(filename string) ([]byte, error) {
return os.ReadFile(filepath.Join(a.assetdir, filename))
}
func (a *AssetServer) init() error {
var err error
a.indexFile, err = a.loadFileFromDisk("index.html")
func (a *BrowserAssetServer) processIndexHTML() ([]byte, error) {
indexHTML, err := a.loadFileFromDisk("index.html")
if err != nil {
return err
return nil, err
}
a.indexFile, err = injectHTML(string(a.indexFile), `<div id="wails-spinner"></div>`)
indexHTML, err = injectHTML(string(indexHTML), `<div id="wails-spinner"></div>`)
if err != nil {
return err
return nil, err
}
a.indexFile, err = injectHTML(string(a.indexFile), `<script src="/wails/ipc.js"></script>`)
wailsOptions, err := extractOptions(indexHTML)
if err != nil {
return err
return nil, err
}
a.indexFile, err = injectHTML(string(a.indexFile), `<script src="/wails/runtime.js"></script>`)
if err != nil {
return err
if wailsOptions.disableRuntimeInjection == false {
indexHTML, err = injectHTML(string(indexHTML), `<script src="/wails/runtime.js"></script>`)
if err != nil {
return nil, err
}
}
return nil
if wailsOptions.disableBindingsInjection == false {
indexHTML, err = injectHTML(string(indexHTML), `<script src="/wails/ipc.js"></script>`)
if err != nil {
return nil, err
}
}
return indexHTML, nil
}
func (a *AssetServer) Load(filename string) ([]byte, string, error) {
func (a *BrowserAssetServer) Load(filename string) ([]byte, string, error) {
var content []byte
var err error
switch filename {
case "/":
content = a.indexFile
content, err = a.processIndexHTML()
case "/wails/runtime.js":
content = a.runtimeJS
case "/wails/ipc.js":

View File

@@ -10,13 +10,13 @@ import (
"github.com/wailsapp/wails/v2/internal/frontend/runtime"
"github.com/wailsapp/wails/v2/internal/logger"
"io/fs"
"log"
"path/filepath"
"strings"
)
type DesktopAssetServer struct {
assets debme.Debme
indexFile []byte
runtimeJS []byte
assetdir string
logger *logger.Logger
@@ -106,27 +106,42 @@ func (a *DesktopAssetServer) init(assets embed.FS) error {
if err != nil {
return err
}
indexHTML, err := a.assets.ReadFile("index.html")
if err != nil {
return err
}
a.indexFile, err = injectHTML(string(indexHTML), `<script src="/wails/runtime.js"></script>`)
if err != nil {
return err
}
a.indexFile, err = injectHTML(string(a.indexFile), `<script src="/wails/ipc.js"></script>`)
if err != nil {
return err
}
return nil
}
func (a *DesktopAssetServer) processIndexHTML() ([]byte, error) {
indexHTML, err := a.ReadFile("index.html")
if err != nil {
return nil, err
}
wailsOptions, err := extractOptions(indexHTML)
if err != nil {
log.Fatal(err)
return nil, err
}
fmt.Printf("%+v\n", wailsOptions)
if wailsOptions.disableRuntimeInjection == false {
indexHTML, err = injectHTML(string(indexHTML), `<script src="/wails/runtime.js"></script>`)
if err != nil {
return nil, err
}
}
if wailsOptions.disableBindingsInjection == false {
indexHTML, err = injectHTML(string(indexHTML), `<script src="/wails/ipc.js"></script>`)
if err != nil {
return nil, err
}
}
return indexHTML, nil
}
func (a *DesktopAssetServer) Load(filename string) ([]byte, string, error) {
var content []byte
var err error
switch filename {
case "/":
content = a.indexFile
content, err = a.processIndexHTML()
case "/wails/runtime.js":
content = a.runtimeJS
case "/wails/ipc.js":

View File

@@ -3,19 +3,86 @@ package assetserver
import (
"bytes"
"fmt"
"golang.org/x/net/html"
"strings"
)
type optionType string
const (
noAutoInject optionType = "noautoinject"
noAutoInjectRuntime optionType = "noautoinjectruntime"
noAutoInjectBindings optionType = "noautoinjectbindings"
)
type Options struct {
disableRuntimeInjection bool
disableBindingsInjection bool
}
func newOptions(optionString string) *Options {
var result = &Options{}
optionString = strings.ToLower(optionString)
options := strings.Split(optionString, ",")
for _, option := range options {
switch optionType(strings.TrimSpace(option)) {
case noAutoInject:
result.disableRuntimeInjection = true
result.disableBindingsInjection = true
case noAutoInjectBindings:
result.disableBindingsInjection = true
case noAutoInjectRuntime:
result.disableRuntimeInjection = true
}
}
return result
}
func injectHTML(input string, html string) ([]byte, error) {
splits := strings.Split(input, "</body>")
splits := strings.Split(input, "</head>")
if len(splits) != 2 {
return nil, fmt.Errorf("unable to locate a </body> tag in your html")
return nil, fmt.Errorf("unable to locate a </head> tag in your html")
}
var result bytes.Buffer
result.WriteString(splits[0])
result.WriteString(html)
result.WriteString("</body>")
result.WriteString("</head>")
result.WriteString(splits[1])
return result.Bytes(), nil
}
func extractOptions(htmldata []byte) (*Options, error) {
doc, err := html.Parse(bytes.NewReader(htmldata))
if err != nil {
return nil, err
}
var extractor func(*html.Node) *Options
extractor = func(node *html.Node) *Options {
if node.Type == html.ElementNode && node.Data == "meta" {
isWailsOptionsTag := false
wailsOptions := ""
for _, attr := range node.Attr {
if isWailsOptionsTag && attr.Key == "content" {
wailsOptions = attr.Val
}
if attr.Val == "wails-options" {
isWailsOptionsTag = true
}
}
return newOptions(wailsOptions)
}
for child := node.FirstChild; child != nil; child = child.NextSibling {
result := extractor(child)
if result != nil {
return result
}
}
return nil
}
result := extractor(doc)
if result == nil {
result = &Options{}
}
return result, nil
}

View File

@@ -0,0 +1,70 @@
package assetserver
import (
"reflect"
"testing"
)
const realHTML = `<html>
<head>
<title>test3</title>
<meta name="wails-options" content="noautoinject">
<link rel="stylesheet" href="/main.css">
</head>
<body data-wails-drag>
<div class="logo"></div>
<div class="result" id="result">Please enter your name below <20></div>
<div class="input-box" id="input" data-wails-no-drag>
<input class="input" id="name" type="text" autocomplete="off">
<button class="btn" onclick="greet()">Greet</button>
</div>
<script src="/main.js"></script>
</body>
</html>
`
func genMeta(content string) []byte {
return []byte("<html><head><meta name=\"wails-options\" content=\"" + content + "\"></head><body></body></html>")
}
func genOptions(runtime bool, bindings bool) *Options {
return &Options{
disableRuntimeInjection: runtime,
disableBindingsInjection: bindings,
}
}
func Test_extractOptions(t *testing.T) {
tests := []struct {
name string
htmldata []byte
want *Options
wantError bool
}{
{"empty", []byte(""), &Options{}, false},
{"bad data", []byte("<"), &Options{}, false},
{"bad options", genMeta("noauto"), genOptions(false, false), false},
{"realhtml", []byte(realHTML), genOptions(true, true), false},
{"noautoinject", genMeta("noautoinject"), genOptions(true, true), false},
{"noautoinjectbindings", genMeta("noautoinjectbindings"), genOptions(false, true), false},
{"noautoinjectruntime", genMeta("noautoinjectruntime"), genOptions(true, false), false},
{"spaces", genMeta(" noautoinjectruntime "), genOptions(true, false), false},
{"multiple", genMeta("noautoinjectruntime,noautoinjectbindings"), genOptions(true, true), false},
{"multiple spaces", genMeta(" noautoinjectruntime, noautoinjectbindings "), genOptions(true, true), false},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
got, err := extractOptions(tt.htmldata)
if !tt.wantError && err != nil {
t.Errorf("did not want error but got it")
}
if !reflect.DeepEqual(got, tt.want) {
t.Errorf("extractOptions() = %v, want %v", got, tt.want)
}
})
}
}

View File

@@ -5,8 +5,9 @@ import (
"path/filepath"
"strings"
"sync"
"github.com/gabriel-vasile/mimetype"
)
import "github.com/gabriel-vasile/mimetype"
var (
cache = map[string]string{}
@@ -33,6 +34,10 @@ func GetMimetype(filename string, data []byte) string {
result = strings.Replace(result, "text/plain", "text/css", 1)
}
if filepath.Ext(filename) == ".js" && strings.HasPrefix(result, "text/plain") {
result = strings.Replace(result, "text/plain", "text/javascript", 1)
}
if result == "" {
result = "application/octet-stream"
}

View File

@@ -14,6 +14,7 @@ func TestGetMimetype(t *testing.T) {
}{
// TODO: Add test cases.
{"css", args{"test.css", []byte("body{margin:0;padding:0;background-color:#d579b2}#app{font-family:Avenir,Helvetica,Arial,sans-serif;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-align:center;color:#2c3e50;background-color:#ededed}#nav{padding:30px}#nav a{font-weight:700;color:#2c\n3e50}#nav a.router-link-exact-active{color:#42b983}.hello[data-v-4e26ad49]{margin:10px 0}")}, "text/css; charset=utf-8"},
{"js", args{"test.js", []byte("let foo = 'bar'; console.log(foo);")}, "text/javascript; charset=utf-8"},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {

View File

@@ -1,3 +1,5 @@
//go:build darwin
package darwin
import (

View File

@@ -2,7 +2,6 @@
package darwin
import "C"
import (
"github.com/wailsapp/wails/v2/internal/frontend"
)

View File

@@ -2,7 +2,6 @@
package windows
import "C"
import (
"github.com/leaanthony/go-common-file-dialog/cfd"
"github.com/wailsapp/wails/v2/internal/frontend"

View File

@@ -33,7 +33,7 @@ type DevWebServer struct {
logger *logger.Logger
appBindings *binding.Bindings
dispatcher frontend.Dispatcher
assetServer *assetserver.AssetServer
assetServer *assetserver.BrowserAssetServer
socketMutex sync.Mutex
websocketClients map[*websocket.Conn]struct{}
menuManager *menumanager.Manager
@@ -103,7 +103,7 @@ func (d *DevWebServer) Run(ctx context.Context) error {
if err != nil {
log.Fatal(err)
}
d.assetServer, err = assetserver.NewAssetServer(assetdir, bindingsJSON, d.appoptions)
d.assetServer, err = assetserver.NewBrowserAssetServer(assetdir, bindingsJSON, d.appoptions)
if err != nil {
log.Fatal(err)
}
@@ -118,7 +118,7 @@ func (d *DevWebServer) Run(ctx context.Context) error {
// Start server
go func(server *fiber.App, log *logger.Logger) {
err := server.Listen(":34115")
err := server.Listen("localhost:34115")
if err != nil {
log.Error(err.Error())
}
@@ -358,6 +358,7 @@ func NewFrontend(ctx context.Context, appoptions *options.App, myLogger *logger.
appBindings: appBindings,
dispatcher: dispatcher,
server: fiber.New(fiber.Config{
ReadTimeout: time.Second * 5,
DisableStartupMessage: true,
}),

View File

@@ -153,7 +153,7 @@ community can create!
Wails v2 represents a new foundation for the project.
The aim of this release is to get feedback on the new approach, and to iron out any bugs before a full release.
Your input would be most welcome. Please direct any feedback to the [v2 Beta](https://github.com/wailsapp/wails/discussions)
Your input would be most welcome. Please direct any feedback to the [v2 Beta](https://github.com/wailsapp/wails/discussions/828)
discussion board.
There were many twists and turns, pivots and u-turns to get to this point. This was due partly to early technical decisions

View File

@@ -12,7 +12,7 @@ to submit links.
- [Gophers Slack Channel](https://gophers.slack.com/messages/CJ4P9F7MZ/)
- [Gophers Slack Channel Invite](https://invite.slack.golangbridge.org/)
- [Github Issues](https://github.com/wailsapp/wails/issues)
- [v2 Beta Discussion Board](https://github.com/wailsapp/wails/discussions)
- [v2 Beta Discussion Board](https://github.com/wailsapp/wails/discussions/828)
## Social Media

View File

@@ -2,7 +2,7 @@
# EncryptEasy
<p style={{"text-align": "center"}}>
<img src="encrypteasy.jpg"></img><br/>
<img src="/img/showcase/encrypteasy.jpg"></img><br/>
</p>
**[EncryptEasy](https://www.encrypteasy.app) is a simple and easy to use PGP encryption tool, managing all your and your contacts keys. Encryption should be simple. Developed with Wails.**

View File

@@ -2,7 +2,7 @@
# FileHound Export Utility
<p style={{"text-align": "center"}}>
<img src="filehound.jpg"></img><br/>
<img src="/img/showcase/filehound.jpg"></img><br/>
</p>

View File

@@ -2,7 +2,7 @@
# Molley Wallet
<p style={{"text-align": "center"}}>
<img src="mollywallet.png"></img><br/>
<img src="/img/showcase/mollywallet.png"></img><br/>
</p>
[Molly Wallet](https://github.com/grvlle/constellation_wallet/) the official $DAG wallet of the Constellation Network. It'll let users interact with the Hypergraph Network in various ways, not limited to producing $DAG transactions.

View File

@@ -2,7 +2,7 @@
# Optimus
<p style={{"text-align": "center"}}>
<img src="optimus.png"></img><br/>
<img src="/img/showcase/optimus.png"></img><br/>
</p>
[Optimus](https://github.com/splode/optimus) is a desktop image optimization application. It supports conversion and compression between WebP, JPEG, and PNG image formats.

View File

@@ -2,7 +2,7 @@
# Portfall
<p style={{"text-align": "center"}}>
<img src="portfall.gif"></img><br/>
<img src="/img/showcase/portfall.gif"></img><br/>
</p>
[Portfall](https://github.com/rekon-oss/portfall) - A desktop k8s port-forwarding portal for easy access to all your cluster UIs

View File

@@ -2,7 +2,7 @@
# Surge
<p style={{"text-align": "center"}}>
<img src="surge.png"></img><br/>
<img src="/img/showcase/surge.png"></img><br/>
</p>
[Surge](https://surge.rule110.io/) is a p2p filesharing app designed to utilize blockchain technologies to enable 100% anonymous file transfers. Surge is end-to-end encrypted, decentralized and open source.

View File

@@ -2,7 +2,7 @@
# Wally
<p style={{"text-align": "center"}}>
<img src="wally.png"></img><br/>
<img src="/img/showcase/wally.png"></img><br/>
</p>
[Wally](https://ergodox-ez.com/pages/wally) is the official firmware flasher for [Ergodox](https://ergodox-ez.com/) keyboards. It looks great and is a fantastic example of what you can achieve with Wails: the ability to combine the power of Go and the rich graphical tools of the web development world.

View File

@@ -2,7 +2,7 @@
# Wombat
<p style={{"text-align": "center"}}>
<img src="wombat.png"></img><br/>
<img src="/img/showcase/wombat.png"></img><br/>
</p>

View File

@@ -61,6 +61,12 @@ sidebar_position: 99
<a href="https://github.com/marcus-crane" style="width:50px">
<img src="https://github.com/marcus-crane.png?size=50" width="50"/>
</a>
<a href="https://github.com/codydbentley" style="width:65px">
<img src="https://github.com/codydbentley.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>
`,
}}
/>

View File

@@ -64,7 +64,7 @@ import TabItem from '@theme/TabItem';
## Installing Wails
Run `go get github.com/wailsapp/wails/v2/cmd/wails` to install the Wails CLI.
Run `go install github.com/wailsapp/wails/v2/cmd/wails@v2.0.0-beta.4` to install the Wails CLI.
## System Check

View File

@@ -0,0 +1,77 @@
# Frontend
## Execution Order
When Wails serves your `index.html`, by default, it will inject 2 script entries into the `<body>` tag to load `/wails/bindings.js`
and `/wails/runtime.js`. These files install the bindings and runtime respectively.
The code below shows where these are injected by default:
```html
<html>
<head>
<title>injection example</title>
<link rel="stylesheet" href="/main.css">
<!-- <script src="/wails/ipc.js"></script> -->
<!-- <script src="/wails/runtime.js"></script> -->
</head>
<body data-wails-drag>
<div class="logo"></div>
<div class="result" id="result">Please enter your name below 👇</div>
<div class="input-box" id="input" data-wails-no-drag>
<input class="input" id="name" type="text" autocomplete="off">
<button class="btn" onclick="greet()">Greet</button>
</div>
<script src="/main.js"></script>
</body>
</html>
```
### Overriding Default Execution Order
To provide more flexibility to developers, there is a meta tag that may be used to customise this behaviour:
```html
<meta name="wails-options" content="[options]">
```
The options are as follows:
| Value | Description |
| -------------------- | ------------------------------------------------- |
| noautoinjectruntime | Disable the autoinjection of `/wails/runtime.js` |
| noautoinjectbindings | Disable the autoinjection of `/wails/bindings.js` |
| noautoinject | Disable all autoinjection of scripts |
Multiple options may be used provided they are comma seperated.
This code is perfectly valid and operates the same as the autoinjection version:
```html
<html>
<head>
<title>injection example</title>
<meta name="wails-options" content="noautoinject">
<link rel="stylesheet" href="/main.css">
</head>
<body data-wails-drag>
<div class="logo"></div>
<div class="result" id="result">Please enter your name below 👇</div>
<div class="input-box" id="input" data-wails-no-drag>
<input class="input" id="name" type="text" autocomplete="off">
<button class="btn" onclick="greet()">Greet</button>
</div>
<script src="/wails/ipc.js"></script>
<script src="/wails/runtime.js"></script>
<script src="/main.js"></script>
</body>
</html>
```

View File

@@ -12,7 +12,7 @@ Currently, we support [Visual Studio Code](https://code.visualstudio.com/) but a
<img src="/img/vscode.png" style={{"width": "75%"}}></img>
</p>
When generating a project using the `-vscode` flag, IDE files will be created alongside the other project files.
When generating a project using the `-ide vscode` flags, IDE files will be created alongside the other project files.
These files are placed into the `.vscode` directory and provide the correct configuration for debugging your application.
The 2 files generated are `tasks.json` and `launch.json`. Below are the files generated for the default vanilla project:

View File

@@ -20,11 +20,11 @@ The Wails CLI has a number of commands that are used for managing your projects.
| -l | List available project templates | |
| -q | Suppress output to console | |
| -t "template name" | The project template to use. This can be the name of a default template or a URL to a remote template hosted on github. | vanilla |
| -vscode | Generate VSCode project files | |
| -ide | Generate IDE project files | |
| -f | Force build application | false |
Example:
`wails init -n test -d mytestproject -g -vscode -q`
`wails init -n test -d mytestproject -g -ide vscode -q`
This will generate a a project called "test" in the "mytestproject" directory, initialise git,
generate vscode project files and do so silently.

View File

@@ -17,7 +17,7 @@ If you have any concerns or suggestions, please raise them in the projects githu
export const NewComponent = () => (
<div>
<iframe plausible-embed="true" src="https://plausible.io/share/beta.wails.io?auth=wJa_HtqinG_eosqMjP-T1&embed=true&theme=system" scrolling="no" frameBorder={0} loading="lazy" style={{width: '1px', minWidth: '100%', height: '1600px'}} />
<iframe plausible-embed="true" src="https://plausible.io/share/wails.io?auth=Ll6cPlScOwOi_wgwZwMBn&embed=true&theme=system" scrolling="no" frameBorder={0} loading="lazy" style={{width: '1px', minWidth: '100%', height: '1600px'}} />
</div>
);

View File

@@ -28,7 +28,7 @@ Windows 的唯一选择是 IE11 渲染器。许多错误报告都因为受到它
- 用于控制应用程序窗口的运行时方法
- 现代化的原生对话框
Wails v2 代表了该项目的新基础。此版本的目的是获得有关新方式的反馈,并在完整版本发布之前解决所有错误。欢迎提出您的意见。请直接反馈到 [v2 测试版](https://github.com/wailsapp/wails/discussions)讨论板。
Wails v2 代表了该项目的新基础。此版本的目的是获得有关新方式的反馈,并在完整版本发布之前解决所有错误。欢迎提出您的意见。请直接反馈到 [v2 测试版](https://github.com/wailsapp/wails/discussions/828)讨论板。
为了达到这一点,经历了许多曲折和坎坷。部分原因是早期的技术决策需要改变,另一部分原因是我们花时间构建的一些核心问题的变通方式已经在上游得到了解决:Go 的 embed 特性就是一个很好的例子。幸运的是,一切都刚刚好,今天我们有了我们所能拥有的最好的解决方案。我相信等待是值得的 - 这在两个月前是完全不可能的。

View File

@@ -1,5 +1,7 @@
---
title: 关于 sidebar_position: 1
title: 关于
sidebar_position: 1
---
# 关于

View File

@@ -11,7 +11,7 @@ sidebar_position: 2
- [Gophers Slack Channel](https://gophers.slack.com/messages/CJ4P9F7MZ/)
- [Gophers Slack Channel Invite](https://invite.slack.golangbridge.org/)
- [Github Issues](https://github.com/wailsapp/wails/issues)
- [v2 Beta Discussion Board](https://github.com/wailsapp/wails/discussions)
- [v2 Beta Discussion Board](https://github.com/wailsapp/wails/discussions/828)
## 社交媒体

View File

@@ -64,7 +64,7 @@ import TabItem from "@theme/TabItem";
## 安装 Wails
运行 `go get github.com/wailsapp/wails/v2/cmd/wails` 安装 Wails CLI。
运行 `go install github.com/wailsapp/wails/v2/cmd/wails@v2.0.0-beta.4` 安装 Wails CLI。
## 系统检查

View File

@@ -21,11 +21,11 @@ Wails CLI 有许多用于管理项目的命令。所有命令都以此方式运
| -l | 可用项目模板列表 | |
| -q | 禁止输出到控制台 | |
| -t "template name" | 要使用的项目模板。这可能是在 github 上托管的远程模板的 URL 的名称。 | vanilla |
| -vscode | 生成 VSCode 项目文件 | |
| -ide | 生成 IDE 项目文件 | |
| -f | 强制构建应用 | false |
示例:
`wails init -n test -d mytestproject -g -vscode -q`
`wails init -n test -d mytestproject -g -ide vscode -q`
这将在 "mytestproject" 目录生成一个名为 "test" 的项目,初始化 git生成 vscode 项目文件并静默执行。

View File

@@ -8007,9 +8007,9 @@
"integrity": "sha512-w23ch4f75V1Tnz8DajsYKvY5lF7H1+WvzvLUcF0paFxkTHSp42RS0H5CttdN2Q8RR3DRGZ9v5xD/h3n8C8kGmg=="
},
"prismjs": {
"version": "1.24.1",
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.24.1.tgz",
"integrity": "sha512-mNPsedLuk90RVJioIky8ANZEwYm5w9LcvCXrxHlwf4fNVSn8jEipMybMkWUyyF0JhnC+C4VcOVSBuHRKs1L5Ow=="
"version": "1.25.0",
"resolved": "https://registry.npmjs.org/prismjs/-/prismjs-1.25.0.tgz",
"integrity": "sha512-WCjJHl1KEWbnkQom1+SzftbtXMKQoezOCYs5rECqMN+jP+apI7ftoflyqigqzopSO3hMhTEb0mFClA8lkolgEg=="
},
"process-nextick-args": {
"version": "2.0.1",

View File

Before

Width:  |  Height:  |  Size: 90 KiB

After

Width:  |  Height:  |  Size: 90 KiB

View File

Before

Width:  |  Height:  |  Size: 286 KiB

After

Width:  |  Height:  |  Size: 286 KiB

View File

Before

Width:  |  Height:  |  Size: 632 KiB

After

Width:  |  Height:  |  Size: 632 KiB

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 MiB

After

Width:  |  Height:  |  Size: 2.9 MiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 177 KiB

After

Width:  |  Height:  |  Size: 177 KiB

View File

Before

Width:  |  Height:  |  Size: 248 KiB

After

Width:  |  Height:  |  Size: 248 KiB