1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-17 06:20:00 +00:00

feat: auto remove https prefix (#31)

This commit is contained in:
三咲智子 Kevin Deng 2022-11-23 17:06:32 +08:00 committed by GitHub
parent cd19d75418
commit 0befc5169b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,10 +1,15 @@
<script setup lang="ts">
import { DEFAULT_SERVER } from '~/constants'
const server = ref<string>()
let server = $ref<string>('')
async function oauth() {
location.href = `/api/${server.value || DEFAULT_SERVER}/login`
location.href = `/api/${server || DEFAULT_SERVER}/login`
}
async function handleInput() {
if (server.startsWith('https://'))
server = server.replace('https://', '')
}
</script>
@ -16,7 +21,7 @@ async function oauth() {
<div>Mastodon Server Name</div>
<div flex bg-gray:10 px2 py1 mxa rounded border="~ border" w-80 text-xl items-center>
<span op35 mr1 text-sm>https://</span>
<input v-model="server" :placeholder="DEFAULT_SERVER" outline-none bg-transparent>
<input v-model="server" :placeholder="DEFAULT_SERVER" outline-none bg-transparent @input="handleInput">
</div>
<button btn-solid mxa mt2 @click="oauth()">
Sign in