Switch remote deploy to vendored source builds
Move remote deployment to a vendored source bundle built on the target host via Docker so redeploys no longer require local cross-compilation or host Go installation. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
11
vendor/github.com/wailsapp/wails/v2/pkg/runtime/browser.go
generated
vendored
Normal file
11
vendor/github.com/wailsapp/wails/v2/pkg/runtime/browser.go
generated
vendored
Normal file
@@ -0,0 +1,11 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
// BrowserOpenURL uses the system default browser to open the url
|
||||
func BrowserOpenURL(ctx context.Context, url string) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.BrowserOpenURL(url)
|
||||
}
|
||||
13
vendor/github.com/wailsapp/wails/v2/pkg/runtime/clipboard.go
generated
vendored
Normal file
13
vendor/github.com/wailsapp/wails/v2/pkg/runtime/clipboard.go
generated
vendored
Normal file
@@ -0,0 +1,13 @@
|
||||
package runtime
|
||||
|
||||
import "context"
|
||||
|
||||
func ClipboardGetText(ctx context.Context) (string, error) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
return appFrontend.ClipboardGetText()
|
||||
}
|
||||
|
||||
func ClipboardSetText(ctx context.Context, text string) error {
|
||||
appFrontend := getFrontend(ctx)
|
||||
return appFrontend.ClipboardSetText(text)
|
||||
}
|
||||
80
vendor/github.com/wailsapp/wails/v2/pkg/runtime/dialog.go
generated
vendored
Normal file
80
vendor/github.com/wailsapp/wails/v2/pkg/runtime/dialog.go
generated
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/wailsapp/wails/v2/internal/frontend"
|
||||
"github.com/wailsapp/wails/v2/internal/fs"
|
||||
)
|
||||
|
||||
// FileFilter defines a filter for dialog boxes
|
||||
type FileFilter = frontend.FileFilter
|
||||
|
||||
// OpenDialogOptions contains the options for the OpenDialogOptions runtime method
|
||||
type OpenDialogOptions = frontend.OpenDialogOptions
|
||||
|
||||
// SaveDialogOptions contains the options for the SaveDialog runtime method
|
||||
type SaveDialogOptions = frontend.SaveDialogOptions
|
||||
|
||||
type DialogType = frontend.DialogType
|
||||
|
||||
const (
|
||||
InfoDialog = frontend.InfoDialog
|
||||
WarningDialog = frontend.WarningDialog
|
||||
ErrorDialog = frontend.ErrorDialog
|
||||
QuestionDialog = frontend.QuestionDialog
|
||||
)
|
||||
|
||||
// MessageDialogOptions contains the options for the Message dialogs, EG Info, Warning, etc runtime methods
|
||||
type MessageDialogOptions = frontend.MessageDialogOptions
|
||||
|
||||
// OpenDirectoryDialog prompts the user to select a directory
|
||||
func OpenDirectoryDialog(ctx context.Context, dialogOptions OpenDialogOptions) (string, error) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
if dialogOptions.DefaultDirectory != "" {
|
||||
if !fs.DirExists(dialogOptions.DefaultDirectory) {
|
||||
return "", fmt.Errorf("default directory '%s' does not exist", dialogOptions.DefaultDirectory)
|
||||
}
|
||||
}
|
||||
return appFrontend.OpenDirectoryDialog(dialogOptions)
|
||||
}
|
||||
|
||||
// OpenFileDialog prompts the user to select a file
|
||||
func OpenFileDialog(ctx context.Context, dialogOptions OpenDialogOptions) (string, error) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
if dialogOptions.DefaultDirectory != "" {
|
||||
if !fs.DirExists(dialogOptions.DefaultDirectory) {
|
||||
return "", fmt.Errorf("default directory '%s' does not exist", dialogOptions.DefaultDirectory)
|
||||
}
|
||||
}
|
||||
return appFrontend.OpenFileDialog(dialogOptions)
|
||||
}
|
||||
|
||||
// OpenMultipleFilesDialog prompts the user to select a file
|
||||
func OpenMultipleFilesDialog(ctx context.Context, dialogOptions OpenDialogOptions) ([]string, error) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
if dialogOptions.DefaultDirectory != "" {
|
||||
if !fs.DirExists(dialogOptions.DefaultDirectory) {
|
||||
return nil, fmt.Errorf("default directory '%s' does not exist", dialogOptions.DefaultDirectory)
|
||||
}
|
||||
}
|
||||
return appFrontend.OpenMultipleFilesDialog(dialogOptions)
|
||||
}
|
||||
|
||||
// SaveFileDialog prompts the user to select a file
|
||||
func SaveFileDialog(ctx context.Context, dialogOptions SaveDialogOptions) (string, error) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
if dialogOptions.DefaultDirectory != "" {
|
||||
if !fs.DirExists(dialogOptions.DefaultDirectory) {
|
||||
return "", fmt.Errorf("default directory '%s' does not exist", dialogOptions.DefaultDirectory)
|
||||
}
|
||||
}
|
||||
return appFrontend.SaveFileDialog(dialogOptions)
|
||||
}
|
||||
|
||||
// MessageDialog show a message dialog to the user
|
||||
func MessageDialog(ctx context.Context, dialogOptions MessageDialogOptions) (string, error) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
return appFrontend.MessageDialog(dialogOptions)
|
||||
}
|
||||
37
vendor/github.com/wailsapp/wails/v2/pkg/runtime/draganddrop.go
generated
vendored
Normal file
37
vendor/github.com/wailsapp/wails/v2/pkg/runtime/draganddrop.go
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// OnFileDrop returns a slice of file path strings when a drop is finished.
|
||||
func OnFileDrop(ctx context.Context, callback func(x, y int, paths []string)) {
|
||||
if callback == nil {
|
||||
LogError(ctx, "OnFileDrop called with a nil callback")
|
||||
return
|
||||
}
|
||||
EventsOn(ctx, "wails:file-drop", func(optionalData ...interface{}) {
|
||||
if len(optionalData) != 3 {
|
||||
callback(0, 0, nil)
|
||||
}
|
||||
x, ok := optionalData[0].(int)
|
||||
if !ok {
|
||||
LogError(ctx, fmt.Sprintf("invalid x coordinate in drag and drop: %v", optionalData[0]))
|
||||
}
|
||||
y, ok := optionalData[1].(int)
|
||||
if !ok {
|
||||
LogError(ctx, fmt.Sprintf("invalid y coordinate in drag and drop: %v", optionalData[1]))
|
||||
}
|
||||
paths, ok := optionalData[2].([]string)
|
||||
if !ok {
|
||||
LogError(ctx, fmt.Sprintf("invalid path data in drag and drop: %v", optionalData[2]))
|
||||
}
|
||||
callback(x, y, paths)
|
||||
})
|
||||
}
|
||||
|
||||
// OnFileDropOff removes the drag and drop listeners and handlers.
|
||||
func OnFileDropOff(ctx context.Context) {
|
||||
EventsOff(ctx, "wails:file-drop")
|
||||
}
|
||||
49
vendor/github.com/wailsapp/wails/v2/pkg/runtime/events.go
generated
vendored
Normal file
49
vendor/github.com/wailsapp/wails/v2/pkg/runtime/events.go
generated
vendored
Normal file
@@ -0,0 +1,49 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"context"
|
||||
)
|
||||
|
||||
// EventsOn registers a listener for the given event name. It returns a function to cancel the listener
|
||||
func EventsOn(ctx context.Context, eventName string, callback func(optionalData ...interface{})) func() {
|
||||
events := getEvents(ctx)
|
||||
return events.On(eventName, callback)
|
||||
}
|
||||
|
||||
// EventsOff unregisters a listener for the given event name, optionally multiple listeners can be unregistered via `additionalEventNames`
|
||||
func EventsOff(ctx context.Context, eventName string, additionalEventNames ...string) {
|
||||
events := getEvents(ctx)
|
||||
events.Off(eventName)
|
||||
|
||||
if len(additionalEventNames) > 0 {
|
||||
for _, eventName := range additionalEventNames {
|
||||
events.Off(eventName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EventsOff unregisters a listener for the given event name, optionally multiple listeners can be unregistered via `additionalEventNames`
|
||||
func EventsOffAll(ctx context.Context) {
|
||||
events := getEvents(ctx)
|
||||
events.OffAll()
|
||||
}
|
||||
|
||||
// EventsOnce registers a listener for the given event name. After the first callback, the
|
||||
// listener is deleted. It returns a function to cancel the listener
|
||||
func EventsOnce(ctx context.Context, eventName string, callback func(optionalData ...interface{})) func() {
|
||||
events := getEvents(ctx)
|
||||
return events.Once(eventName, callback)
|
||||
}
|
||||
|
||||
// EventsOnMultiple registers a listener for the given event name, that may be called a maximum of 'counter' times. It returns a function
|
||||
// to cancel the listener
|
||||
func EventsOnMultiple(ctx context.Context, eventName string, callback func(optionalData ...interface{}), counter int) func() {
|
||||
events := getEvents(ctx)
|
||||
return events.OnMultiple(eventName, callback, counter)
|
||||
}
|
||||
|
||||
// EventsEmit pass through
|
||||
func EventsEmit(ctx context.Context, eventName string, optionalData ...interface{}) {
|
||||
events := getEvents(ctx)
|
||||
events.Emit(eventName, optionalData...)
|
||||
}
|
||||
105
vendor/github.com/wailsapp/wails/v2/pkg/runtime/log.go
generated
vendored
Normal file
105
vendor/github.com/wailsapp/wails/v2/pkg/runtime/log.go
generated
vendored
Normal file
@@ -0,0 +1,105 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"github.com/wailsapp/wails/v2/pkg/logger"
|
||||
)
|
||||
|
||||
// LogPrint prints a Print level message
|
||||
func LogPrint(ctx context.Context, message string) {
|
||||
myLogger := getLogger(ctx)
|
||||
myLogger.Print(message)
|
||||
}
|
||||
|
||||
// LogTrace prints a Trace level message
|
||||
func LogTrace(ctx context.Context, message string) {
|
||||
myLogger := getLogger(ctx)
|
||||
myLogger.Trace(message)
|
||||
}
|
||||
|
||||
// LogDebug prints a Debug level message
|
||||
func LogDebug(ctx context.Context, message string) {
|
||||
myLogger := getLogger(ctx)
|
||||
myLogger.Debug(message)
|
||||
}
|
||||
|
||||
// LogInfo prints a Info level message
|
||||
func LogInfo(ctx context.Context, message string) {
|
||||
myLogger := getLogger(ctx)
|
||||
myLogger.Info(message)
|
||||
}
|
||||
|
||||
// LogWarning prints a Warning level message
|
||||
func LogWarning(ctx context.Context, message string) {
|
||||
myLogger := getLogger(ctx)
|
||||
myLogger.Warning(message)
|
||||
}
|
||||
|
||||
// LogError prints a Error level message
|
||||
func LogError(ctx context.Context, message string) {
|
||||
myLogger := getLogger(ctx)
|
||||
myLogger.Error(message)
|
||||
}
|
||||
|
||||
// LogFatal prints a Fatal level message
|
||||
func LogFatal(ctx context.Context, message string) {
|
||||
myLogger := getLogger(ctx)
|
||||
myLogger.Fatal(message)
|
||||
}
|
||||
|
||||
// LogPrintf prints a Print level message
|
||||
func LogPrintf(ctx context.Context, format string, args ...interface{}) {
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
myLogger := getLogger(ctx)
|
||||
myLogger.Print(msg)
|
||||
}
|
||||
|
||||
// LogTracef prints a Trace level message
|
||||
func LogTracef(ctx context.Context, format string, args ...interface{}) {
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
myLogger := getLogger(ctx)
|
||||
myLogger.Trace(msg)
|
||||
}
|
||||
|
||||
// LogDebugf prints a Debug level message
|
||||
func LogDebugf(ctx context.Context, format string, args ...interface{}) {
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
myLogger := getLogger(ctx)
|
||||
myLogger.Debug(msg)
|
||||
}
|
||||
|
||||
// LogInfof prints a Info level message
|
||||
func LogInfof(ctx context.Context, format string, args ...interface{}) {
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
myLogger := getLogger(ctx)
|
||||
myLogger.Info(msg)
|
||||
}
|
||||
|
||||
// LogWarningf prints a Warning level message
|
||||
func LogWarningf(ctx context.Context, format string, args ...interface{}) {
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
myLogger := getLogger(ctx)
|
||||
myLogger.Warning(msg)
|
||||
}
|
||||
|
||||
// LogErrorf prints a Error level message
|
||||
func LogErrorf(ctx context.Context, format string, args ...interface{}) {
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
myLogger := getLogger(ctx)
|
||||
myLogger.Error(msg)
|
||||
}
|
||||
|
||||
// LogFatalf prints a Fatal level message
|
||||
func LogFatalf(ctx context.Context, format string, args ...interface{}) {
|
||||
msg := fmt.Sprintf(format, args...)
|
||||
myLogger := getLogger(ctx)
|
||||
myLogger.Fatal(msg)
|
||||
}
|
||||
|
||||
// LogSetLogLevel sets the log level
|
||||
func LogSetLogLevel(ctx context.Context, level logger.LogLevel) {
|
||||
myLogger := getLogger(ctx)
|
||||
myLogger.SetLogLevel(level)
|
||||
}
|
||||
17
vendor/github.com/wailsapp/wails/v2/pkg/runtime/menu.go
generated
vendored
Normal file
17
vendor/github.com/wailsapp/wails/v2/pkg/runtime/menu.go
generated
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/wailsapp/wails/v2/pkg/menu"
|
||||
)
|
||||
|
||||
func MenuSetApplicationMenu(ctx context.Context, menu *menu.Menu) {
|
||||
frontend := getFrontend(ctx)
|
||||
frontend.MenuSetApplicationMenu(menu)
|
||||
}
|
||||
|
||||
func MenuUpdateApplicationMenu(ctx context.Context) {
|
||||
frontend := getFrontend(ctx)
|
||||
frontend.MenuUpdateApplicationMenu()
|
||||
}
|
||||
136
vendor/github.com/wailsapp/wails/v2/pkg/runtime/notifications.go
generated
vendored
Normal file
136
vendor/github.com/wailsapp/wails/v2/pkg/runtime/notifications.go
generated
vendored
Normal file
@@ -0,0 +1,136 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/wailsapp/wails/v2/internal/frontend"
|
||||
)
|
||||
|
||||
// NotificationOptions contains configuration for a notification.
|
||||
type NotificationOptions = frontend.NotificationOptions
|
||||
|
||||
// NotificationAction represents an action button for a notification.
|
||||
type NotificationAction = frontend.NotificationAction
|
||||
|
||||
// NotificationCategory groups actions for notifications.
|
||||
type NotificationCategory = frontend.NotificationCategory
|
||||
|
||||
// NotificationResponse represents the response sent by interacting with a notification.
|
||||
type NotificationResponse = frontend.NotificationResponse
|
||||
|
||||
// NotificationResult represents the result of a notification response,
|
||||
// returning the response or any errors that occurred.
|
||||
type NotificationResult = frontend.NotificationResult
|
||||
|
||||
// InitializeNotifications initializes the notification service for the application.
|
||||
// This must be called before sending any notifications. On macOS, this also ensures
|
||||
// the notification delegate is properly initialized.
|
||||
func InitializeNotifications(ctx context.Context) error {
|
||||
fe := getFrontend(ctx)
|
||||
return fe.InitializeNotifications()
|
||||
}
|
||||
|
||||
// CleanupNotifications cleans up notification resources and releases any held connections.
|
||||
// This should be called when shutting down the application to properly release resources
|
||||
// (primarily needed on Linux to close D-Bus connections).
|
||||
func CleanupNotifications(ctx context.Context) {
|
||||
fe := getFrontend(ctx)
|
||||
fe.CleanupNotifications()
|
||||
}
|
||||
|
||||
// IsNotificationAvailable checks if notifications are available on the current platform.
|
||||
func IsNotificationAvailable(ctx context.Context) bool {
|
||||
fe := getFrontend(ctx)
|
||||
return fe.IsNotificationAvailable()
|
||||
}
|
||||
|
||||
// RequestNotificationAuthorization requests notification authorization from the user.
|
||||
// On macOS, this prompts the user to allow notifications. On other platforms, this
|
||||
// always returns true. Returns true if authorization was granted, false otherwise.
|
||||
func RequestNotificationAuthorization(ctx context.Context) (bool, error) {
|
||||
fe := getFrontend(ctx)
|
||||
return fe.RequestNotificationAuthorization()
|
||||
}
|
||||
|
||||
// CheckNotificationAuthorization checks the current notification authorization status.
|
||||
// On macOS, this checks if the app has notification permissions. On other platforms,
|
||||
// this always returns true.
|
||||
func CheckNotificationAuthorization(ctx context.Context) (bool, error) {
|
||||
fe := getFrontend(ctx)
|
||||
return fe.CheckNotificationAuthorization()
|
||||
}
|
||||
|
||||
// SendNotification sends a basic notification with the given options.
|
||||
// The notification will display with the provided title, subtitle (if supported),
|
||||
// and body text.
|
||||
func SendNotification(ctx context.Context, options NotificationOptions) error {
|
||||
fe := getFrontend(ctx)
|
||||
return fe.SendNotification(options)
|
||||
}
|
||||
|
||||
// SendNotificationWithActions sends a notification with action buttons.
|
||||
// A NotificationCategory must be registered first using RegisterNotificationCategory.
|
||||
// The options.CategoryID must match a previously registered category ID.
|
||||
// If the category is not found, a basic notification will be sent instead.
|
||||
func SendNotificationWithActions(ctx context.Context, options NotificationOptions) error {
|
||||
fe := getFrontend(ctx)
|
||||
return fe.SendNotificationWithActions(options)
|
||||
}
|
||||
|
||||
// RegisterNotificationCategory registers a notification category that can be used
|
||||
// with SendNotificationWithActions. Categories define the action buttons and optional
|
||||
// reply fields that will appear on notifications.
|
||||
func RegisterNotificationCategory(ctx context.Context, category NotificationCategory) error {
|
||||
fe := getFrontend(ctx)
|
||||
return fe.RegisterNotificationCategory(category)
|
||||
}
|
||||
|
||||
// RemoveNotificationCategory removes a previously registered notification category.
|
||||
func RemoveNotificationCategory(ctx context.Context, categoryId string) error {
|
||||
fe := getFrontend(ctx)
|
||||
return fe.RemoveNotificationCategory(categoryId)
|
||||
}
|
||||
|
||||
// RemoveAllPendingNotifications removes all pending notifications from the notification center.
|
||||
// On Windows, this is a no-op as the platform manages notification lifecycle automatically.
|
||||
func RemoveAllPendingNotifications(ctx context.Context) error {
|
||||
fe := getFrontend(ctx)
|
||||
return fe.RemoveAllPendingNotifications()
|
||||
}
|
||||
|
||||
// RemovePendingNotification removes a specific pending notification by its identifier.
|
||||
// On Windows, this is a no-op as the platform manages notification lifecycle automatically.
|
||||
func RemovePendingNotification(ctx context.Context, identifier string) error {
|
||||
fe := getFrontend(ctx)
|
||||
return fe.RemovePendingNotification(identifier)
|
||||
}
|
||||
|
||||
// RemoveAllDeliveredNotifications removes all delivered notifications from the notification center.
|
||||
// On Windows, this is a no-op as the platform manages notification lifecycle automatically.
|
||||
func RemoveAllDeliveredNotifications(ctx context.Context) error {
|
||||
fe := getFrontend(ctx)
|
||||
return fe.RemoveAllDeliveredNotifications()
|
||||
}
|
||||
|
||||
// RemoveDeliveredNotification removes a specific delivered notification by its identifier.
|
||||
// On Windows, this is a no-op as the platform manages notification lifecycle automatically.
|
||||
func RemoveDeliveredNotification(ctx context.Context, identifier string) error {
|
||||
fe := getFrontend(ctx)
|
||||
return fe.RemoveDeliveredNotification(identifier)
|
||||
}
|
||||
|
||||
// RemoveNotification removes a notification by its identifier.
|
||||
// This is a convenience function that works across platforms. On macOS, use the
|
||||
// more specific RemovePendingNotification or RemoveDeliveredNotification functions.
|
||||
func RemoveNotification(ctx context.Context, identifier string) error {
|
||||
fe := getFrontend(ctx)
|
||||
return fe.RemoveNotification(identifier)
|
||||
}
|
||||
|
||||
// OnNotificationResponse registers a callback function that will be invoked when
|
||||
// a user interacts with a notification (e.g., clicks an action button or the notification itself).
|
||||
// The callback receives a NotificationResult containing the response details or any errors.
|
||||
func OnNotificationResponse(ctx context.Context, callback func(result NotificationResult)) {
|
||||
fe := getFrontend(ctx)
|
||||
fe.OnNotificationResponse(callback)
|
||||
}
|
||||
107
vendor/github.com/wailsapp/wails/v2/pkg/runtime/runtime.go
generated
vendored
Normal file
107
vendor/github.com/wailsapp/wails/v2/pkg/runtime/runtime.go
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"context"
|
||||
"log"
|
||||
goruntime "runtime"
|
||||
|
||||
"github.com/wailsapp/wails/v2/internal/frontend"
|
||||
"github.com/wailsapp/wails/v2/internal/logger"
|
||||
)
|
||||
|
||||
const contextError = `An invalid context was passed. This method requires the specific context given in the lifecycle hooks:
|
||||
https://wails.io/docs/reference/runtime/intro`
|
||||
|
||||
func getFrontend(ctx context.Context) frontend.Frontend {
|
||||
if ctx == nil {
|
||||
pc, _, _, _ := goruntime.Caller(1)
|
||||
funcName := goruntime.FuncForPC(pc).Name()
|
||||
log.Fatalf("cannot call '%s': %s", funcName, contextError)
|
||||
}
|
||||
result := ctx.Value("frontend")
|
||||
if result != nil {
|
||||
return result.(frontend.Frontend)
|
||||
}
|
||||
pc, _, _, _ := goruntime.Caller(1)
|
||||
funcName := goruntime.FuncForPC(pc).Name()
|
||||
log.Fatalf("cannot call '%s': %s", funcName, contextError)
|
||||
return nil
|
||||
}
|
||||
|
||||
func getLogger(ctx context.Context) *logger.Logger {
|
||||
if ctx == nil {
|
||||
pc, _, _, _ := goruntime.Caller(1)
|
||||
funcName := goruntime.FuncForPC(pc).Name()
|
||||
log.Fatalf("cannot call '%s': %s", funcName, contextError)
|
||||
}
|
||||
result := ctx.Value("logger")
|
||||
if result != nil {
|
||||
return result.(*logger.Logger)
|
||||
}
|
||||
pc, _, _, _ := goruntime.Caller(1)
|
||||
funcName := goruntime.FuncForPC(pc).Name()
|
||||
log.Fatalf("cannot call '%s': %s", funcName, contextError)
|
||||
return nil
|
||||
}
|
||||
|
||||
func getEvents(ctx context.Context) frontend.Events {
|
||||
if ctx == nil {
|
||||
pc, _, _, _ := goruntime.Caller(1)
|
||||
funcName := goruntime.FuncForPC(pc).Name()
|
||||
log.Fatalf("cannot call '%s': %s", funcName, contextError)
|
||||
}
|
||||
result := ctx.Value("events")
|
||||
if result != nil {
|
||||
return result.(frontend.Events)
|
||||
}
|
||||
pc, _, _, _ := goruntime.Caller(1)
|
||||
funcName := goruntime.FuncForPC(pc).Name()
|
||||
log.Fatalf("cannot call '%s': %s", funcName, contextError)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Quit the application
|
||||
func Quit(ctx context.Context) {
|
||||
if ctx == nil {
|
||||
log.Fatalf("Error calling 'runtime.Quit': %s", contextError)
|
||||
}
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.Quit()
|
||||
}
|
||||
|
||||
// Hide the application
|
||||
func Hide(ctx context.Context) {
|
||||
if ctx == nil {
|
||||
log.Fatalf("Error calling 'runtime.Hide': %s", contextError)
|
||||
}
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.Hide()
|
||||
}
|
||||
|
||||
// Show the application if it is hidden
|
||||
func Show(ctx context.Context) {
|
||||
if ctx == nil {
|
||||
log.Fatalf("Error calling 'runtime.Show': %s", contextError)
|
||||
}
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.Show()
|
||||
}
|
||||
|
||||
// EnvironmentInfo contains information about the environment
|
||||
type EnvironmentInfo struct {
|
||||
BuildType string `json:"buildType"`
|
||||
Platform string `json:"platform"`
|
||||
Arch string `json:"arch"`
|
||||
}
|
||||
|
||||
// Environment returns information about the environment
|
||||
func Environment(ctx context.Context) EnvironmentInfo {
|
||||
var result EnvironmentInfo
|
||||
buildType := ctx.Value("buildtype")
|
||||
if buildType != nil {
|
||||
result.BuildType = buildType.(string)
|
||||
}
|
||||
result.Platform = goruntime.GOOS
|
||||
result.Arch = goruntime.GOARCH
|
||||
return result
|
||||
}
|
||||
15
vendor/github.com/wailsapp/wails/v2/pkg/runtime/screen.go
generated
vendored
Normal file
15
vendor/github.com/wailsapp/wails/v2/pkg/runtime/screen.go
generated
vendored
Normal file
@@ -0,0 +1,15 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/wailsapp/wails/v2/internal/frontend"
|
||||
)
|
||||
|
||||
type Screen = frontend.Screen
|
||||
|
||||
// ScreenGetAll returns all screens
|
||||
func ScreenGetAll(ctx context.Context) ([]Screen, error) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
return appFrontend.ScreenGetAll()
|
||||
}
|
||||
65
vendor/github.com/wailsapp/wails/v2/pkg/runtime/signal_linux.go
generated
vendored
Normal file
65
vendor/github.com/wailsapp/wails/v2/pkg/runtime/signal_linux.go
generated
vendored
Normal file
@@ -0,0 +1,65 @@
|
||||
//go:build linux
|
||||
|
||||
package runtime
|
||||
|
||||
/*
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
static void fix_signal(int signum)
|
||||
{
|
||||
struct sigaction st;
|
||||
|
||||
if (sigaction(signum, NULL, &st) < 0) {
|
||||
return;
|
||||
}
|
||||
st.sa_flags |= SA_ONSTACK;
|
||||
sigaction(signum, &st, NULL);
|
||||
}
|
||||
|
||||
static void fix_all_signals()
|
||||
{
|
||||
#if defined(SIGSEGV)
|
||||
fix_signal(SIGSEGV);
|
||||
#endif
|
||||
#if defined(SIGBUS)
|
||||
fix_signal(SIGBUS);
|
||||
#endif
|
||||
#if defined(SIGFPE)
|
||||
fix_signal(SIGFPE);
|
||||
#endif
|
||||
#if defined(SIGABRT)
|
||||
fix_signal(SIGABRT);
|
||||
#endif
|
||||
}
|
||||
*/
|
||||
import "C"
|
||||
|
||||
// ResetSignalHandlers resets signal handlers to allow panic recovery.
|
||||
//
|
||||
// On Linux, WebKit (used for the webview) may install signal handlers without
|
||||
// the SA_ONSTACK flag, which prevents Go from properly recovering from panics
|
||||
// caused by nil pointer dereferences or other memory access violations.
|
||||
//
|
||||
// Call this function immediately before code that might panic to ensure
|
||||
// the signal handlers are properly configured for Go's panic recovery mechanism.
|
||||
//
|
||||
// Example usage:
|
||||
//
|
||||
// go func() {
|
||||
// defer func() {
|
||||
// if err := recover(); err != nil {
|
||||
// log.Printf("Recovered from panic: %v", err)
|
||||
// }
|
||||
// }()
|
||||
// runtime.ResetSignalHandlers()
|
||||
// // Code that might panic...
|
||||
// }()
|
||||
//
|
||||
// Note: This function only has an effect on Linux. On other platforms,
|
||||
// it is a no-op.
|
||||
func ResetSignalHandlers() {
|
||||
C.fix_all_signals()
|
||||
}
|
||||
18
vendor/github.com/wailsapp/wails/v2/pkg/runtime/signal_other.go
generated
vendored
Normal file
18
vendor/github.com/wailsapp/wails/v2/pkg/runtime/signal_other.go
generated
vendored
Normal file
@@ -0,0 +1,18 @@
|
||||
//go:build !linux
|
||||
|
||||
package runtime
|
||||
|
||||
// ResetSignalHandlers resets signal handlers to allow panic recovery.
|
||||
//
|
||||
// On Linux, WebKit (used for the webview) may install signal handlers without
|
||||
// the SA_ONSTACK flag, which prevents Go from properly recovering from panics
|
||||
// caused by nil pointer dereferences or other memory access violations.
|
||||
//
|
||||
// Call this function immediately before code that might panic to ensure
|
||||
// the signal handlers are properly configured for Go's panic recovery mechanism.
|
||||
//
|
||||
// Note: This function only has an effect on Linux. On other platforms,
|
||||
// it is a no-op.
|
||||
func ResetSignalHandlers() {
|
||||
// No-op on non-Linux platforms
|
||||
}
|
||||
186
vendor/github.com/wailsapp/wails/v2/pkg/runtime/window.go
generated
vendored
Normal file
186
vendor/github.com/wailsapp/wails/v2/pkg/runtime/window.go
generated
vendored
Normal file
@@ -0,0 +1,186 @@
|
||||
package runtime
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
)
|
||||
|
||||
// WindowSetTitle sets the title of the window
|
||||
func WindowSetTitle(ctx context.Context, title string) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowSetTitle(title)
|
||||
}
|
||||
|
||||
// WindowFullscreen makes the window fullscreen
|
||||
func WindowFullscreen(ctx context.Context) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowFullscreen()
|
||||
}
|
||||
|
||||
// WindowUnfullscreen makes the window UnFullscreen
|
||||
func WindowUnfullscreen(ctx context.Context) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowUnfullscreen()
|
||||
}
|
||||
|
||||
// WindowCenter the window on the current screen
|
||||
func WindowCenter(ctx context.Context) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowCenter()
|
||||
}
|
||||
|
||||
// WindowReload will reload the window contents
|
||||
func WindowReload(ctx context.Context) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowReload()
|
||||
}
|
||||
|
||||
// WindowReloadApp will reload the application
|
||||
func WindowReloadApp(ctx context.Context) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowReloadApp()
|
||||
}
|
||||
|
||||
func WindowSetSystemDefaultTheme(ctx context.Context) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowSetSystemDefaultTheme()
|
||||
}
|
||||
|
||||
func WindowSetLightTheme(ctx context.Context) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowSetLightTheme()
|
||||
}
|
||||
|
||||
func WindowSetDarkTheme(ctx context.Context) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowSetDarkTheme()
|
||||
}
|
||||
|
||||
// WindowShow shows the window if hidden
|
||||
func WindowShow(ctx context.Context) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowShow()
|
||||
}
|
||||
|
||||
// WindowHide the window
|
||||
func WindowHide(ctx context.Context) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowHide()
|
||||
}
|
||||
|
||||
// WindowSetSize sets the size of the window
|
||||
func WindowSetSize(ctx context.Context, width int, height int) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowSetSize(width, height)
|
||||
}
|
||||
|
||||
func WindowGetSize(ctx context.Context) (int, int) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
return appFrontend.WindowGetSize()
|
||||
}
|
||||
|
||||
// WindowSetMinSize sets the minimum size of the window
|
||||
func WindowSetMinSize(ctx context.Context, width int, height int) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowSetMinSize(width, height)
|
||||
}
|
||||
|
||||
// WindowSetMaxSize sets the maximum size of the window
|
||||
func WindowSetMaxSize(ctx context.Context, width int, height int) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowSetMaxSize(width, height)
|
||||
}
|
||||
|
||||
// WindowSetAlwaysOnTop sets the window AlwaysOnTop or not on top
|
||||
func WindowSetAlwaysOnTop(ctx context.Context, b bool) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowSetAlwaysOnTop(b)
|
||||
}
|
||||
|
||||
// WindowSetPosition sets the position of the window
|
||||
func WindowSetPosition(ctx context.Context, x int, y int) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowSetPosition(x, y)
|
||||
}
|
||||
|
||||
func WindowGetPosition(ctx context.Context) (int, int) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
return appFrontend.WindowGetPosition()
|
||||
}
|
||||
|
||||
// WindowMaximise the window
|
||||
func WindowMaximise(ctx context.Context) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowMaximise()
|
||||
}
|
||||
|
||||
// WindowToggleMaximise the window
|
||||
func WindowToggleMaximise(ctx context.Context) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowToggleMaximise()
|
||||
}
|
||||
|
||||
// WindowUnmaximise the window
|
||||
func WindowUnmaximise(ctx context.Context) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowUnmaximise()
|
||||
}
|
||||
|
||||
// WindowMinimise the window
|
||||
func WindowMinimise(ctx context.Context) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowMinimise()
|
||||
}
|
||||
|
||||
// WindowUnminimise the window
|
||||
func WindowUnminimise(ctx context.Context) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowUnminimise()
|
||||
}
|
||||
|
||||
// WindowIsFullscreen get the window state is window Fullscreen
|
||||
func WindowIsFullscreen(ctx context.Context) bool {
|
||||
appFrontend := getFrontend(ctx)
|
||||
return appFrontend.WindowIsFullscreen()
|
||||
}
|
||||
|
||||
// WindowIsMaximised get the window state is window Maximised
|
||||
func WindowIsMaximised(ctx context.Context) bool {
|
||||
appFrontend := getFrontend(ctx)
|
||||
return appFrontend.WindowIsMaximised()
|
||||
}
|
||||
|
||||
// WindowIsMinimised get the window state is window Minimised
|
||||
func WindowIsMinimised(ctx context.Context) bool {
|
||||
appFrontend := getFrontend(ctx)
|
||||
return appFrontend.WindowIsMinimised()
|
||||
}
|
||||
|
||||
// WindowIsNormal get the window state is window Normal
|
||||
func WindowIsNormal(ctx context.Context) bool {
|
||||
appFrontend := getFrontend(ctx)
|
||||
return appFrontend.WindowIsNormal()
|
||||
}
|
||||
|
||||
// WindowExecJS executes the given Js in the window
|
||||
func WindowExecJS(ctx context.Context, js string) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.ExecJS(js)
|
||||
}
|
||||
|
||||
func WindowSetBackgroundColour(ctx context.Context, R, G, B, A uint8) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
col := &options.RGBA{
|
||||
R: R,
|
||||
G: G,
|
||||
B: B,
|
||||
A: A,
|
||||
}
|
||||
appFrontend.WindowSetBackgroundColour(col)
|
||||
}
|
||||
|
||||
func WindowPrint(ctx context.Context) {
|
||||
appFrontend := getFrontend(ctx)
|
||||
appFrontend.WindowPrint()
|
||||
}
|
||||
Reference in New Issue
Block a user