comparison mrjunejune/src/public/editor.js @ 204:e5aed6c36672

[Notes] Added icons and updated styling a bit. Probalby usable now.
author MrJuneJune <me@mrjunejune.com>
date Sun, 15 Feb 2026 11:02:13 -0800
parents b9b184b3303c
children
comparison
equal deleted inserted replaced
203:92a57bd716c1 204:e5aed6c36672
10 const returnUrl = encodeURIComponent(window.location.pathname); 10 const returnUrl = encodeURIComponent(window.location.pathname);
11 window.location.href = '/notes/login?return=' + returnUrl; 11 window.location.href = '/notes/login?return=' + returnUrl;
12 return false; 12 return false;
13 } 13 }
14 return true; 14 return true;
15 }
16
17 function goHome() {
18 window.location.href = '/notes';
15 } 19 }
16 20
17 function logout() { 21 function logout() {
18 localStorage.removeItem('notes-auth-token'); 22 localStorage.removeItem('notes-auth-token');
19 window.location.href = '/notes/login'; 23 window.location.href = '/notes/login';
116 120
117 // 4. Poll for images, return immediately for non-images 121 // 4. Poll for images, return immediately for non-images
118 if (file.type.startsWith('image/')) { 122 if (file.type.startsWith('image/')) {
119 return await pollForProcessedImage(data.media_id, token); 123 return await pollForProcessedImage(data.media_id, token);
120 } else { 124 } else {
121 // For non-images, construct the public URL 125 // For non-images, use the public URL from the server
122 const publicUrl = data.upload_url.split('?')[0]; // Remove query params 126 return { url: data.public_url };
123 return { url: publicUrl };
124 } 127 }
125 } 128 }
126 129
127 async function pollForProcessedImage(mediaId, token) { 130 async function pollForProcessedImage(mediaId, token) {
128 const maxAttempts = 60; // 2 minutes max (60 * 2 seconds) 131 const maxAttempts = 60; // 2 minutes max (60 * 2 seconds)