From eac009eeb4303761c29dcea0a4f2e52e46b302d1 Mon Sep 17 00:00:00 2001 From: ~midsum-salrux Date: Thu, 30 Mar 2023 15:41:42 -0400 Subject: [PATCH] Add trailing slash to bait server automatically --- ui/src/preferences/InvitePrefs.tsx | 2 +- ui/src/state/invites.ts | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ui/src/preferences/InvitePrefs.tsx b/ui/src/preferences/InvitePrefs.tsx index c490a00..17fe059 100644 --- a/ui/src/preferences/InvitePrefs.tsx +++ b/ui/src/preferences/InvitePrefs.tsx @@ -29,7 +29,7 @@ export const InvitePrefs = () => { id="url" type="text" defaultValue={baitURL} - {...register('url', { pattern: /^http.*\/$/ })} + {...register('url', { pattern: /^http.*$/ })} className="input default-ring bg-gray-50" /> diff --git a/ui/src/state/invites.ts b/ui/src/state/invites.ts index ecbf7f2..95bdb87 100644 --- a/ui/src/state/invites.ts +++ b/ui/src/state/invites.ts @@ -35,11 +35,13 @@ export default function useInviteState() { setBaitURL: setBaitURL, loaded: loaded, save: async (data: {url: string}) => { + const fixedUrl = data.url.substr(-1) === '/' ? data.url : data.url + '/'; + await api.poke({ app: 'reel', mark: 'reel-command', json: { - url: data.url, + url: fixedUrl, } }) }