diff --git a/api/public/layout.go b/api/public/layout.go new file mode 100644 index 00000000..987be66c --- /dev/null +++ b/api/public/layout.go @@ -0,0 +1,14 @@ +package public + +import ( + "github.com/0xJacky/Nginx-UI/settings" + "github.com/gin-gonic/gin" + "net/http" +) + +func GetICPSettings(c *gin.Context) { + c.JSON(http.StatusOK, gin.H{ + "icp_number": settings.NodeSettings.ICPNumber, + "public_security_number": settings.NodeSettings.PublicSecurityNumber, + }) +} diff --git a/api/public/router.go b/api/public/router.go new file mode 100644 index 00000000..6a3ffbd3 --- /dev/null +++ b/api/public/router.go @@ -0,0 +1,7 @@ +package public + +import "github.com/gin-gonic/gin" + +func InitRouter(r *gin.RouterGroup) { + r.GET("/icp_settings", GetICPSettings) +} diff --git a/app/components.d.ts b/app/components.d.ts index 8438f2fa..644e4f40 100644 --- a/app/components.d.ts +++ b/app/components.d.ts @@ -76,6 +76,7 @@ declare module 'vue' { CodeEditorCodeEditor: typeof import('./src/components/CodeEditor/CodeEditor.vue')['default'] EnvIndicatorEnvIndicator: typeof import('./src/components/EnvIndicator/EnvIndicator.vue')['default'] FooterToolbarFooterToolBar: typeof import('./src/components/FooterToolbar/FooterToolBar.vue')['default'] + ICPICP: typeof import('./src/components/ICP/ICP.vue')['default'] LogoLogo: typeof import('./src/components/Logo/Logo.vue')['default'] NginxControlNginxControl: typeof import('./src/components/NginxControl/NginxControl.vue')['default'] NodeSelectorNodeSelector: typeof import('./src/components/NodeSelector/NodeSelector.vue')['default'] diff --git a/app/src/api/public.ts b/app/src/api/public.ts new file mode 100644 index 00000000..64c440e2 --- /dev/null +++ b/app/src/api/public.ts @@ -0,0 +1,14 @@ +import http from '@/lib/http' + +export interface ICP { + icp_number: string + public_security_number: string +} + +const publicApi = { + getICP() { + return http.get('/icp_settings') + }, +} + +export default publicApi diff --git a/app/src/api/settings.ts b/app/src/api/settings.ts index f3404eaa..424b9979 100644 --- a/app/src/api/settings.ts +++ b/app/src/api/settings.ts @@ -63,6 +63,8 @@ export interface NginxSettings { export interface NodeSettings { name: string secret: string + icp_number: string + public_security_number: number } export interface OpenaiSettings { diff --git a/app/src/components/ICP/ICP.vue b/app/src/components/ICP/ICP.vue new file mode 100644 index 00000000..67d49865 --- /dev/null +++ b/app/src/components/ICP/ICP.vue @@ -0,0 +1,50 @@ + + + + + diff --git a/app/src/views/other/Login.vue b/app/src/views/other/Login.vue index b931bb45..cdabcd8d 100644 --- a/app/src/views/other/Login.vue +++ b/app/src/views/other/Login.vue @@ -2,6 +2,7 @@ import auth from '@/api/auth' import install from '@/api/install' import passkey from '@/api/passkey' +import ICP from '@/components/ICP/ICP.vue' import SetLanguage from '@/components/SetLanguage/SetLanguage.vue' import SwitchAppearance from '@/components/SwitchAppearance/SwitchAppearance.vue' import Authorization from '@/components/TwoFA/Authorization.vue' @@ -23,7 +24,7 @@ install.get_lock().then(async (r: { lock: boolean }) => { const loading = ref(false) const enabled2FA = ref(false) -const refOTP = ref() +const refOTP = useTemplateRef('refOTP') const passcode = ref('') const recoveryCode = ref('') const passkeyConfigStatus = ref(false) @@ -266,7 +267,10 @@ async function handlePasskeyLogin() {