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>
|
||||
)}
|
||||
/>
|
||||
<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
|
||||
control={form.control}
|
||||
name="priority"
|
||||
|
|
|
|||
|
|
@ -55,6 +55,7 @@ export const ntfyNotificationConfigSchema = type({
|
|||
priority: "'max' | 'high' | 'default' | 'low' | 'min'",
|
||||
username: "string?",
|
||||
password: "string?",
|
||||
accessToken:"string?",
|
||||
});
|
||||
|
||||
export const pushoverNotificationConfigSchema = type({
|
||||
|
|
|
|||
|
|
@ -10,6 +10,13 @@ export function buildNtfyShoutrrrUrl(config: Extract<NotificationConfig, { type:
|
|||
? `${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) {
|
||||
const url = new URL(config.serverUrl);
|
||||
const hostname = url.hostname;
|
||||
|
|
|
|||
Loading…
Reference in a new issue