-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
195 additions
and
44 deletions.
There are no files selected for viewing
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<template> | ||
<section> | ||
<h1>Logging you in...</h1> | ||
</section> | ||
</template> | ||
|
||
<script> | ||
import vue from "vue"; | ||
/* global window */ | ||
export default { | ||
mounted() { | ||
console.log("i want to die"); | ||
console.log(vue.ws); | ||
window.location.href = | ||
"https://discordapp.com/oauth2/authorize" + | ||
"?client_id=453716817639243779" + | ||
"&scope=identify" + | ||
"&response_type=code" + | ||
"&redirect_uri=" + | ||
encodeURIComponent("kys"); | ||
} | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
export default async ({ req, store, app }) => { | ||
// let token = localStorage.getItem('token'); | ||
// if (token !== null) { | ||
// const user = await app.$axios.$get("/users/@me", { | ||
// headers: { | ||
// Authorization: token | ||
// } | ||
// }); | ||
// store.commit("setUser", user); | ||
// app.$axios.setToken(token); | ||
// } | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// This code will be injected before initializing the root App | ||
import Vue from 'vue'; | ||
/* global window, EventEmitter */ | ||
|
||
class VueWebsocket extends EventEmitter { | ||
constructor() { | ||
super(); | ||
this.url = process.env.isbeta ? 'ws://localhost:8085' : 'wss://blargbot.xyz'; | ||
this.ws = new window.WebSocket(this.url); | ||
} | ||
|
||
install(Vue, options) { | ||
Vue.ws = this; | ||
} | ||
} | ||
|
||
const options = {}; | ||
|
||
// Activate plugin | ||
Vue.use(new VueWebsocket(), options); | ||
|
||
export default async ({ app }) => { | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// const cp = require('cookieparser'); | ||
|
||
// export const state = () => ({ | ||
// user: null, | ||
// token: null, | ||
// privacyVersion: 0 | ||
// }); | ||
|
||
// export const mutations = { | ||
// setUser(state, user) { | ||
// state.user = user; | ||
// }, | ||
// setUserPrivacy(state, accept) { | ||
// state.user.privacyAccept = accept; | ||
// }, | ||
// setToken(state, token) { | ||
// state.token = token; | ||
// }, | ||
// setPrivacyVersion(state, ver) { | ||
// state.privacyVersion = ver; | ||
// } | ||
// }; | ||
|
||
// export const actions = { | ||
// async nuxtServerInit({ commit }, { app, req, store }) { | ||
// if (req.headers.cookie) { | ||
// try { | ||
// let p = cp(req.headers.cookie); | ||
// if (p.token) { | ||
// let user = await app.$axios.$get('/users/@me', { | ||
// headers: { | ||
// Authorization: p.token | ||
// } | ||
// }); | ||
// store.commit("setUser", user); | ||
// app.$axios.setToken(p.token); | ||
// } | ||
// } catch (err) { | ||
|
||
// } | ||
// } | ||
// } | ||
// }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
const jwt = require('jsonwebtoken'); | ||
const config = require('../../config.json'); | ||
const secret = config.auth.secret; | ||
let expiry = (60 * 60 * 24 * 2); // 48 hours | ||
|
||
class Security { | ||
static generatedToken(id) { | ||
const token = jwt.sign({ id, exp: Math.floor(Date.now() / 1000) + expiry }, secret); | ||
return token; | ||
} | ||
|
||
static validateToken(token) { | ||
try { | ||
const id = jwt.verify(token, secret); | ||
return id; | ||
} catch (err) { | ||
return null; | ||
} | ||
} | ||
|
||
static set expiry(value) { | ||
expiry = value; | ||
} | ||
} | ||
|
||
module.exports = Security; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters