mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 17:39:58 +08:00
[v2] Rename noautoinjectbindings -> noautoinjectipc
This commit is contained in:
parent
a59d01ddb9
commit
b15d98b555
@ -63,7 +63,7 @@ func (a *BrowserAssetServer) processIndexHTML() ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if wailsOptions.disableBindingsInjection == false {
|
||||
if wailsOptions.disableIPCInjection == false {
|
||||
indexHTML, err = injectHTML(string(indexHTML), `<script src="/wails/ipc.js"></script>`)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -125,7 +125,7 @@ func (a *DesktopAssetServer) processIndexHTML() ([]byte, error) {
|
||||
return nil, err
|
||||
}
|
||||
}
|
||||
if wailsOptions.disableBindingsInjection == false {
|
||||
if wailsOptions.disableIPCInjection == false {
|
||||
indexHTML, err = injectHTML(string(indexHTML), `<script src="/wails/ipc.js"></script>`)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -12,12 +12,12 @@ type optionType string
|
||||
const (
|
||||
noAutoInject optionType = "noautoinject"
|
||||
noAutoInjectRuntime optionType = "noautoinjectruntime"
|
||||
noAutoInjectBindings optionType = "noautoinjectbindings"
|
||||
noautoinjectipc optionType = "noautoinjectipc"
|
||||
)
|
||||
|
||||
type Options struct {
|
||||
disableRuntimeInjection bool
|
||||
disableBindingsInjection bool
|
||||
disableIPCInjection bool
|
||||
}
|
||||
|
||||
func newOptions(optionString string) *Options {
|
||||
@ -28,9 +28,9 @@ func newOptions(optionString string) *Options {
|
||||
switch optionType(strings.TrimSpace(option)) {
|
||||
case noAutoInject:
|
||||
result.disableRuntimeInjection = true
|
||||
result.disableBindingsInjection = true
|
||||
case noAutoInjectBindings:
|
||||
result.disableBindingsInjection = true
|
||||
result.disableIPCInjection = true
|
||||
case noautoinjectipc:
|
||||
result.disableIPCInjection = true
|
||||
case noAutoInjectRuntime:
|
||||
result.disableRuntimeInjection = true
|
||||
}
|
||||
|
@ -34,7 +34,7 @@ func genMeta(content string) []byte {
|
||||
func genOptions(runtime bool, bindings bool) *Options {
|
||||
return &Options{
|
||||
disableRuntimeInjection: runtime,
|
||||
disableBindingsInjection: bindings,
|
||||
disableIPCInjection: bindings,
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,11 +50,11 @@ func Test_extractOptions(t *testing.T) {
|
||||
{"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},
|
||||
{"noautoinjectipc", genMeta("noautoinjectipc"), 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},
|
||||
{"multiple", genMeta("noautoinjectruntime,noautoinjectipc"), genOptions(true, true), false},
|
||||
{"multiple spaces", genMeta(" noautoinjectruntime, noautoinjectipc "), genOptions(true, true), false},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
|
@ -44,7 +44,7 @@ The options are as follows:
|
||||
| Value | Description |
|
||||
| -------------------- | ------------------------------------------------- |
|
||||
| noautoinjectruntime | Disable the autoinjection of `/wails/runtime.js` |
|
||||
| noautoinjectbindings | Disable the autoinjection of `/wails/bindings.js` |
|
||||
| noautoinjectipc | Disable the autoinjection of `/wails/ipc.js` |
|
||||
| noautoinject | Disable all autoinjection of scripts |
|
||||
|
||||
Multiple options may be used provided they are comma seperated.
|
||||
|
Loading…
Reference in New Issue
Block a user