Skip to content

Commit ce1ffc4

Browse files
Login on focus (#1969)
* login on focus too * fix: fetch url logs * fix: fetch url logs * include the dropdown * lint --------- Co-authored-by: rtrm <[email protected]>
1 parent 2e8caae commit ce1ffc4

File tree

4 files changed

+20
-5
lines changed

4 files changed

+20
-5
lines changed

Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,6 @@ ENV BODY_SIZE_LIMIT=15728640
9090
COPY --from=builder --chown=1000 /app/build /app/build
9191
COPY --from=builder --chown=1000 /app/node_modules /app/node_modules
9292

93+
RUN apt -y update && apt-get install -y curl dnsutils
94+
9395
CMD ["/bin/bash", "-c", "/app/entrypoint.sh"]

src/lib/components/chat/ChatInput.svelte

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
toggleServer,
2626
} from "$lib/stores/mcpServers";
2727
import { getMcpServerFaviconUrl } from "$lib/utils/favicon";
28+
import { page } from "$app/state";
2829
2930
interface Props {
3031
files?: File[];
@@ -76,6 +77,7 @@
7677
let fileInputEl: HTMLInputElement | undefined = $state();
7778
let isUrlModalOpen = $state(false);
7879
let isMcpManagerOpen = $state(false);
80+
let isDropdownOpen = $state(false);
7981
8082
function openPickerWithAccept(accept: string) {
8183
if (!fileInputEl) return;
@@ -107,6 +109,7 @@
107109
: Promise.resolve();
108110
109111
async function focusTextarea() {
112+
if (page.data.shared && page.data.loginEnabled && !page.data.user) return;
110113
if (!textareaElement || textareaElement.disabled || isVirtualKeyboard()) return;
111114
if (typeof document !== "undefined" && document.activeElement === textareaElement) return;
112115
@@ -177,6 +180,9 @@
177180
}
178181
179182
function handleFocus() {
183+
if (requireAuthUser()) {
184+
return;
185+
}
180186
if (blurTimeout) {
181187
clearTimeout(blurTimeout);
182188
blurTimeout = null;
@@ -251,7 +257,16 @@
251257
accept={mimeTypes.join(",")}
252258
/>
253259

254-
<DropdownMenu.Root>
260+
<DropdownMenu.Root
261+
bind:open={isDropdownOpen}
262+
onOpenChange={(open) => {
263+
if (open && requireAuthUser()) {
264+
isDropdownOpen = false;
265+
return;
266+
}
267+
isDropdownOpen = open;
268+
}}
269+
>
255270
<DropdownMenu.Trigger
256271
class="btn size-7 rounded-full border bg-white text-black shadow transition-none enabled:hover:bg-white enabled:hover:shadow-inner dark:border-transparent dark:bg-gray-600/50 dark:text-white dark:hover:enabled:bg-gray-600"
257272
disabled={loading}

src/lib/components/chat/UrlFetchModal.svelte

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,7 @@
8282
const txt = await res.text();
8383
throw new Error(txt || `Failed to fetch (${res.status})`);
8484
}
85-
const forwardedType =
86-
res.headers.get("x-forwarded-content-type");
85+
const forwardedType = res.headers.get("x-forwarded-content-type");
8786
const blob = await res.blob();
8887
const mimeType = pickSafeMime(forwardedType, blob.type, trimmed);
8988
// Optional client-side mime filter (same wildcard semantics as dropzone)

src/lib/utils/loadAttachmentsFromUrls.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ export async function loadAttachmentsFromUrls(
9191
return;
9292
}
9393

94-
const forwardedType =
95-
response.headers.get("x-forwarded-content-type");
94+
const forwardedType = response.headers.get("x-forwarded-content-type");
9695
const blob = await response.blob();
9796
const mimeType = pickSafeMime(forwardedType, blob.type, url);
9897
const contentDisposition = response.headers.get("content-disposition");

0 commit comments

Comments
 (0)