mirror of
https://github.com/andreicscs/HoneyWire
synced 2026-06-26 12:39:53 +00:00
fixed agent middleware, checks user agent for wizard now, added registry url setting in ui
This commit is contained in:
@@ -117,7 +117,7 @@ func AgentAuthMiddleware(auth NodeAuthenticator, rateLimiter *RateLimiter) func(
|
||||
if HubAPIVersion > wizardMinHubAPI {
|
||||
log.Printf("[!] Warning: Wizard on node %s is out of date (MinHubAPI: %d, HubAPIVersion: %d). Please update the Wizard.", nodeID, wizardMinHubAPI, HubAPIVersion)
|
||||
}
|
||||
} else {
|
||||
} else if strings.Contains(strings.ToLower(r.Header.Get("User-Agent")), "wizard") {
|
||||
log.Printf("[!] Warning: Wizard on node %s did not provide version headers.", nodeID)
|
||||
}
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import { api } from '../../api/client'
|
||||
// Represents the exact JSON schema returned by GET /api/v1/config
|
||||
export interface ConfigApiResponse {
|
||||
hubEndpoint: string
|
||||
registryUrl: string
|
||||
autoArchiveDays: number
|
||||
autoPurgeDays: number
|
||||
webhookType: string
|
||||
@@ -18,6 +19,7 @@ export interface ConfigApiResponse {
|
||||
export interface ConfigState {
|
||||
isLoaded: boolean
|
||||
hubEndpoint: string
|
||||
registryUrl: string
|
||||
autoArchiveDays: number
|
||||
autoPurgeDays: number
|
||||
webhookType: string
|
||||
@@ -31,6 +33,7 @@ export const useConfigStore = defineStore('config', () => {
|
||||
const state = ref<ConfigState>({
|
||||
isLoaded: false,
|
||||
hubEndpoint: '',
|
||||
registryUrl: '',
|
||||
autoArchiveDays: 0,
|
||||
autoPurgeDays: 0,
|
||||
webhookType: 'ntfy',
|
||||
@@ -46,6 +49,7 @@ export const useConfigStore = defineStore('config', () => {
|
||||
const data = (await res.json()) as ConfigApiResponse
|
||||
|
||||
state.value.hubEndpoint = data.hubEndpoint || window.location.origin
|
||||
state.value.registryUrl = data.registryUrl || ''
|
||||
state.value.autoArchiveDays = data.autoArchiveDays != null ? data.autoArchiveDays : 0
|
||||
state.value.autoPurgeDays = data.autoPurgeDays != null ? data.autoPurgeDays : 0
|
||||
state.value.webhookType = data.webhookType || 'ntfy'
|
||||
|
||||
@@ -27,6 +27,7 @@ const settingTabs = [
|
||||
|
||||
const settings = ref({
|
||||
hubEndpoint: window.location.origin,
|
||||
registryUrl: '',
|
||||
autoArchiveDays: 0,
|
||||
autoPurgeDays: 0,
|
||||
webhookType: 'ntfy',
|
||||
@@ -42,6 +43,7 @@ watch(() => configStore.config.isLoaded, (loaded) => {
|
||||
if (loaded) {
|
||||
const loadedSettings = {
|
||||
hubEndpoint: configStore.config.hubEndpoint || window.location.origin,
|
||||
registryUrl: configStore.config.registryUrl || '',
|
||||
autoArchiveDays: configStore.config.autoArchiveDays !== undefined ? configStore.config.autoArchiveDays : 0,
|
||||
autoPurgeDays: configStore.config.autoPurgeDays !== undefined ? configStore.config.autoPurgeDays : 0,
|
||||
webhookType: configStore.config.webhookType || 'ntfy',
|
||||
@@ -193,12 +195,17 @@ const submitFactoryReset = async () => {
|
||||
|
||||
<div v-show="activeTab === 'general'">
|
||||
<BaseCard title="Network Configuration">
|
||||
<div class="max-w-md">
|
||||
<div class="max-w-md space-y-4">
|
||||
<BaseInput
|
||||
v-model="settings.hubEndpoint"
|
||||
label="Hub Endpoint URL"
|
||||
description="The publicly accessible URL or IP where sensors will send their telemetry."
|
||||
/>
|
||||
<BaseInput
|
||||
v-model="settings.registryUrl"
|
||||
label="Sensor Registry URL"
|
||||
description="The public registry URL from which to download sensor updates."
|
||||
/>
|
||||
</div>
|
||||
|
||||
</BaseCard>
|
||||
|
||||
Reference in New Issue
Block a user