diff --git a/src/pages/home.ts b/src/pages/home.ts index ffa9887..74ca72a 100644 --- a/src/pages/home.ts +++ b/src/pages/home.ts @@ -74,20 +74,22 @@ function content({ statuses, didHandleMap, profile, myStatus }: Props) { `} -
+ ${statuses.map((status, i) => { const handle = didHandleMap[status.authorDid] || status.authorDid const date = ts(status) @@ -106,7 +108,6 @@ function content({ statuses, didHandleMap, profile, myStatus }: Props) { ` })} - ` } diff --git a/src/pages/public/home.js b/src/pages/public/home.js deleted file mode 100644 index 22366ba..0000000 --- a/src/pages/public/home.js +++ /dev/null @@ -1,32 +0,0 @@ -Array.from(document.querySelectorAll('.status-option'), (el) => { - el.addEventListener('click', async (ev) => { - setError('') - - if (el.dataset.authed !== '1') { - window.location = '/login' - return - } - - const res = await fetch('/status', { - method: 'POST', - headers: { 'content-type': 'application/json' }, - body: JSON.stringify({ status: el.dataset.value }), - }) - const body = await res.json() - if (body?.error) { - setError(body.error) - } else { - location.reload() - } - }) -}) - -function setError(str) { - const errMsg = document.querySelector('.error') - if (str) { - errMsg.classList.add('visible') - errMsg.textContent = str - } else { - errMsg.classList.remove('visible') - } -} diff --git a/src/pages/public/styles.css b/src/pages/public/styles.css index b360110..839165b 100644 --- a/src/pages/public/styles.css +++ b/src/pages/public/styles.css @@ -139,6 +139,7 @@ button:hover, .button:hover { font-size: 2rem; width: 3rem; height: 3rem; + padding: 0; background-color: #fff; border: 1px solid var(--border-color); border-radius: 3rem; diff --git a/src/routes.ts b/src/routes.ts index 8afdf6e..c7d5a6e 100644 --- a/src/routes.ts +++ b/src/routes.ts @@ -204,7 +204,10 @@ export const createRouter = (ctx: AppContext) => { // If the user is signed in, get an agent which communicates with their server const agent = await getSessionAgent(req, res, ctx) if (!agent) { - return res.status(401).json({ error: 'Session required' }) + return res + .status(401) + .type('html') + .send('