fix: logout loop — authUrl was empty in user-widget script due to Astro 5 define:vars behaviour; read from window.__bincioAuthUrl instead
This commit is contained in:
@@ -101,6 +101,7 @@ try {
|
|||||||
{instancePrivate && !isPublicPage && (
|
{instancePrivate && !isPublicPage && (
|
||||||
<style is:inline>[data-auth-pending]{visibility:hidden}</style>
|
<style is:inline>[data-auth-pending]{visibility:hidden}</style>
|
||||||
<script is:inline define:vars={{ authUrl }}>
|
<script is:inline define:vars={{ authUrl }}>
|
||||||
|
window.__bincioAuthUrl = authUrl;
|
||||||
fetch('/api/me', { credentials: 'include' })
|
fetch('/api/me', { credentials: 'include' })
|
||||||
.then(r => {
|
.then(r => {
|
||||||
if (r.status === 401 || r.status === 404) {
|
if (r.status === 401 || r.status === 404) {
|
||||||
@@ -590,7 +591,8 @@ try {
|
|||||||
|
|
||||||
<!-- User widget: only needed for multi-user (single-user nav links are static) -->
|
<!-- User widget: only needed for multi-user (single-user nav links are static) -->
|
||||||
{!singleHandle && (
|
{!singleHandle && (
|
||||||
<script define:vars={{ baseUrl, authUrl }}>
|
<script define:vars={{ baseUrl }}>
|
||||||
|
const authUrl: string = (window as any).__bincioAuthUrl ?? '';
|
||||||
(async () => {
|
(async () => {
|
||||||
try {
|
try {
|
||||||
const r = await fetch('/api/me', { credentials: 'include' });
|
const r = await fetch('/api/me', { credentials: 'include' });
|
||||||
@@ -732,6 +734,7 @@ try {
|
|||||||
|
|
||||||
{editEnabled && (
|
{editEnabled && (
|
||||||
<script define:vars={{ editUrl, baseUrl }}>
|
<script define:vars={{ editUrl, baseUrl }}>
|
||||||
|
const authUrl: string = (window as any).__bincioAuthUrl ?? '';
|
||||||
const modal = document.getElementById('upload-modal');
|
const modal = document.getElementById('upload-modal');
|
||||||
const openBtn = document.getElementById('upload-btn');
|
const openBtn = document.getElementById('upload-btn');
|
||||||
const closeBtn = document.getElementById('upload-close');
|
const closeBtn = document.getElementById('upload-close');
|
||||||
|
|||||||
Reference in New Issue
Block a user