Add trailing slash to bait server automatically

This commit is contained in:
~midsum-salrux 2023-03-30 15:41:42 -04:00
parent e01bce5770
commit eac009eeb4
2 changed files with 4 additions and 2 deletions

View File

@ -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"
/>
</div>

View File

@ -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,
}
})
}