#310 - Server notice display is now opt-out
This commit is contained in:
@@ -61,6 +61,7 @@ export interface OmnisearchSettings extends WeightingSettings {
|
|||||||
fuzziness: '0' | '1' | '2'
|
fuzziness: '0' | '1' | '2'
|
||||||
httpApiEnabled: boolean
|
httpApiEnabled: boolean
|
||||||
httpApiPort: string
|
httpApiPort: string
|
||||||
|
httpApiNotice: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -504,6 +505,18 @@ export class SettingsTab extends PluginSettingTab {
|
|||||||
await saveSettings(this.plugin)
|
await saveSettings(this.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(this.plugin)
|
||||||
|
})
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
//#endregion HTTP Server
|
//#endregion HTTP Server
|
||||||
@@ -613,6 +626,7 @@ export const DEFAULT_SETTINGS: OmnisearchSettings = {
|
|||||||
|
|
||||||
httpApiEnabled: false,
|
httpApiEnabled: false,
|
||||||
httpApiPort: '51361',
|
httpApiPort: '51361',
|
||||||
|
httpApiNotice: true,
|
||||||
|
|
||||||
welcomeMessage: '',
|
welcomeMessage: '',
|
||||||
verboseLogging: false,
|
verboseLogging: false,
|
||||||
|
|||||||
@@ -47,8 +47,10 @@ export function getServer() {
|
|||||||
},
|
},
|
||||||
() => {
|
() => {
|
||||||
console.log(`Omnisearch - Started HTTP server on port ${port}`)
|
console.log(`Omnisearch - Started HTTP server on port ${port}`)
|
||||||
|
if (settings.httpApiNotice) {
|
||||||
new Notice(`Omnisearch - Started HTTP server on port ${port}`)
|
new Notice(`Omnisearch - Started HTTP server on port ${port}`)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
server.on('error', e => {
|
server.on('error', e => {
|
||||||
@@ -61,7 +63,9 @@ export function getServer() {
|
|||||||
close() {
|
close() {
|
||||||
server.close()
|
server.close()
|
||||||
console.log(`Omnisearch - Terminated HTTP server`)
|
console.log(`Omnisearch - Terminated HTTP server`)
|
||||||
|
if (settings.httpApiNotice) {
|
||||||
new Notice(`Omnisearch - Terminated HTTP server`)
|
new Notice(`Omnisearch - Terminated HTTP server`)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user