mirror of
https://github.com/AynaLivePlayer/AynaLivePlayer.git
synced 2025-12-14 14:08:22 +08:00
add configure to prevent wshub event execution.
This commit is contained in:
@@ -1,14 +1,14 @@
|
|||||||
package xfyne
|
package xfyne
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fyne.io/fyne/v2"
|
|
||||||
"fyne.io/fyne/v2/widget"
|
"fyne.io/fyne/v2/widget"
|
||||||
"reflect"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func EntryDisableUndoRedo(entry *widget.Entry) *widget.Entry {
|
func EntryDisableUndoRedo(entry *widget.Entry) *widget.Entry {
|
||||||
val := reflect.ValueOf(entry).Elem().FieldByName("shortcut").Addr().UnsafePointer()
|
// do nothing because the bug has been fixed in fyne@v2.5.1
|
||||||
(*fyne.ShortcutHandler)(val).RemoveShortcut(&fyne.ShortcutRedo{})
|
|
||||||
(*fyne.ShortcutHandler)(val).RemoveShortcut(&fyne.ShortcutUndo{})
|
|
||||||
return entry
|
return entry
|
||||||
|
//val := reflect.ValueOf(entry).Elem().FieldByName("shortcut").Addr().UnsafePointer()
|
||||||
|
//(*fyne.ShortcutHandler)(val).RemoveShortcut(&fyne.ShortcutRedo{})
|
||||||
|
//(*fyne.ShortcutHandler)(val).RemoveShortcut(&fyne.ShortcutUndo{})
|
||||||
|
//return entry
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,7 +48,9 @@ func (c *wsClient) start() {
|
|||||||
global.Logger.Warn("unmarshal event data failed", err)
|
global.Logger.Warn("unmarshal event data failed", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
global.EventManager.CallA(data.EventID, actualEventData)
|
if globalEnableWsHubControl {
|
||||||
|
global.EventManager.CallA(data.EventID, actualEventData)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -20,25 +20,31 @@ import (
|
|||||||
|
|
||||||
type WsHub struct {
|
type WsHub struct {
|
||||||
config.BaseConfig
|
config.BaseConfig
|
||||||
Enabled bool
|
Enabled bool
|
||||||
Port int
|
Port int
|
||||||
LocalHostOnly bool
|
LocalHostOnly bool
|
||||||
panel fyne.CanvasObject
|
EnableWsHubControl bool
|
||||||
server *wsServer
|
panel fyne.CanvasObject
|
||||||
log logger.ILogger
|
server *wsServer
|
||||||
|
log logger.ILogger
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewWsHub() *WsHub {
|
func NewWsHub() *WsHub {
|
||||||
return &WsHub{
|
return &WsHub{
|
||||||
Enabled: false,
|
Enabled: false,
|
||||||
Port: 29629,
|
Port: 29629,
|
||||||
LocalHostOnly: true,
|
LocalHostOnly: true,
|
||||||
log: global.Logger.WithPrefix("plugin.wshub"),
|
EnableWsHubControl: false,
|
||||||
|
log: global.Logger.WithPrefix("plugin.wshub"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var globalEnableWsHubControl = false
|
||||||
|
|
||||||
func (w *WsHub) Enable() error {
|
func (w *WsHub) Enable() error {
|
||||||
config.LoadConfig(w)
|
config.LoadConfig(w)
|
||||||
|
// todo: should pass EnableWsHubControl to client instead of using global variable
|
||||||
|
globalEnableWsHubControl = w.EnableWsHubControl
|
||||||
w.server = newWsServer(&w.Port, &w.LocalHostOnly)
|
w.server = newWsServer(&w.Port, &w.LocalHostOnly)
|
||||||
gui.AddConfigLayout(w)
|
gui.AddConfigLayout(w)
|
||||||
w.registerEvents()
|
w.registerEvents()
|
||||||
|
|||||||
2
todo.txt
2
todo.txt
@@ -18,7 +18,7 @@
|
|||||||
----
|
----
|
||||||
|
|
||||||
Finished
|
Finished
|
||||||
- 2024.08.25 : 添加是否播放闲置歌单选项,修复退出时panic的问题
|
- 2024.08.25 : 添加是否播放闲置歌单选项,修复退出时panic的导致配置无法正确保存的问题
|
||||||
- 2024.08.14 : 网页输出模版上线
|
- 2024.08.14 : 网页输出模版上线
|
||||||
- 2024.08.06 : 修复使用身份码连接的时候房管无法切歌的问题
|
- 2024.08.06 : 修复使用身份码连接的时候房管无法切歌的问题
|
||||||
- 2024.07.25 : 或许修复配置无法正确保存的问题
|
- 2024.07.25 : 或许修复配置无法正确保存的问题
|
||||||
|
|||||||
Reference in New Issue
Block a user