mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-04-25 04:09:12 +00:00
further social improvements, client-render edge cases
This commit is contained in:
parent
dd07e6bac4
commit
1c784d0605
4 changed files with 9 additions and 7 deletions
|
@ -26,16 +26,22 @@ export default ($: AppContext) => ({
|
|||
const { userId } = (ctx.session: { userId: string })
|
||||
|
||||
const srv = $.discord.client.guilds.get(id)
|
||||
|
||||
if (srv == null) {
|
||||
return { err: 'not_found' }
|
||||
}
|
||||
|
||||
if (userId == null) {
|
||||
return {
|
||||
id: id,
|
||||
server: $.P.serverSlug(srv)
|
||||
}
|
||||
}
|
||||
|
||||
let gm
|
||||
if (srv.members.has(userId)) {
|
||||
gm = $.discord.gm(id, userId)
|
||||
} else if ($.discord.isRoot(userId)) {
|
||||
// gm = $.discord.fakeGm({ id: userId })
|
||||
gm = $.discord.fakeGm({ id: userId })
|
||||
}
|
||||
|
||||
if (gm == null) {
|
||||
|
|
|
@ -34,7 +34,7 @@ const Hider = styled.div`
|
|||
|
||||
class Server extends React.Component<ServerPageProps> {
|
||||
static async getInitialProps (ctx: *, rpc: *, router: *) {
|
||||
const isDiscordBot = ctx.req.headers['user-agent'].includes('Discordbot')
|
||||
const isDiscordBot = ctx.req && ctx.req.headers['user-agent'].includes('Discordbot')
|
||||
if (ctx.user == null) {
|
||||
if (!isDiscordBot) {
|
||||
redirect(ctx, `/auth/login?r=${router.asPath}`)
|
||||
|
|
|
@ -129,10 +129,6 @@ export default class AuthLogin extends React.Component<AuthLoginProps, AuthLogin
|
|||
redirect(ctx, r || '/')
|
||||
}
|
||||
|
||||
if (ctx.req.headers['user-agent'].contains('Discordbot')) {
|
||||
redirect(ctx, '/_internal/_discordbot/_login')
|
||||
}
|
||||
|
||||
ctx.robots = 'NOINDEX, NOFOLLOW'
|
||||
|
||||
if (r != null) {
|
||||
|
|
BIN
ui/static/social.png
Normal file
BIN
ui/static/social.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 33 KiB |
Loading…
Add table
Reference in a new issue