mirror of https://github.com/jetkvm/kvm.git
Compare commits
3 Commits
8eee6e5499
...
292c98981a
Author | SHA1 | Date |
---|---|---|
|
292c98981a | |
|
584768bacf | |
|
05cc4a1fab |
|
@ -46,7 +46,7 @@ export default function SettingsKeyboardRoute() {
|
||||||
if ("error" in resp) return;
|
if ("error" in resp) return;
|
||||||
setKeyboardLayout(resp.result as string);
|
setKeyboardLayout(resp.result as string);
|
||||||
});
|
});
|
||||||
}, []); // eslint-disable-line react-hooks/exhaustive-deps
|
}, [send, setKeyboardLayout]);
|
||||||
|
|
||||||
const onKeyboardLayoutChange = useCallback(
|
const onKeyboardLayoutChange = useCallback(
|
||||||
(e: React.ChangeEvent<HTMLSelectElement>) => {
|
(e: React.ChangeEvent<HTMLSelectElement>) => {
|
||||||
|
|
|
@ -151,7 +151,6 @@ export default function SettingsRoute() {
|
||||||
className={({ isActive }) => (isActive ? "active" : "")}
|
className={({ isActive }) => (isActive ? "active" : "")}
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-x-2 rounded-md px-2.5 py-2.5 text-sm transition-colors hover:bg-slate-100 dark:hover:bg-slate-700 in-[.active]:bg-blue-50 in-[.active]:text-blue-700! md:in-[.active]:bg-transparent dark:in-[.active]:bg-blue-900 dark:in-[.active]:text-blue-200! dark:md:in-[.active]:bg-transparent">
|
<div className="flex items-center gap-x-2 rounded-md px-2.5 py-2.5 text-sm transition-colors hover:bg-slate-100 dark:hover:bg-slate-700 in-[.active]:bg-blue-50 in-[.active]:text-blue-700! md:in-[.active]:bg-transparent dark:in-[.active]:bg-blue-900 dark:in-[.active]:text-blue-200! dark:md:in-[.active]:bg-transparent">
|
||||||
|
|
||||||
<LuMouse className="h-4 w-4 shrink-0" />
|
<LuMouse className="h-4 w-4 shrink-0" />
|
||||||
<h1>Mouse</h1>
|
<h1>Mouse</h1>
|
||||||
</div>
|
</div>
|
||||||
|
@ -163,7 +162,7 @@ export default function SettingsRoute() {
|
||||||
to="keyboard"
|
to="keyboard"
|
||||||
className={({ isActive }) => (isActive ? "active" : "")}
|
className={({ isActive }) => (isActive ? "active" : "")}
|
||||||
>
|
>
|
||||||
<div className="flex items-center gap-x-2 rounded-md px-2.5 py-2.5 text-sm transition-colors hover:bg-slate-100 dark:hover:bg-slate-700 [.active_&]:bg-blue-50 [.active_&]:!text-blue-700 md:[.active_&]:bg-transparent dark:[.active_&]:bg-blue-900 dark:[.active_&]:!text-blue-200 dark:md:[.active_&]:bg-transparent">
|
<div className="flex items-center gap-x-2 rounded-md px-2.5 py-2.5 text-sm transition-colors hover:bg-slate-100 dark:hover:bg-slate-700 in-[.active]:bg-blue-50 in-[.active]:text-blue-700! md:in-[.active]:bg-transparent dark:in-[.active]:bg-blue-900 dark:in-[.active]:text-blue-200! dark:md:in-[.active]:bg-transparent">
|
||||||
<LuKeyboard className="h-4 w-4 shrink-0" />
|
<LuKeyboard className="h-4 w-4 shrink-0" />
|
||||||
<h1>Keyboard</h1>
|
<h1>Keyboard</h1>
|
||||||
</div>
|
</div>
|
||||||
|
|
18
web.go
18
web.go
|
@ -97,9 +97,6 @@ func setupRouter() *gin.Engine {
|
||||||
// We use this to determine if the device is setup
|
// We use this to determine if the device is setup
|
||||||
r.GET("/device/status", handleDeviceStatus)
|
r.GET("/device/status", handleDeviceStatus)
|
||||||
|
|
||||||
// We use this to provide the UI with the device configuration
|
|
||||||
r.GET("/device/ui-config.js", handleDeviceUIConfig)
|
|
||||||
|
|
||||||
// We use this to setup the device in the welcome page
|
// We use this to setup the device in the welcome page
|
||||||
r.POST("/device/setup", handleSetup)
|
r.POST("/device/setup", handleSetup)
|
||||||
|
|
||||||
|
@ -694,21 +691,6 @@ func handleCloudState(c *gin.Context) {
|
||||||
c.JSON(http.StatusOK, response)
|
c.JSON(http.StatusOK, response)
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleDeviceUIConfig(c *gin.Context) {
|
|
||||||
config, _ := json.Marshal(gin.H{
|
|
||||||
"CLOUD_API": config.CloudURL,
|
|
||||||
"DEVICE_VERSION": builtAppVersion,
|
|
||||||
})
|
|
||||||
if config == nil {
|
|
||||||
c.JSON(http.StatusInternalServerError, gin.H{"error": "Failed to marshal config"})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
response := fmt.Sprintf("window.JETKVM_CONFIG = %s;", config)
|
|
||||||
|
|
||||||
c.Data(http.StatusOK, "text/javascript; charset=utf-8", []byte(response))
|
|
||||||
}
|
|
||||||
|
|
||||||
func handleSetup(c *gin.Context) {
|
func handleSetup(c *gin.Context) {
|
||||||
// Check if the device is already set up
|
// Check if the device is already set up
|
||||||
if config.LocalAuthMode != "" || config.HashedPassword != "" {
|
if config.LocalAuthMode != "" || config.HashedPassword != "" {
|
||||||
|
|
Loading…
Reference in New Issue