mirror of
https://github.com/wavetermdev/wails.git
synced 2026-04-22 15:26:15 -07:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e30704165f | |||
| faf36e8634 | |||
| aad811391b | |||
| bde4e5b699 | |||
| 40119e9a17 | |||
| 374e15650d | |||
| 32bbeb653e | |||
| 2c4b38e39d | |||
| e7756e9274 | |||
| 1f74b337ff | |||
| 98c4b967a7 | |||
| 37aa2c4eff | |||
| 311aee30b2 | |||
| 9cafd85cda | |||
| 08a71de536 | |||
| bc69b39ccd | |||
| 769a882e58 | |||
| d3332f0b2c | |||
| bf2d6d3241 | |||
| 3694dd2a55 | |||
| c451adc424 | |||
| 4093c9ec64 | |||
| 839e42edde | |||
| f2c4ada1e2 | |||
| 126f17a266 | |||
| e4fd7df68b | |||
| c5381dce70 | |||
| 964abcc6bd | |||
| 5d22da4126 | |||
| e714dd92a8 | |||
| 3bf4ea5113 | |||
| 65cef2f206 | |||
| bff2258aea | |||
| 8145b0e0c5 | |||
| 57e6834bd2 | |||
| 9c3f91bb48 | |||
| d899621351 | |||
| 1957e2e86c | |||
| 1c8e2ee8fe | |||
| 741558532b |
@@ -47,7 +47,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x]
|
||||
node-version: [20.x]
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
- name: Set Node
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 16.x
|
||||
node-version: 20.x
|
||||
|
||||
- name: Update Sponsors
|
||||
run: cd scripts/sponsors && chmod 755 ./generate-sponsor-image.sh && ./generate-sponsor-image.sh
|
||||
|
||||
@@ -15,7 +15,7 @@ jobs:
|
||||
- name: Setup Nodejs
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.x
|
||||
node-version: 20.x
|
||||
|
||||
- name: Install Task
|
||||
uses: arduino/setup-task@v1
|
||||
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
- name: Setup Nodejs
|
||||
uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: 18.x
|
||||
node-version: 20.x
|
||||
|
||||
- name: Setup Task
|
||||
uses: arduino/setup-task@v1
|
||||
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 2.x.x | :white_check_mark: |
|
||||
| 3.0.x-alpha | :x: |
|
||||
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
If you believe you have found a security vulnerability in our project, we encourage you to let us know right away.
|
||||
We will investigate all legitimate reports and do our best to quickly fix the problem.
|
||||
|
||||
Before reporting though, please review our security policy below.
|
||||
|
||||
### How to Report
|
||||
|
||||
To report a security vulnerability, please use GitHub's [private vulnerability reporting](https://docs.github.com/en/code-security/security-advisories/guidance-on-reporting-and-writing-information-about-vulnerabilities/privately-reporting-a-security-vulnerability) feature. If possible, please include as much information as possible.
|
||||
This may include steps to reproduce, impact of the vulnerability, and anything else you believe would help us understand the problem.
|
||||
**Please do not include any sensitive or personal information in your report**.
|
||||
|
||||
### What to Expect
|
||||
|
||||
When you report a vulnerability, here's what you can expect:
|
||||
|
||||
- **Acknowledgement**: We will acknowledge your email within 48 hours, and you'll receive a more detailed response to your email within 72 hours indicating the next steps in handling your report.
|
||||
|
||||
- **Updates**: After the initial reply to your report, our team will keep you informed of the progress being made towards a fix and full announcement. These updates will be sent at least once a week.
|
||||
|
||||
- **Confidentiality**: We will maintain strict confidentiality of your report until the security issue is resolved.
|
||||
|
||||
- **Issue Resolution**: If the issue is confirmed, we will release a patch as soon as possible depending on complexity of the fix.
|
||||
|
||||
- **Recognition**: We recognize and appreciate every individual who helps us identify and fix vulnerabilities in our project. While we do not currently have a bounty program, we would be happy to publicly acknowledge your responsible disclosure.
|
||||
|
||||
We strive to make Wails safe for everyone, and we greatly appreciate the assistance of security researchers and users in helping us identify and fix vulnerabilities. Thank you for your contribution to the security of this project.
|
||||
Generated
+516
-1428
File diff suppressed because it is too large
Load Diff
@@ -10,6 +10,6 @@
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"sponsorkit": "^0.8.2"
|
||||
"sponsorkit": "^0.9.3"
|
||||
}
|
||||
}
|
||||
|
||||
+47
-30
@@ -108,7 +108,7 @@ func buildApplication(f *flags.Build) error {
|
||||
{"Tags", "[" + strings.Join(f.GetTags(), ",") + "]"},
|
||||
{"Race Detector", bool2Str(f.RaceDetector)},
|
||||
}...)
|
||||
if len(buildOptions.OutputFile) > 0 && len(f.GetTargets()) == 1 {
|
||||
if len(buildOptions.OutputFile) > 0 && f.GetTargets().Length() == 1 {
|
||||
tableData = append(tableData, []string{"Output File", f.OutputFilename})
|
||||
}
|
||||
pterm.DefaultSection.Println("Build Options")
|
||||
@@ -145,11 +145,16 @@ func buildApplication(f *flags.Build) error {
|
||||
|
||||
// Allows cancelling the build after the first error. It would be nice if targets.Each would support funcs
|
||||
// returning an error.
|
||||
var targetErr error
|
||||
targets := f.GetTargets()
|
||||
for _, target := range targets {
|
||||
if !validPlatformArch.Contains(target.Platform) {
|
||||
buildOptions.Logger.Println("platform '%s' is not supported - skipping. Supported platforms: %s", target.Platform, validPlatformArch.Join(","))
|
||||
continue
|
||||
targets.Each(func(platform string) {
|
||||
if targetErr != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if !validPlatformArch.Contains(platform) {
|
||||
buildOptions.Logger.Println("platform '%s' is not supported - skipping. Supported platforms: %s", platform, validPlatformArch.Join(","))
|
||||
return
|
||||
}
|
||||
|
||||
desiredFilename := projectOptions.OutputFilename
|
||||
@@ -158,13 +163,17 @@ func buildApplication(f *flags.Build) error {
|
||||
}
|
||||
desiredFilename = strings.TrimSuffix(desiredFilename, ".exe")
|
||||
|
||||
buildOptions.Platform = target.Platform
|
||||
buildOptions.Arch = target.Arch
|
||||
|
||||
// Calculate platform and arch
|
||||
platformSplit := strings.Split(platform, "/")
|
||||
buildOptions.Platform = platformSplit[0]
|
||||
buildOptions.Arch = f.GetDefaultArch()
|
||||
if len(platformSplit) > 1 {
|
||||
buildOptions.Arch = platformSplit[1]
|
||||
}
|
||||
banner := "Building target: " + buildOptions.Platform + "/" + buildOptions.Arch
|
||||
pterm.DefaultSection.Println(banner)
|
||||
|
||||
if f.Upx && target.String() == "darwin/universal" {
|
||||
if f.Upx && platform == "darwin/universal" {
|
||||
pterm.Warning.Println("Warning: compress flag unsupported for universal binaries. Ignoring.")
|
||||
f.Upx = false
|
||||
}
|
||||
@@ -173,19 +182,22 @@ func buildApplication(f *flags.Build) error {
|
||||
case "linux":
|
||||
if runtime.GOOS != "linux" {
|
||||
pterm.Warning.Println("Crosscompiling to Linux not currently supported.")
|
||||
continue
|
||||
return
|
||||
}
|
||||
case "darwin":
|
||||
if runtime.GOOS != "darwin" {
|
||||
pterm.Warning.Println("Crosscompiling to Mac not currently supported.")
|
||||
continue
|
||||
return
|
||||
}
|
||||
if targets.MacTargetsCount() == 2 {
|
||||
macTargets := targets.Filter(func(platform string) bool {
|
||||
return strings.HasPrefix(platform, "darwin")
|
||||
})
|
||||
if macTargets.Length() == 2 {
|
||||
buildOptions.BundleName = fmt.Sprintf("%s-%s.app", desiredFilename, buildOptions.Arch)
|
||||
}
|
||||
}
|
||||
|
||||
if len(targets) > 1 {
|
||||
if targets.Length() > 1 {
|
||||
// target filename
|
||||
switch buildOptions.Platform {
|
||||
case "windows":
|
||||
@@ -207,27 +219,32 @@ func buildApplication(f *flags.Build) error {
|
||||
pterm.Warning.Println("obfuscated flag overrides skipbindings flag.")
|
||||
buildOptions.SkipBindings = false
|
||||
}
|
||||
}
|
||||
|
||||
if !f.DryRun {
|
||||
// Start Time
|
||||
start := time.Now()
|
||||
if !f.DryRun {
|
||||
// Start Time
|
||||
start := time.Now()
|
||||
|
||||
compiledBinary, err := build.Build(buildOptions)
|
||||
if err != nil {
|
||||
pterm.Error.Println(err.Error())
|
||||
return err
|
||||
compiledBinary, err := build.Build(buildOptions)
|
||||
if err != nil {
|
||||
pterm.Error.Println(err.Error())
|
||||
targetErr = err
|
||||
return
|
||||
}
|
||||
|
||||
buildOptions.IgnoreFrontend = true
|
||||
buildOptions.CleanBinDirectory = false
|
||||
|
||||
// Output stats
|
||||
buildOptions.Logger.Println(fmt.Sprintf("Built '%s' in %s.\n", compiledBinary, time.Since(start).Round(time.Millisecond).String()))
|
||||
|
||||
outputBinaries[buildOptions.Platform+"/"+buildOptions.Arch] = compiledBinary
|
||||
} else {
|
||||
pterm.Info.Println("Dry run: skipped build.")
|
||||
}
|
||||
})
|
||||
|
||||
buildOptions.IgnoreFrontend = true
|
||||
buildOptions.CleanBinDirectory = false
|
||||
|
||||
// Output stats
|
||||
buildOptions.Logger.Println(fmt.Sprintf("Built '%s' in %s.\n", compiledBinary, time.Since(start).Round(time.Millisecond).String()))
|
||||
|
||||
outputBinaries[buildOptions.Platform+"/"+buildOptions.Arch] = compiledBinary
|
||||
} else {
|
||||
pterm.Info.Println("Dry run: skipped build.")
|
||||
if targetErr != nil {
|
||||
return targetErr
|
||||
}
|
||||
|
||||
if f.DryRun {
|
||||
|
||||
@@ -2,10 +2,13 @@ package flags
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/leaanthony/slicer"
|
||||
"github.com/wailsapp/wails/v2/internal/system"
|
||||
"github.com/wailsapp/wails/v2/pkg/commands/build"
|
||||
"github.com/wailsapp/wails/v2/pkg/commands/buildtags"
|
||||
)
|
||||
@@ -22,7 +25,6 @@ type Build struct {
|
||||
BuildCommon
|
||||
|
||||
NoPackage bool `name:"noPackage" description:"Skips platform specific packaging"`
|
||||
SkipModTidy bool `name:"m" description:"Skip mod tidy before compile"`
|
||||
Upx bool `description:"Compress final binary with UPX (if installed)"`
|
||||
UpxFlags string `description:"Flags to pass to upx"`
|
||||
Platform string `description:"Platform to target. Comma separate multiple platforms"`
|
||||
@@ -46,15 +48,29 @@ type Build struct {
|
||||
compilerPath string
|
||||
userTags []string
|
||||
wv2rtstrategy string // WebView2 runtime strategy
|
||||
defaultArch string // Default architecture
|
||||
}
|
||||
|
||||
func (b *Build) Default() *Build {
|
||||
target := defaultTarget()
|
||||
defaultPlatform := os.Getenv("GOOS")
|
||||
if defaultPlatform == "" {
|
||||
defaultPlatform = runtime.GOOS
|
||||
}
|
||||
defaultArch := os.Getenv("GOARCH")
|
||||
if defaultArch == "" {
|
||||
if system.IsAppleSilicon {
|
||||
defaultArch = "arm64"
|
||||
} else {
|
||||
defaultArch = runtime.GOARCH
|
||||
}
|
||||
}
|
||||
|
||||
result := &Build{
|
||||
Platform: target.Platform,
|
||||
Platform: defaultPlatform + "/" + defaultArch,
|
||||
WebView2: "download",
|
||||
GarbleArgs: "-literals -tiny -seed=random",
|
||||
|
||||
defaultArch: defaultArch,
|
||||
}
|
||||
result.BuildCommon = result.BuildCommon.Default()
|
||||
return result
|
||||
@@ -71,8 +87,11 @@ func (b *Build) GetWebView2Strategy() string {
|
||||
return b.wv2rtstrategy
|
||||
}
|
||||
|
||||
func (b *Build) GetTargets() TargetsCollection {
|
||||
return parseTargets(b.Platform)
|
||||
func (b *Build) GetTargets() *slicer.StringSlicer {
|
||||
var targets slicer.StringSlicer
|
||||
targets.AddSlice(strings.Split(b.Platform, ","))
|
||||
targets.Deduplicate()
|
||||
return &targets
|
||||
}
|
||||
|
||||
func (b *Build) GetCompilerPath() string {
|
||||
@@ -124,6 +143,10 @@ func (b *Build) GetBuildModeAsString() string {
|
||||
return "production"
|
||||
}
|
||||
|
||||
func (b *Build) GetDefaultArch() string {
|
||||
return b.defaultArch
|
||||
}
|
||||
|
||||
/*
|
||||
_, _ = fmt.Fprintf(w, "Frontend Directory: \t%s\n", projectOptions.GetFrontendDir())
|
||||
_, _ = fmt.Fprintf(w, "Obfuscated: \t%t\n", buildOptions.Obfuscated)
|
||||
|
||||
@@ -9,6 +9,7 @@ type BuildCommon struct {
|
||||
Verbosity int `name:"v" description:"Verbosity level (0 = quiet, 1 = normal, 2 = verbose)"`
|
||||
Tags string `description:"Build tags to pass to Go compiler. Must be quoted. Space or comma (but not both) separated"`
|
||||
NoSyncGoMod bool `description:"Don't sync go.mod"`
|
||||
SkipModTidy bool `name:"m" description:"Skip mod tidy before compile"`
|
||||
}
|
||||
|
||||
func (c BuildCommon) Default() BuildCommon {
|
||||
|
||||
@@ -1,103 +1,5 @@
|
||||
package flags
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
"github.com/leaanthony/slicer"
|
||||
"github.com/pterm/pterm"
|
||||
"github.com/wailsapp/wails/v2/internal/system"
|
||||
)
|
||||
|
||||
type Common struct {
|
||||
NoColour bool `description:"Disable colour in output"`
|
||||
}
|
||||
|
||||
type Target struct {
|
||||
Platform string
|
||||
Arch string
|
||||
}
|
||||
|
||||
func defaultTarget() Target {
|
||||
defaultPlatform := os.Getenv("GOOS")
|
||||
if defaultPlatform == "" {
|
||||
defaultPlatform = runtime.GOOS
|
||||
}
|
||||
defaultArch := os.Getenv("GOARCH")
|
||||
if defaultArch == "" {
|
||||
if system.IsAppleSilicon {
|
||||
defaultArch = "arm64"
|
||||
} else {
|
||||
defaultArch = runtime.GOARCH
|
||||
}
|
||||
}
|
||||
|
||||
return Target{
|
||||
Platform: defaultPlatform,
|
||||
Arch: defaultArch,
|
||||
}
|
||||
}
|
||||
|
||||
type TargetsCollection []Target
|
||||
|
||||
func (c TargetsCollection) MacTargetsCount() int {
|
||||
count := 0
|
||||
|
||||
for _, t := range c {
|
||||
if strings.HasPrefix(t.Platform, "darwin") {
|
||||
count++
|
||||
}
|
||||
}
|
||||
|
||||
return count
|
||||
}
|
||||
|
||||
func (t Target) String() string {
|
||||
if t.Arch != "" {
|
||||
return fmt.Sprintf("%s/%s", t.Platform, t.Arch)
|
||||
}
|
||||
|
||||
return t.Platform
|
||||
}
|
||||
|
||||
func parseTargets(platform string) TargetsCollection {
|
||||
allowedPlatforms := map[string]bool{
|
||||
"windows": true,
|
||||
"linux": true,
|
||||
"darwin": true,
|
||||
}
|
||||
|
||||
if !allowedPlatforms[platform] {
|
||||
pterm.Error.Println("platform argument must be one of 'windows', 'linux', or 'darwin'")
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
var result []Target
|
||||
var targets slicer.StringSlicer
|
||||
|
||||
targets.AddSlice(strings.Split(platform, ","))
|
||||
targets.Deduplicate()
|
||||
|
||||
targets.Each(func(platform string) {
|
||||
target := Target{
|
||||
Platform: "",
|
||||
Arch: "",
|
||||
}
|
||||
|
||||
platformSplit := strings.Split(platform, "/")
|
||||
|
||||
target.Platform = platformSplit[0]
|
||||
|
||||
if len(platformSplit) > 1 {
|
||||
target.Arch = platformSplit[1]
|
||||
} else {
|
||||
target.Arch = defaultTarget().Arch
|
||||
}
|
||||
|
||||
result = append(result, target)
|
||||
})
|
||||
|
||||
return result
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import (
|
||||
"net/url"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"runtime"
|
||||
|
||||
"github.com/samber/lo"
|
||||
"github.com/wailsapp/wails/v2/internal/project"
|
||||
@@ -16,7 +17,6 @@ type Dev struct {
|
||||
BuildCommon
|
||||
|
||||
AssetDir string `flag:"assetdir" description:"Serve assets from the given directory instead of using the provided asset FS"`
|
||||
Platform string `flag:"platform" description:"Platform to target"`
|
||||
Extensions string `flag:"e" description:"Extensions to trigger rebuilds (comma separated) eg go"`
|
||||
ReloadDirs string `flag:"reloaddirs" description:"Additional directories to trigger reloads (comma separated)"`
|
||||
Browser bool `flag:"browser" description:"Open the application in a browser"`
|
||||
@@ -38,13 +38,10 @@ type Dev struct {
|
||||
}
|
||||
|
||||
func (*Dev) Default() *Dev {
|
||||
target := defaultTarget()
|
||||
result := &Dev{
|
||||
Extensions: "go",
|
||||
Debounce: 100,
|
||||
Platform: target.Platform,
|
||||
}
|
||||
|
||||
result.BuildCommon = result.BuildCommon.Default()
|
||||
return result
|
||||
}
|
||||
@@ -119,15 +116,13 @@ func (d *Dev) loadAndMergeProjectConfig() error {
|
||||
|
||||
// GenerateBuildOptions creates a build.Options using the flags
|
||||
func (d *Dev) GenerateBuildOptions() *build.Options {
|
||||
targets := parseTargets(d.Platform)
|
||||
|
||||
result := &build.Options{
|
||||
OutputType: "dev",
|
||||
Mode: build.Dev,
|
||||
Devtools: true,
|
||||
Arch: targets[0].Arch,
|
||||
Arch: runtime.GOARCH,
|
||||
Pack: true,
|
||||
Platform: targets[0].Platform,
|
||||
Platform: runtime.GOOS,
|
||||
LDFlags: d.LdFlags,
|
||||
Compiler: d.Compiler,
|
||||
ForceBuild: d.ForceBuild,
|
||||
|
||||
@@ -125,6 +125,12 @@ func initProject(f *flags.Init) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Change the module name to project name
|
||||
err = updateModuleNameToProjectName(options, quiet)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if !f.CIMode {
|
||||
// Run `go mod tidy` to ensure `go.sum` is up to date
|
||||
cmd := exec.Command("go", "mod", "tidy")
|
||||
@@ -276,3 +282,14 @@ func updateReplaceLine(targetPath string) {
|
||||
fatal(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func updateModuleNameToProjectName(options *templates.Options, quiet bool) error {
|
||||
cmd := exec.Command("go", "mod", "edit", "-module", options.ProjectName)
|
||||
cmd.Dir = options.TargetDir
|
||||
cmd.Stderr = os.Stderr
|
||||
if !quiet {
|
||||
cmd.Stdout = os.Stdout
|
||||
}
|
||||
|
||||
return cmd.Run()
|
||||
}
|
||||
|
||||
@@ -60,10 +60,12 @@ func Application(f *flags.Dev, logger *clilogger.CLILogger) error {
|
||||
return err
|
||||
}
|
||||
|
||||
// Run go mod tidy to ensure we're up-to-date
|
||||
err = runCommand(cwd, false, f.Compiler, "mod", "tidy")
|
||||
if err != nil {
|
||||
return err
|
||||
if !f.SkipModTidy {
|
||||
// Run go mod tidy to ensure we're up-to-date
|
||||
err = runCommand(cwd, false, f.Compiler, "mod", "tidy")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
buildOptions := f.GenerateBuildOptions()
|
||||
@@ -268,16 +270,6 @@ func runFrontendDevWatcherCommand(frontendDirectory string, devCommand string, d
|
||||
}, viteServerURL, viteVersion, nil
|
||||
}
|
||||
|
||||
func isWsl() bool {
|
||||
version, err := os.ReadFile("/proc/version")
|
||||
|
||||
if err != nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return strings.Contains(strings.ToLower(string(version)), "wsl")
|
||||
}
|
||||
|
||||
// restartApp does the actual rebuilding of the application when files change
|
||||
func restartApp(buildOptions *build.Options, debugBinaryProcess *process.Process, f *flags.Dev, exitCodeChannel chan int, legacyUseDevServerInsteadofCustomScheme bool) (*process.Process, string, error) {
|
||||
appBinary, err := build.Build(buildOptions)
|
||||
@@ -316,12 +308,6 @@ func restartApp(buildOptions *build.Options, debugBinaryProcess *process.Process
|
||||
os.Setenv("devserver", f.DevServer)
|
||||
os.Setenv("frontenddevserverurl", f.FrontendDevServerURL)
|
||||
|
||||
if buildOptions.IsWindowsTargetPlatform() && isWsl() {
|
||||
// In the case of building a Windows executable under WSL, we need to specify this variable with a list of
|
||||
// variables that will be passed through
|
||||
os.Setenv("WSLENV", "loglevel/w:frontenddevserverurl/w:devserver/w:assetdir/w")
|
||||
}
|
||||
|
||||
// Start up new binary with correct args
|
||||
newProcess := process.NewProcess(appBinary, args...)
|
||||
err = newProcess.Start(exitCodeChannel)
|
||||
|
||||
@@ -1 +1 @@
|
||||
v2.8.0
|
||||
v2.8.1
|
||||
@@ -19,7 +19,7 @@ func isFunction(value interface{}) bool {
|
||||
return reflect.ValueOf(value).Kind() == reflect.Func
|
||||
}
|
||||
|
||||
// isStructPtr returns true if the value given is a struct
|
||||
// isStruct returns true if the value given is a struct
|
||||
func isStruct(value interface{}) bool {
|
||||
return reflect.ValueOf(value).Kind() == reflect.Struct
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#define WindowStartsMinimised 2
|
||||
#define WindowStartsFullscreen 3
|
||||
|
||||
WailsContext* Create(const char* title, int width, int height, int frameless, int resizable, int fullscreen, int fullSizeContent, int hideTitleBar, int titlebarAppearsTransparent, int hideTitle, int useToolbar, int hideToolbarSeparator, int webviewIsTransparent, int alwaysOnTop, int hideWindowOnClose, const char *appearance, int windowIsTranslucent, int devtoolsEnabled, int defaultContextMenuEnabled, int windowStartState, int startsHidden, int minWidth, int minHeight, int maxWidth, int maxHeight, bool fraudulentWebsiteWarningEnabled, struct Preferences preferences, int singleInstanceEnabled, const char* singleInstanceUniqueId);
|
||||
WailsContext* Create(const char* title, int width, int height, int frameless, int resizable, int zoomable, int fullscreen, int fullSizeContent, int hideTitleBar, int titlebarAppearsTransparent, int hideTitle, int useToolbar, int hideToolbarSeparator, int webviewIsTransparent, int alwaysOnTop, int hideWindowOnClose, const char *appearance, int windowIsTranslucent, int devtoolsEnabled, int defaultContextMenuEnabled, int windowStartState, int startsHidden, int minWidth, int minHeight, int maxWidth, int maxHeight, bool fraudulentWebsiteWarningEnabled, struct Preferences preferences, int singleInstanceEnabled, const char* singleInstanceUniqueId);
|
||||
void Run(void*, const char* url);
|
||||
|
||||
void SetTitle(void* ctx, const char *title);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#import "WailsMenu.h"
|
||||
#import "WailsMenuItem.h"
|
||||
|
||||
WailsContext* Create(const char* title, int width, int height, int frameless, int resizable, int fullscreen, int fullSizeContent, int hideTitleBar, int titlebarAppearsTransparent, int hideTitle, int useToolbar, int hideToolbarSeparator, int webviewIsTransparent, int alwaysOnTop, int hideWindowOnClose, const char *appearance, int windowIsTranslucent, int devtoolsEnabled, int defaultContextMenuEnabled, int windowStartState, int startsHidden, int minWidth, int minHeight, int maxWidth, int maxHeight, bool fraudulentWebsiteWarningEnabled, struct Preferences preferences, int singleInstanceLockEnabled, const char* singleInstanceUniqueId) {
|
||||
WailsContext* Create(const char* title, int width, int height, int frameless, int resizable, int zoomable, int fullscreen, int fullSizeContent, int hideTitleBar, int titlebarAppearsTransparent, int hideTitle, int useToolbar, int hideToolbarSeparator, int webviewIsTransparent, int alwaysOnTop, int hideWindowOnClose, const char *appearance, int windowIsTranslucent, int devtoolsEnabled, int defaultContextMenuEnabled, int windowStartState, int startsHidden, int minWidth, int minHeight, int maxWidth, int maxHeight, bool fraudulentWebsiteWarningEnabled, struct Preferences preferences, int singleInstanceLockEnabled, const char* singleInstanceUniqueId) {
|
||||
|
||||
[NSApplication sharedApplication];
|
||||
|
||||
@@ -27,7 +27,7 @@ WailsContext* Create(const char* title, int width, int height, int frameless, in
|
||||
fullscreen = 1;
|
||||
}
|
||||
|
||||
[result CreateWindow:width :height :frameless :resizable :fullscreen :fullSizeContent :hideTitleBar :titlebarAppearsTransparent :hideTitle :useToolbar :hideToolbarSeparator :webviewIsTransparent :hideWindowOnClose :safeInit(appearance) :windowIsTranslucent :minWidth :minHeight :maxWidth :maxHeight :fraudulentWebsiteWarningEnabled :preferences];
|
||||
[result CreateWindow:width :height :frameless :resizable :zoomable :fullscreen :fullSizeContent :hideTitleBar :titlebarAppearsTransparent :hideTitle :useToolbar :hideToolbarSeparator :webviewIsTransparent :hideWindowOnClose :safeInit(appearance) :windowIsTranslucent :minWidth :minHeight :maxWidth :maxHeight :fraudulentWebsiteWarningEnabled :preferences];
|
||||
[result SetTitle:safeInit(title)];
|
||||
[result Center];
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ struct Preferences {
|
||||
bool *fullscreenEnabled;
|
||||
};
|
||||
|
||||
- (void) CreateWindow:(int)width :(int)height :(bool)frameless :(bool)resizable :(bool)fullscreen :(bool)fullSizeContent :(bool)hideTitleBar :(bool)titlebarAppearsTransparent :(bool)hideTitle :(bool)useToolbar :(bool)hideToolbarSeparator :(bool)webviewIsTransparent :(bool)hideWindowOnClose :(NSString *)appearance :(bool)windowIsTranslucent :(int)minWidth :(int)minHeight :(int)maxWidth :(int)maxHeight :(bool)fraudulentWebsiteWarningEnabled :(struct Preferences)preferences;
|
||||
- (void) CreateWindow:(int)width :(int)height :(bool)frameless :(bool)resizable :(bool)zoomable :(bool)fullscreen :(bool)fullSizeContent :(bool)hideTitleBar :(bool)titlebarAppearsTransparent :(bool)hideTitle :(bool)useToolbar :(bool)hideToolbarSeparator :(bool)webviewIsTransparent :(bool)hideWindowOnClose :(NSString *)appearance :(bool)windowIsTranslucent :(int)minWidth :(int)minHeight :(int)maxWidth :(int)maxHeight :(bool)fraudulentWebsiteWarningEnabled :(struct Preferences)preferences;
|
||||
- (void) SetSize:(int)width :(int)height;
|
||||
- (void) SetPosition:(int)x :(int) y;
|
||||
- (void) SetMinSize:(int)minWidth :(int)minHeight;
|
||||
|
||||
@@ -136,7 +136,7 @@ typedef void (^schemeTaskCaller)(id<WKURLSchemeTask>);
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void) CreateWindow:(int)width :(int)height :(bool)frameless :(bool)resizable :(bool)fullscreen :(bool)fullSizeContent :(bool)hideTitleBar :(bool)titlebarAppearsTransparent :(bool)hideTitle :(bool)useToolbar :(bool)hideToolbarSeparator :(bool)webviewIsTransparent :(bool)hideWindowOnClose :(NSString*)appearance :(bool)windowIsTranslucent :(int)minWidth :(int)minHeight :(int)maxWidth :(int)maxHeight :(bool)fraudulentWebsiteWarningEnabled :(struct Preferences)preferences {
|
||||
- (void) CreateWindow:(int)width :(int)height :(bool)frameless :(bool)resizable :(bool)zoomable :(bool)fullscreen :(bool)fullSizeContent :(bool)hideTitleBar :(bool)titlebarAppearsTransparent :(bool)hideTitle :(bool)useToolbar :(bool)hideToolbarSeparator :(bool)webviewIsTransparent :(bool)hideWindowOnClose :(NSString*)appearance :(bool)windowIsTranslucent :(int)minWidth :(int)minHeight :(int)maxWidth :(int)maxHeight :(bool)fraudulentWebsiteWarningEnabled :(struct Preferences)preferences {
|
||||
NSWindowStyleMask styleMask = 0;
|
||||
|
||||
if( !frameless ) {
|
||||
@@ -158,7 +158,6 @@ typedef void (^schemeTaskCaller)(id<WKURLSchemeTask>);
|
||||
|
||||
self.mainWindow = [[WailsWindow alloc] initWithContentRect:NSMakeRect(0, 0, width, height)
|
||||
styleMask:styleMask backing:NSBackingStoreBuffered defer:NO];
|
||||
|
||||
if (!frameless && useToolbar) {
|
||||
id toolbar = [[NSToolbar alloc] initWithIdentifier:@"wails.toolbar"];
|
||||
[toolbar autorelease];
|
||||
@@ -188,6 +187,10 @@ typedef void (^schemeTaskCaller)(id<WKURLSchemeTask>);
|
||||
[self.mainWindow setAppearance:nsAppearance];
|
||||
}
|
||||
|
||||
if (!zoomable && resizable) {
|
||||
NSButton *button = [self.mainWindow standardWindowButton:NSWindowZoomButton];
|
||||
[button setEnabled: NO];
|
||||
}
|
||||
|
||||
NSSize minSize = { minWidth, minHeight };
|
||||
NSSize maxSize = { maxWidth, maxHeight };
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user