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>
|
</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
|
<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({
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,17 @@ export function buildNtfyShoutrrrUrl(config: Extract<NotificationConfig, { type:
|
||||||
let shoutrrrUrl: string;
|
let shoutrrrUrl: string;
|
||||||
|
|
||||||
const params = new URLSearchParams();
|
const params = new URLSearchParams();
|
||||||
|
const { username, password, accessToken } = config;
|
||||||
|
|
||||||
const auth =
|
let auth = "";
|
||||||
config.username && config.password
|
|
||||||
? `${encodeURIComponent(config.username)}:${encodeURIComponent(config.password)}@`
|
if (username && password) {
|
||||||
: "";
|
auth = `${encodeURIComponent(username)}:${encodeURIComponent(password)}@`;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (accessToken) {
|
||||||
|
auth = `:${encodeURIComponent(accessToken)}@`;
|
||||||
|
}
|
||||||
|
|
||||||
if (config.serverUrl) {
|
if (config.serverUrl) {
|
||||||
const url = new URL(config.serverUrl);
|
const url = new URL(config.serverUrl);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue