misc: Tweak CORS
This commit is contained in:
1 parent
740664d918
commit
981d1581a4
8 files changed
+39
-29
No files matched your search
@@ -74,14 +74,14 @@
|
||||
<div class="max-w-full break-words text-sm leading-6">
|
||||
<Markdown source={node.comment_view.comment.content} />
|
||||
</div>
|
||||
<div class="flex flex-row gap-2 items-center mt-1">
|
||||
<div class="flex flex-row gap-2 items-center mt-1 h-[26px]">
|
||||
<CommentVote
|
||||
bind:score={node.comment_view.counts.score}
|
||||
bind:vote={node.comment_view.my_vote}
|
||||
commentId={node.comment_view.comment.id}
|
||||
/>
|
||||
<button
|
||||
class="{Color.borderDark} px-2 py-1 flex flex-row items-center gap-1
|
||||
class="{Color.borderDark} h-full px-2 flex flex-row items-center gap-1
|
||||
rounded-md transition-colors"
|
||||
on:click={() => (replying = !replying)}
|
||||
>
|
||||
|
||||
@@ -57,12 +57,12 @@
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="flex flex-row items-center rounded-md px-2 py-0.5 transition-colors
|
||||
cursor-pointer {Color.borderDark}"
|
||||
class="flex flex-row items-center rounded-md transition-colors
|
||||
cursor-pointer h-full {Color.borderDark}"
|
||||
>
|
||||
<button
|
||||
on:click={upvote}
|
||||
class="pr-1.5 {vote == 1 ? 'text-orange-500' : ''}"
|
||||
class="px-1.5 {vote == 1 ? 'text-orange-500' : ''}"
|
||||
aria-label="Upvote"
|
||||
>
|
||||
<Icon src={ChevronUp} width={19} mini />
|
||||
@@ -72,7 +72,7 @@
|
||||
</span>
|
||||
<button
|
||||
on:click={downvote}
|
||||
class="pl-1.5 {vote == -1 ? 'text-blue-500' : ''}"
|
||||
class="px-1.5 {vote == -1 ? 'text-blue-500' : ''}"
|
||||
aria-label="Downvote"
|
||||
>
|
||||
<Icon src={ChevronDown} width={19} mini />
|
||||
|
||||
@@ -67,17 +67,14 @@
|
||||
<svelte:self {post} nodes={node.children} isParent={false} />
|
||||
{/if}
|
||||
{#if node.comment_view.counts.child_count > 0 && node.children.length == 0}
|
||||
<div class="m-1 w-full max-w-[9rem]">
|
||||
<Button
|
||||
loading={loadingChildren}
|
||||
disabled={loadingChildren}
|
||||
on:click={() => fetchChildren(node)}
|
||||
large
|
||||
>
|
||||
<Icon src={ChevronDown} width={16} mini />
|
||||
Load {node.comment_view.counts.child_count} more
|
||||
</Button>
|
||||
</div>
|
||||
<Button
|
||||
loading={loadingChildren}
|
||||
disabled={loadingChildren}
|
||||
on:click={() => fetchChildren(node)}
|
||||
>
|
||||
<Icon src={ChevronDown} width={16} mini />
|
||||
Load {node.comment_view.counts.child_count} more
|
||||
</Button>
|
||||
{/if}
|
||||
</Comment>
|
||||
{/each}
|
||||
|
||||
@@ -6,9 +6,7 @@
|
||||
</script>
|
||||
|
||||
<img
|
||||
src="{url ??
|
||||
`https://api.dicebear.com/6.x/initials/svg?seed=${alt}`}?format=webp&thumbnail={width *
|
||||
2}"
|
||||
src="{url ?? `/img/logo-background.svg`}?format=webp&thumbnail={width * 2}"
|
||||
{alt}
|
||||
{width}
|
||||
loading="lazy"
|
||||
|
||||
@@ -17,12 +17,7 @@
|
||||
href={linkFromCommunity(user)}
|
||||
>
|
||||
{#if avatar}
|
||||
<Avatar
|
||||
url={user.avatar ??
|
||||
`https://api.dicebear.com/6.x/initials/svg?seed=${user.name}`}
|
||||
alt={user.name}
|
||||
width={avatarSize}
|
||||
/>
|
||||
<Avatar url={user.avatar} alt={user.name} width={avatarSize} />
|
||||
{/if}
|
||||
{user.name}
|
||||
</a>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
export let date: Date
|
||||
export let relativeTo: Date | undefined
|
||||
export let relativeTo: Date | undefined = undefined
|
||||
|
||||
function formatRelativeDate(date: Date) {
|
||||
const now = relativeTo?.getTime() ?? Date.now()
|
||||
|
||||
+7
-2
@@ -6,8 +6,9 @@ import {
|
||||
import { get, writable } from 'svelte/store'
|
||||
import { PUBLIC_PROXY_URL } from '$env/static/public'
|
||||
|
||||
export const DEFAULT_INSTANCE_URL = 'lemmy.world'
|
||||
export const DEFAULT_INSTANCE_URL = 'lemmy.ml'
|
||||
export let instance_url = writable(DEFAULT_INSTANCE_URL)
|
||||
export let corsSupported = writable(true)
|
||||
|
||||
export function buildBaseUrl(instance?: string) {
|
||||
if (!instance) {
|
||||
@@ -22,7 +23,11 @@ export function getClient(instance?: string): LemmyHttp {
|
||||
instance = get(authData)?.instance ?? DEFAULT_INSTANCE_URL
|
||||
}
|
||||
|
||||
return new LemmyHttp(`${PUBLIC_PROXY_URL}/cors/${instance}`)
|
||||
return new LemmyHttp(
|
||||
get(corsSupported)
|
||||
? `https://${instance}`
|
||||
: `${PUBLIC_PROXY_URL}/cors/${instance}`
|
||||
)
|
||||
}
|
||||
|
||||
export const getInstance = () => get(authData)?.instance ?? DEFAULT_INSTANCE_URL
|
||||
|
||||
Reference in new issue
Block a user