tiny fixes
This commit is contained in:
@@ -42,6 +42,11 @@ func updateAdmin(username string, password string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func showAdmin() {
|
func showAdmin() {
|
||||||
|
err := database.InitDB(config.GetDBPath())
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
userService := service.UserService{}
|
userService := service.UserService{}
|
||||||
userModel, err := userService.GetFirstUser()
|
userModel, err := userService.GetFirstUser()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -67,6 +67,11 @@ func updateSetting(port int, path string, subPort int, subPath string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func showSetting() {
|
func showSetting() {
|
||||||
|
err := database.InitDB(config.GetDBPath())
|
||||||
|
if err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
return
|
||||||
|
}
|
||||||
settingService := service.SettingService{}
|
settingService := service.SettingService{}
|
||||||
allSetting, err := settingService.GetAllSetting()
|
allSetting, err := settingService.GetAllSetting()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -108,6 +108,10 @@ func (s *Server) initRouter() (*gin.Engine, error) {
|
|||||||
// Serve index.html as the entry point
|
// Serve index.html as the entry point
|
||||||
// Handle all other routes by serving index.html
|
// Handle all other routes by serving index.html
|
||||||
engine.NoRoute(func(c *gin.Context) {
|
engine.NoRoute(func(c *gin.Context) {
|
||||||
|
if c.Request.URL.Path == strings.TrimSuffix(base_url, "/") {
|
||||||
|
c.Redirect(http.StatusTemporaryRedirect, base_url)
|
||||||
|
return
|
||||||
|
}
|
||||||
if !strings.HasPrefix(c.Request.URL.Path, base_url) {
|
if !strings.HasPrefix(c.Request.URL.Path, base_url) {
|
||||||
c.String(404, "")
|
c.String(404, "")
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -185,19 +185,23 @@ view_admin() {
|
|||||||
|
|
||||||
reset_setting() {
|
reset_setting() {
|
||||||
confirm "Are you sure you want to reset settings to default ?" "n"
|
confirm "Are you sure you want to reset settings to default ?" "n"
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? == 0 ]]; then
|
||||||
/usr/local/s-ui/sui setting -reset
|
/usr/local/s-ui/sui setting -reset
|
||||||
fi
|
fi
|
||||||
before_show_menu
|
before_show_menu
|
||||||
}
|
}
|
||||||
|
|
||||||
set_setting() {
|
set_setting() {
|
||||||
read -p "Enter the ${yellow}panel port${plain} (leave blank for existing/default value):" config_port
|
echo -e "Enter the ${yellow}panel port${plain} (leave blank for existing/default value):"
|
||||||
read -p "Enter the ${yellow}panel path${plain} (leave blank for existing/default value):" config_path
|
read config_port
|
||||||
|
echo -e "Enter the ${yellow}panel path${plain} (leave blank for existing/default value):"
|
||||||
|
read config_path
|
||||||
|
|
||||||
# Sub configuration
|
# Sub configuration
|
||||||
read -p "Enter the ${yellow}subscription port${plain} (leave blank for existing/default value):" config_subPort
|
echo -e "Enter the ${yellow}subscription port${plain} (leave blank for existing/default value):"
|
||||||
read -p "Enter the ${yellow}subscription path${plain} (leave blank for existing/default value):" config_subPath
|
read config_subPort
|
||||||
|
echo -e "Enter the ${yellow}subscription path${plain} (leave blank for existing/default value):"
|
||||||
|
read config_subPath
|
||||||
|
|
||||||
# Set configs
|
# Set configs
|
||||||
echo -e "${yellow}Initializing, please wait...${plain}"
|
echo -e "${yellow}Initializing, please wait...${plain}"
|
||||||
|
|||||||
Reference in New Issue
Block a user