stuff
This commit is contained in:
parent
83552baac3
commit
073f8d9e80
15 changed files with 42 additions and 23 deletions
|
@ -44,7 +44,8 @@ export default async function Home({
|
|||
.selectFrom('users')
|
||||
.where('users.joined', '<=', curPage)
|
||||
.limit(20)
|
||||
.orderBy('users.joined', 'asc')
|
||||
.orderBy('users.admin', 'desc')
|
||||
.orderBy('users.joined', 'desc')
|
||||
.selectAll()
|
||||
.execute() as unknown[] as JSONUserTable[];
|
||||
|
||||
|
@ -55,7 +56,7 @@ export default async function Home({
|
|||
.execute();
|
||||
|
||||
return (
|
||||
<MainLayout currentPage="/jams/" title="Admin" subtitle="">
|
||||
<MainLayout currentPage="/jams/" title="Admin" subtitle="" backButton>
|
||||
<h2>cool admin panel !!! :3</h2>
|
||||
<p>contact me@abtmtr.link for help</p>
|
||||
<ConditionalNull condition={existingUser != null}>
|
||||
|
@ -70,19 +71,25 @@ export default async function Home({
|
|||
.selectFrom('jams')
|
||||
.where('jams.author_id', '=', user.id)
|
||||
.select('id')
|
||||
.orderBy('jams.created', 'asc')
|
||||
.orderBy('jams.created', 'desc')
|
||||
.execute();
|
||||
let content = await db
|
||||
.selectFrom('content')
|
||||
.where('content.author_id', '=', user.id)
|
||||
.select('id')
|
||||
.orderBy('content.submitted', 'asc')
|
||||
.orderBy('content.submitted', 'desc')
|
||||
.execute();
|
||||
let judgements = await db
|
||||
.selectFrom('judgements')
|
||||
.where('judgements.author_id', '=', user.id)
|
||||
.select('id')
|
||||
.orderBy('judgements.published', 'asc')
|
||||
.orderBy('judgements.published', 'desc')
|
||||
.execute();
|
||||
let tokens = await db
|
||||
.selectFrom('tokens')
|
||||
.where('tokens.owner', '=', user.id)
|
||||
.select('id')
|
||||
.orderBy('tokens.created', 'desc')
|
||||
.execute();
|
||||
|
||||
return (<div style={{
|
||||
|
@ -91,7 +98,7 @@ export default async function Home({
|
|||
<p><Link href={`/jams/user/${user.id}`}>{user.username}@{user.instance}</Link></p>
|
||||
<p><small><Link href={user.url} target="_blank">{user.url}</Link></small></p>
|
||||
<p><small>{user.banned ? <><b>BANNED</b> - </> : <></>}{user.admin ? <><b>ADMIN</b> - </> : <></>}Joined {new Date(parseInt(user.joined)).toDateString()}</small></p>
|
||||
<p><small>{jams.length} jam{jams.length != 1 && "s"}, {content.length} submission{content.length != 1 && "s"}, {judgements.length} judgement{judgements.length != 1 && "s"}</small></p>
|
||||
<p><small>{jams.length} jam{jams.length != 1 && "s"}, {content.length} submission{content.length != 1 && "s"}, {judgements.length} judgement{judgements.length != 1 && "s"}, {tokens.length} token{tokens.length != 1 && "s"}</small></p>
|
||||
<p><Link href={`/jams/edit/user/${user.id}`}>Edit user</Link> - <Link href={`/jams/delete/user/${user.id}`}>Delete user</Link></p>
|
||||
</div>);
|
||||
})}
|
||||
|
@ -114,7 +121,6 @@ export default async function Home({
|
|||
}}>
|
||||
<p><Link href={`https://${app.instance_domain}/`}>{app.instance_domain}</Link></p>
|
||||
<p><small>Client ID: {app.client_id}</small></p>
|
||||
<p><small>Client Secret: {app.client_secret}</small></p>
|
||||
<p><small>Redirect URI: {app.redirect_uri}</small></p>
|
||||
<p><small>Scopes: read</small></p>
|
||||
</div>);
|
||||
|
|
|
@ -24,7 +24,7 @@ export async function GET(request: NextRequest, {params}: {params: {content: str
|
|||
.where('judgements.content_id', '=', id)
|
||||
.where('judgements.published', '<', until)
|
||||
.limit(20)
|
||||
.orderBy('judgements.published', 'asc')
|
||||
.orderBy('judgements.published', 'desc')
|
||||
.selectAll()
|
||||
.execute();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ export async function GET(request: NextRequest) {
|
|||
.selectFrom('content')
|
||||
.where('content.submitted', '<', until)
|
||||
.limit(20)
|
||||
.orderBy('content.submitted', 'asc')
|
||||
.orderBy('content.submitted', 'desc')
|
||||
.selectAll()
|
||||
.execute();
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ export async function GET(request: NextRequest, {params}: {params: {jam: string}
|
|||
.selectFrom('content')
|
||||
.where('content.submitted', '<', until)
|
||||
.limit(20)
|
||||
.orderBy('content.submitted', 'asc')
|
||||
.orderBy('content.submitted', 'desc')
|
||||
.selectAll()
|
||||
.execute();
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ export async function GET(request: NextRequest) {
|
|||
.selectFrom('jams')
|
||||
.where('jams.created', '<', until)
|
||||
.limit(20)
|
||||
.orderBy('jams.created', 'asc')
|
||||
.orderBy('jams.created', 'desc')
|
||||
.selectAll()
|
||||
.execute();
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ export async function GET(request: NextRequest, {params}: {params: {user: string
|
|||
.selectFrom('content')
|
||||
.where('content.submitted', '<', until)
|
||||
.limit(20)
|
||||
.orderBy('content.submitted', 'asc')
|
||||
.orderBy('content.submitted', 'desc')
|
||||
.selectAll()
|
||||
.execute();
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ export async function GET(request: NextRequest, {params}: { params: {user: strin
|
|||
.where('jams.created', '<', until)
|
||||
.where('jams.author_id', '=', id)
|
||||
.limit(20)
|
||||
.orderBy('jams.created', 'asc')
|
||||
.orderBy('jams.created', 'desc')
|
||||
.selectAll()
|
||||
.execute();
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ export async function GET(request: NextRequest, {params}: {params: {user: string
|
|||
.where('judgements.author_id', '=', id)
|
||||
.where('judgements.published', '<', until)
|
||||
.limit(20)
|
||||
.orderBy('judgements.published', 'asc')
|
||||
.orderBy('judgements.published', 'desc')
|
||||
.selectAll()
|
||||
.execute();
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ export async function GET(request: NextRequest) {
|
|||
.selectFrom('users')
|
||||
.where('users.joined', '<', until)
|
||||
.limit(20)
|
||||
.orderBy('users.joined', 'asc')
|
||||
.orderBy('users.joined', 'desc')
|
||||
.selectAll()
|
||||
.execute();
|
||||
|
||||
|
|
|
@ -77,7 +77,7 @@ export default async function Home({
|
|||
.where('judgements.content_id', '=', content.id)
|
||||
.where('judgements.published', '<=', curPage)
|
||||
.limit(20)
|
||||
.orderBy('judgements.published', 'asc')
|
||||
.orderBy('judgements.published', 'desc')
|
||||
.selectAll()
|
||||
.execute() as unknown[] as JSONJudgementTable[];
|
||||
|
||||
|
|
|
@ -69,7 +69,7 @@ export default async function Home({
|
|||
.where('content.jam_id', '=', jam.id)
|
||||
.where('content.submitted', '<=', curPage)
|
||||
.limit(20)
|
||||
.orderBy('content.submitted', 'asc')
|
||||
.orderBy('content.submitted', 'desc')
|
||||
.selectAll()
|
||||
.execute() as unknown[] as JSONContentTable[];
|
||||
|
||||
|
@ -81,6 +81,15 @@ export default async function Home({
|
|||
<p><small>{started ? "Started" : "Starts"} {new Date(parseInt(jam.date_start)).toDateString()} - {ended ? "Ended" : "Ends"} {new Date(parseInt(jam.date_end)).toDateString()}</small></p>
|
||||
<p>Hosted by <a href={`/jams/user/${jamOwner.id}`}>{`${jamOwner.username}@${jamOwner.instance}`}</a></p>
|
||||
<p>{jam.description}</p>
|
||||
<ConditionalNull condition={existingUser == null}>
|
||||
<h2>Log in with the Fediverse</h2>
|
||||
<p>If you'd like to participate in this jam, feel free to log in!</p>
|
||||
<form action="/jams/oauth/login">
|
||||
<input name="instance" placeholder="Instance URL (e.g. "social.besties.house" or "woem.men")" type="text" />
|
||||
<input type="submit" />
|
||||
</form>
|
||||
<p><small>Tested on Mastodon, GoToSocial, Pleroma, and Misskey</small></p>
|
||||
</ConditionalNull>
|
||||
<ConditionalNull condition={existingUser != null}>
|
||||
<div>
|
||||
<ConditionalNull condition={existingUser?.admin || jam.author_id == jam.id}><p><b>You have the ability to modify this Jam.</b></p></ConditionalNull>
|
||||
|
|
|
@ -115,6 +115,8 @@ export async function GET(request: NextRequest) {
|
|||
}
|
||||
}
|
||||
|
||||
cookieStore.set("token", currentToken.id);
|
||||
cookieStore.set("token", currentToken.id, {
|
||||
expires: Date.now() + 604800000
|
||||
});
|
||||
return Response.redirect(new URL('/jams', request.url));
|
||||
}
|
|
@ -47,6 +47,8 @@ export async function GET(request: NextRequest) {
|
|||
}
|
||||
}
|
||||
|
||||
cookieStore.set("instance", instance);
|
||||
cookieStore.set("instance", instance, {
|
||||
expires: Date.now() + 604800000
|
||||
});
|
||||
return Response.redirect(`https://${instance}/oauth/authorize?response_type=code&client_id=${existingInstanceApp.client_id}&redirect_uri=${existingInstanceApp.redirect_uri}&scope=read`);
|
||||
}
|
|
@ -41,7 +41,7 @@ export default async function Home({
|
|||
.selectFrom('jams')
|
||||
.where('jams.created', '<=', curPage)
|
||||
.limit(20)
|
||||
.orderBy('jams.created', 'asc')
|
||||
.orderBy('jams.created', 'desc')
|
||||
.selectAll()
|
||||
.execute() as unknown[] as JSONJamTable[];
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@ export default async function Home({
|
|||
.where('content.author_id', '=', user.id)
|
||||
.where('content.submitted', '<=', curPage)
|
||||
.limit(20)
|
||||
.orderBy('content.submitted', 'asc')
|
||||
.orderBy('content.submitted', 'desc')
|
||||
.selectAll()
|
||||
.execute() as unknown[] as JSONContentTable[];
|
||||
|
||||
|
@ -68,7 +68,7 @@ export default async function Home({
|
|||
.where('jams.author_id', '=', user.id)
|
||||
.where('jams.created', '<=', curPage)
|
||||
.limit(20)
|
||||
.orderBy('jams.created', 'asc')
|
||||
.orderBy('jams.created', 'desc')
|
||||
.selectAll()
|
||||
.execute() as unknown[] as JSONJamTable[];
|
||||
|
||||
|
@ -77,7 +77,7 @@ export default async function Home({
|
|||
.where('judgements.author_id', '=', user.id)
|
||||
.where('judgements.published', '<=', curPage)
|
||||
.limit(20)
|
||||
.orderBy('judgements.published', 'asc')
|
||||
.orderBy('judgements.published', 'desc')
|
||||
.selectAll()
|
||||
.execute() as unknown[] as JSONJudgementTable[];
|
||||
|
||||
|
|
Loading…
Reference in a new issue