-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetting.advance.go
68 lines (54 loc) · 1.75 KB
/
setting.advance.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
package main
import (
"net/http"
autologin "imuslab.com/arozos/mod/auth/autologin"
prout "imuslab.com/arozos/mod/prouter"
"imuslab.com/arozos/mod/utils"
)
/*
Advance Setting Group
This is a function group that help handles system advance functions
*/
func AdvanceSettingInit() {
/*
Define common routers
*/
adminRouter := prout.NewModuleRouter(prout.RouterOption{
ModuleName: "System Settings",
AdminOnly: true,
UserHandler: userHandler,
DeniedHandler: func(w http.ResponseWriter, r *http.Request) {
utils.SendErrorResponse(w, "Permission Denied")
},
})
/*
Billboard mode / Bot login mode
This method allows users or machine to login with token instead of login interface
*/
registerSetting(settingModule{
Name: "Auto Login Mode",
Desc: "Allow bots logging into the system automatically",
IconPath: "SystemAO/advance/img/small_icon.png",
Group: "Advance",
StartDir: "SystemAO/advance/autologin.html",
RequireAdmin: true,
})
autoLoginHandler := autologin.NewAutoLoginHandler(userHandler)
adminRouter.HandleFunc("/system/autologin/list", autoLoginHandler.HandleUserTokensListing)
adminRouter.HandleFunc("/system/autologin/create", autoLoginHandler.HandleUserTokenCreation)
adminRouter.HandleFunc("/system/autologin/delete", autoLoginHandler.HandleUserTokenRemoval)
/*
Advance Disk Management Interface
This methods allow hot swapping / mounting of storage devices
*/
if *allow_hardware_management {
registerSetting(settingModule{
Name: "Disk Manager",
Desc: "Mount, Unmount and Formatting Local Disks",
IconPath: "SystemAO/disk/img/small_icon.png",
Group: "Advance",
StartDir: "SystemAO/disk/diskmg.html",
RequireAdmin: true,
})
}
}