removed notice setting

This commit is contained in:
Simon Cambier 2025-06-21 13:59:21 +02:00
parent fc847b02b5
commit 325933f538
4 changed files with 10 additions and 19 deletions

View File

@ -111,7 +111,6 @@ export function getDefaultSettings(app: App): LocatorSettings {
httpApiEnabled: false, httpApiEnabled: false,
httpApiPort: '51361', httpApiPort: '51361',
httpApiNotice: true,
welcomeMessage: '', welcomeMessage: '',
verboseLogging: false, verboseLogging: false,

View File

@ -50,17 +50,5 @@ export function injectSettingsHttp(
await saveSettings(plugin) await saveSettings(plugin)
}) })
}) })
new Setting(containerEl)
.setName('Show a notification when the server starts')
.setDesc(
'Will display a notification if the server is enabled, at Obsidian startup.'
)
.addToggle(toggle =>
toggle.setValue(settings.httpApiNotice).onChange(async v => {
settings.httpApiNotice = v
await saveSettings(plugin)
})
)
} }
} }

View File

@ -80,7 +80,6 @@ export interface LocatorSettings extends WeightingSettings {
fuzziness: '0' | '1' | '2' fuzziness: '0' | '1' | '2'
httpApiEnabled: boolean httpApiEnabled: boolean
httpApiPort: string httpApiPort: string
httpApiNotice: boolean
DANGER_httpHost: string | null DANGER_httpHost: string | null
} }

View File

@ -48,10 +48,15 @@ export function getServer(plugin: LocatorPlugin) {
}, },
() => { () => {
console.log(`Locator - Started HTTP server on port ${port}`) console.log(`Locator - Started HTTP server on port ${port}`)
if (plugin.settings.DANGER_httpHost && plugin.settings.DANGER_httpHost !== 'localhost') { if (
new Notice(`Locator - Started non-localhost HTTP server at ${plugin.settings.DANGER_httpHost}:${port}`, 120_000) plugin.settings.DANGER_httpHost &&
} plugin.settings.DANGER_httpHost !== 'localhost'
else if (plugin.settings.httpApiNotice) { ) {
new Notice(
`Locator - Started non-localhost HTTP server at ${plugin.settings.DANGER_httpHost}:${port}`,
120_000
)
} else {
new Notice(`Locator - Started HTTP server on port ${port}`) new Notice(`Locator - Started HTTP server on port ${port}`)
} }
} }
@ -67,7 +72,7 @@ export function getServer(plugin: LocatorPlugin) {
close() { close() {
server.close() server.close()
console.log(`Locator - Terminated HTTP server`) console.log(`Locator - Terminated HTTP server`)
if (plugin.settings.httpApiEnabled && plugin.settings.httpApiNotice) { if (plugin.settings.httpApiEnabled) {
new Notice(`Locator - Terminated HTTP server`) new Notice(`Locator - Terminated HTTP server`)
} }
}, },