Merge branch 'SaarLAN-Pissbeutel-ntfy-access-token'
This commit is contained in:
commit
b0c397ab87
3 changed files with 27 additions and 4 deletions
|
|
@ -518,6 +518,22 @@ 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. Will take precedence over username/password if set.
|
||||
</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({
|
||||
|
|
|
|||
|
|
@ -4,11 +4,17 @@ export function buildNtfyShoutrrrUrl(config: Extract<NotificationConfig, { type:
|
|||
let shoutrrrUrl: string;
|
||||
|
||||
const params = new URLSearchParams();
|
||||
const { username, password, accessToken } = config;
|
||||
|
||||
const auth =
|
||||
config.username && config.password
|
||||
? `${encodeURIComponent(config.username)}:${encodeURIComponent(config.password)}@`
|
||||
: "";
|
||||
let auth = "";
|
||||
|
||||
if (username && password) {
|
||||
auth = `${encodeURIComponent(username)}:${encodeURIComponent(password)}@`;
|
||||
}
|
||||
|
||||
if (accessToken) {
|
||||
auth = `:${encodeURIComponent(accessToken)}@`;
|
||||
}
|
||||
|
||||
if (config.serverUrl) {
|
||||
const url = new URL(config.serverUrl);
|
||||
|
|
|
|||
Loading…
Reference in a new issue