mirror of
https://github.com/hotomoe/hotomoe
synced 2024-12-02 08:48:11 +09:00
[Server] Fix bug
This commit is contained in:
parent
21d6f305c7
commit
5bdb407979
@ -14,14 +14,14 @@ module.exports = (app: express.Application) => {
|
|||||||
callbackUrl: config.url + '/tw/cb'
|
callbackUrl: config.url + '/tw/cb'
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/twitter:connect', async (req, res): Promise<any> => {
|
app.get(/\/connect:twitter/, async (req, res): Promise<any> => {
|
||||||
if (res.locals.user == null) return res.send('plz signin');
|
if (res.locals.user == null) return res.send('plz signin');
|
||||||
const ctx = await twAuth.begin();
|
const ctx = await twAuth.begin();
|
||||||
redis.set(res.locals.user, JSON.stringify(ctx));
|
redis.set(res.locals.user, JSON.stringify(ctx));
|
||||||
res.redirect(ctx.url);
|
res.redirect(ctx.url);
|
||||||
});
|
});
|
||||||
|
|
||||||
app.get('/twitter/callback', (req, res): any => {
|
app.get('/tw/cb', (req, res): any => {
|
||||||
if (res.locals.user == null) return res.send('plz signin');
|
if (res.locals.user == null) return res.send('plz signin');
|
||||||
redis.get(res.locals.user, async (_, ctx) => {
|
redis.get(res.locals.user, async (_, ctx) => {
|
||||||
const tokens = await twAuth.done(JSON.parse(ctx), req.query.oauth_verifier);
|
const tokens = await twAuth.done(JSON.parse(ctx), req.query.oauth_verifier);
|
||||||
|
Loading…
Reference in New Issue
Block a user