* fix(v2): prevent wails init in non-empty directory with -d flag
When using -d to specify a target directory, wails init now checks if
the directory is non-empty and errors if so. This prevents accidental
data loss (e.g., overwriting .git directories).
Fixes#4940
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test(v2): add tests for init non-empty directory check
Add tests to verify:
- Install fails when target directory is non-empty
- Install succeeds when target directory is empty
Also update changelog with the fix.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* Apply suggestions from code review
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* feat(v2): add runtime.ResetSignalHandlers() for Linux panic recovery
Add a new runtime function that allows users to reset signal handlers
before code that might panic from nil pointer dereferences.
On Linux, WebKit installs signal handlers without the SA_ONSTACK flag,
which prevents Go from properly recovering from panics caused by
SIGSEGV and other signals. This function adds SA_ONSTACK to the
relevant signal handlers (SIGSEGV, SIGBUS, SIGFPE, SIGABRT).
Usage:
```go
go func() {
defer func() {
if err := recover(); err != nil {
log.Printf("Recovered: %v", err)
}
}()
runtime.ResetSignalHandlers()
// Code that might panic...
}()
```
The function is a no-op on macOS and Windows.
Fixes#3965
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* test(v2): add panic-recovery-test example
Add an example that demonstrates the Linux signal handler issue (#3965)
and verifies the fix using runtime.ResetSignalHandlers().
The example includes:
- A Greet function that triggers a nil pointer dereference after a delay
- Auto-call from frontend after 5 seconds
- README with reproduction steps
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
* fix: add missing EventsOffAll export to runtime templates
The EventsOffAll function was implemented in the internal runtime
(desktop/events.js) and exported in the wrapper runtime files, but was
missing from the public runtime templates that are generated in user
projects. This caused a type mismatch where EventsOffAll was declared
in the TypeScript definition but the implementation was missing.
This commit adds the EventsOffAll export and type declaration to all
frontend framework templates:
- Common templates (generate/assets/common)
- React / React-TS
- Vue / Vue-TS
- Svelte / Svelte-TS
- Preact / Preact-TS
- Lit / Lit-TS
- Vanilla / Vanilla-TS
Fixes#4703
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* docs: add EventsOffAll to runtime events documentation
Added EventsOffAll function documentation to both English and Chinese
versions of the runtime events reference.
The function was already implemented in Go (pkg/runtime/events.go) and
JavaScript (internal/frontend/runtime/desktop/events.js), but was missing
from the public documentation.
Related to #4703
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* chore: add EventsOffAll fix to changelog
Added entry for the EventsOffAll fix to the Unreleased section
of the changelog.
Related to #4703
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
* docs: translate EventsOffAll description to Chinese
Improved consistency in Chinese documentation by translating the
EventsOffAll description from English to Chinese, matching the
style of other event method descriptions.
Related to #4703
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
---------
Co-authored-by: cc <Zhuanz@MacBook-Pro.local>
Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
* Prevent DLL hijacking by setting default DLL directories on initialization
* Updated the changelog
* Added DLLSearchPaths option to control DLL search paths on Windows
* Changed the order of the execution for uxtheme.go and consts.go
* Init uxtheme.go and consts.go once the dll path is set
---------
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
* feat(options): add ContentProtection bool config to macos and windows options
* feat(darwin): implement ContentProtection for darwin
* feat(windows): implement ContentProtection for windows
* chore(website): add feature to changelog
* feat(examples): add an example showcasing the ContentPrivacy flag
* chore(examples): update readme
* fix(example): format and build
* fix(winc): rename to wda and add version check
* chore(reference): add docs for ContentProtection
* fix(darwin): future-proof setting the sharing type
* fix(example): wording consistency
* chore(examples): remove privatewindow example
---------
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
* mod : added OutputFilename field to assetData \n mod : modified resolveProjectData to export OutputFilename \n mod : modified CFBundleExecutable values to .OutputFilename in info.dev.plist, info.plist
* mod : update changelog.mdx
---------
Co-authored-by: nick-bae <nick.bae@ddkakaoenterprise.com>
* fix(pkg): Fixed an issue where wails new would throw an error if the author name contained non-JSON legal characters.
* refactor(pkg): Incorporating coderabbit's suggestions
* docs: write changelog.mdx
* Escape using json package. Add tests.
* Update test.
---------
Co-authored-by: Lea O'Anthony <lea.anthony@gmail.com>
* Feature/1090 native drag and drop for file and folder (#3203)
* implement basic dnd for linux
* implemented windows
* progress changed linux handling and added coordinates to drop
* progress fix drop coordinates on windows
* progress remove log from windows
* progress move js
* update js after merge
* fix event listener registration
* fix segfault on non file drag
* remove logs, fix coordinates
* minor changes, simplify to drop only
* rename EnableWails -> EnableFileDrop
* add documentation (PR id missing)
* add PR id to changelog
* fix remove casting from malloc
* fix nil check for OnFileDrop's callback
* fix nil check for OnFileDrop skip event when nil
* add error message for nil callback in OnFileDrop
---------
Co-authored-by: lyimmi <lelvente.zambo@gmail.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
* implement native drag and drop for macOS (#3250)
* implement native drag and drop for macOS
* update docs
* add to changelog
* update docs (macOS is supported)
* Fix windows DragAndDrop options
* Fix class unset on dragleave for full frame elements
* improve class unset (nested elements and borders case)
* Fix runtime drop target detection and CSS class assignment
* Edit changelog
* Fix drag-and-drop options in references
* Update v2/internal/frontend/desktop/darwin/WailsWebView.m
* Update v2/internal/frontend/desktop/darwin/WailsWebView.m
---------
Co-authored-by: Zámbó, Levente <levente.zambo@gmail.com>
Co-authored-by: lyimmi <lelvente.zambo@gmail.com>
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: Andrey Pshenkin <andrey.pshenkin@gmail.com>
Co-authored-by: Pavel Binar <pavel@beamtransfer.io>
* fix icon issues with windows when project name contains spaces
* add comment
* add to change log
---------
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
* Add disable zoom on mac
* Add changelog line
* Add zommable in main.m
I see this file is ignore, but i think it's better to keep it up-to-date so if we ever unignore it will work correctly.
* Added possibility to specify platform for dev command
---------
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* feat: add windows options supports `IsPinchZoomEnabled` configuration(#2021)
* refactor: modify `IsPinchZoomEnabled` to `DisablePinchZoom` ensure default behavior is consistent
* docs: add `DisablePinchZoom` to changelog
* docs: update the description of `DisablePinchZoom` attributes in the document
---------
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
* Add support to output ts models as interfaces
* Add support to generate enums from golang
* cleanup logs
* add missing documentation
* fix package names for enum. Fix processing enums that are in separate packages
* revert golang 1.21
* Fix spelling
* Add support for simplified version of Enum for typescriptify
* update docs
* removed unused logs
* Add tests. Fix imported enums types in models
---------
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>
* implement MacOS openFile/openFiles events
* wip: windows file association
* fix macro import
* add file icon copy
* try copy icon
* keep only required part of scripts
* update config schema
* fix json
* set fileAssociation for mac via config
* proper iconName handling
* add fileAssociation icon generator
* fix file association icons bundle
* don't break compatibility
* remove mimeType as not supported linux for now
* add documentation
* adjust config schema
* restore formatting
* try implement single instance lock with params passing
* fix focusing
* fix focusing
* formatting
* use channel buffer for second instance events
* handle errors
* add comment
* remove unused option in file association
* wip: linux single instance lock
* wip: linux single instance
* some experiments with making window active
* try to use unminimise
* remove unused
* try present for window
* try present for window
* fix build
* cleanup
* cleanup
* implement single instance lock on mac os
* implement proper show for windows
* proper unmimimise
* get rid of openFiles mac os. change configuration structure
* remove unused channel
* remove unused function
* add documentation for single instance lock
* add PR link
* wip mac os deeplinks
* put custom url listner on top to catch link on app opening
* put custom url listner on top to catch link on app opening
* try add custom url windows
* adjust custom url
* add docs
* merge master
* update documentation
* add comment for darwin
* add PR link
* change naming
* change naming
* change naming
* change naming
* fix formatting
* fix naming
* Fix typo
---------
Co-authored-by: Lea Anthony <lea.anthony@gmail.com>