add access token for ntfy notifications
This commit is contained in:
parent
eded452c83
commit
1b8154a74b
3 changed files with 22 additions and 0 deletions
|
|
@ -518,6 +518,20 @@ export const CreateNotificationForm = ({ onSubmit, mode = "create", initialValue
|
||||||
</FormItem>
|
</FormItem>
|
||||||
)}
|
)}
|
||||||
/>
|
/>
|
||||||
|
<FormField
|
||||||
|
control={form.control}
|
||||||
|
name="accessToken"
|
||||||
|
render={({ field }) => (
|
||||||
|
<FormItem>
|
||||||
|
<FormLabel>Access token (Optional)</FormLabel>
|
||||||
|
<FormControl>
|
||||||
|
<SecretInput {...field} placeholder="••••••••" />
|
||||||
|
</FormControl>
|
||||||
|
<FormDescription>Access token for server authentication, if required.</FormDescription>
|
||||||
|
<FormMessage />
|
||||||
|
</FormItem>
|
||||||
|
)}
|
||||||
|
/>
|
||||||
<FormField
|
<FormField
|
||||||
control={form.control}
|
control={form.control}
|
||||||
name="priority"
|
name="priority"
|
||||||
|
|
|
||||||
|
|
@ -55,6 +55,7 @@ export const ntfyNotificationConfigSchema = type({
|
||||||
priority: "'max' | 'high' | 'default' | 'low' | 'min'",
|
priority: "'max' | 'high' | 'default' | 'low' | 'min'",
|
||||||
username: "string?",
|
username: "string?",
|
||||||
password: "string?",
|
password: "string?",
|
||||||
|
accessToken:"string?",
|
||||||
});
|
});
|
||||||
|
|
||||||
export const pushoverNotificationConfigSchema = type({
|
export const pushoverNotificationConfigSchema = type({
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,13 @@ export function buildNtfyShoutrrrUrl(config: Extract<NotificationConfig, { type:
|
||||||
? `${encodeURIComponent(config.username)}:${encodeURIComponent(config.password)}@`
|
? `${encodeURIComponent(config.username)}:${encodeURIComponent(config.password)}@`
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
|
const auth =
|
||||||
|
config.accessToken
|
||||||
|
? `:${encodeURIComponent(config.accessToken)}@`
|
||||||
|
: config.username && config.password
|
||||||
|
? `${encodeURIComponent(config.username)}:${encodeURIComponent(config.password)}@`
|
||||||
|
: "";
|
||||||
|
|
||||||
if (config.serverUrl) {
|
if (config.serverUrl) {
|
||||||
const url = new URL(config.serverUrl);
|
const url = new URL(config.serverUrl);
|
||||||
const hostname = url.hostname;
|
const hostname = url.hostname;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue