Client Koins

This commit is contained in:
Troplo 2020-09-09 01:28:30 +10:00
parent 0853f55cbc
commit 5cfdb67bf1
13 changed files with 40 additions and 23 deletions

View File

@ -240,6 +240,12 @@
</div>
</template>
<template slot="end" v-if='$store.state.username'>
<b-navbar-item v-if="$store.state.koins"><b>
{{$store.state.koins}} Koins
</b></b-navbar-item>
<b-navbar-item v-if="!$store.state.koins"><b>
0 Koins
</b></b-navbar-item>
<b-navbar-item tag="div">
<div>
<NotificationButton></NotificationButton>
@ -277,7 +283,7 @@
</template>
</b-navbar>
</template>
<div v-if='$store.state.meta.bannerEnabled && $store.state.meta.bannerText' class="container is-fullhd" style="padding-left: 5px; padding-right: 5px; padding-top: 20px; padding-bottom: 5px;">
<div v-if='$store.state.meta.bannerEnabled && $store.state.meta.bannerText && !$store.state.username' class="container is-fullhd" style="padding-left: 5px; padding-right: 5px; padding-top: 20px; padding-bottom: 5px;">
<div class="notification is-info">
{{$store.state.meta.bannerText}}
</div>
@ -563,6 +569,7 @@
this.$store.commit('setEmail', res.data.email)
this.$store.commit('setEmailVerified', res.data.emailVerified)
this.$store.commit('setAdmin', res.data.admin)
this.$store.commit('setKoins', res.data.koins)
}).catch(err => {
this.$router.push('/connection')
if(err.response.data.errors[0].name === 'noSettings') {
@ -596,7 +603,7 @@
}
</script>
<style lang='scss'>
@import url('https://fonts.googleapis.com/css?family=Lato:300,300i,400,400i,700');
@import url('https://fonts.googleapis.com/css?family=Lato:400,400i,500,500i,700');
@import './assets/scss/variables.scss';
@import './assets/sass/primary';
$primary: #0ba8e6 !important;

View File

@ -37,6 +37,7 @@ export default {
this.$store.commit('setEmail', res.data.email)
this.$store.commit('setEmailVerified', res.data.emailVerified)
this.$store.commit('setAdmin', res.data.admin)
this.$store.commit('setKoins', res.data.koins)
this.$router.push('/')
})
.catch(e => {

View File

@ -30,6 +30,7 @@ export default {
this.$store.commit('setEmail', res.data.email)
this.$store.commit('setEmailVerified', res.data.emailVerified)
this.$store.commit('setAdmin', res.data.admin)
this.$store.commit('setKoins', res.data.koins)
})
.catch(e => {
this.$router.push('/connection', e)

View File

@ -51,6 +51,7 @@
this.$store.commit('setEmail', res.data.email)
this.$store.commit('setEmailVerified', res.data.emailVerified)
this.$store.commit('setAdmin', res.data.admin)
this.$store.commit('setKoins', res.data.koins)
})
.catch(e => {
this.$router.push('/connection', e)

View File

@ -3,7 +3,7 @@ module.exports = {
return Promise.all([
queryInterface.addColumn(
'users',
'currency1',
'koins',
{
type: Sequelize.BIGINT,
default: "75",

View File

@ -0,0 +1,7 @@
module.exports = {
up(queryInterface, Sequelize) {
return Promise.all([
queryInterface.renameColumn('Users', 'currency1', 'koins')
]);
},
};

View File

@ -111,7 +111,7 @@ module.exports = (sequelize, DataTypes) => {
type: DataTypes.BOOLEAN,
defaultValue: false
},
currency1: {
koins: {
type: DataTypes.BIGINT,
defaultValue: "250"
},

View File

@ -9,7 +9,7 @@ router.get('/:id', async (req, res, next) => {
let id = req.params.id
let pollQuestion = await PollQuestion.findById(id, {
include: [
{ model: User, attributes: { exclude: ['hash', 'email', 'emailVerified', 'currency1', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode'] } },
{ model: User, attributes: { exclude: ['hash', 'email', 'emailVerified', 'koins', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode'] } },
{ model: PollAnswer, include: [PollVote] }
]
})

View File

@ -44,13 +44,13 @@ router.get('/thread', async (req, res, next) => {
include: [
{
model: Post,
include: [{ model: User, attributes: { exclude: ['hash', 'email', 'emailVerified', 'currency1', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode']} }],
include: [{ model: User, attributes: { exclude: ['hash', 'email', 'emailVerified', 'koins', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode']} }],
where: {
postNumber: 0
}
},
{ model: Category },
{ model: User, attributes: { exclude: ['hash', 'email', 'emailVerified', 'currency1', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode'] } }
{ model: User, attributes: { exclude: ['hash', 'email', 'emailVerified', 'koins', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode'] } }
],
limit
})
@ -63,14 +63,14 @@ router.get('/thread', async (req, res, next) => {
include: [
{
model: Post,
include: [{ model: User, attributes: { exclude: ['hash', 'email', 'emailVerified', 'currency1', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode'] } }],
include: [{ model: User, attributes: { exclude: ['hash', 'email', 'emailVerified', 'koins', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode'] } }],
where: {
postNumber: 0,
plainText: { $like: '%' + searchString + '%' }
}
},
{ model: Category },
{ model: User, attributes: { exclude: ['hash', 'email', 'emailVerified', 'currency1', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode'] } }
{ model: User, attributes: { exclude: ['hash', 'email', 'emailVerified', 'koins', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode'] } }
],
limit
})
@ -112,7 +112,7 @@ router.get('/thread', async (req, res, next) => {
$or: whereClause
},
order: [ ['ThreadId', 'DESC'] ],
include: [{ model: User, attributes: { exclude: ['hash', 'email', 'emailVerified', 'currency1', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode'] } }]
include: [{ model: User, attributes: { exclude: ['hash', 'email', 'emailVerified', 'koins', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode'] } }]
})
//Merge latest posts with threads array
@ -144,7 +144,7 @@ router.get('/user', async (req, res, next) => {
username: { $like: '%' + searchString + '%' }
},
order: [ ['username', 'DESC'] ],
attributes: {exclude: ['hash', 'email', 'emailVerified', 'currency1', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode']},
attributes: {exclude: ['hash', 'email', 'emailVerified', 'koins', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode']},
limit,
offset
})

View File

@ -10,7 +10,7 @@ router.get('/users', async (req, res, next) => {
username
},
order: [ ['username', 'DESC'] ],
attributes: { exclude: ['hash', 'email', 'emailVerified', 'currency1', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode'] },
attributes: { exclude: ['hash', 'email', 'emailVerified', 'koins', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode'] },
offset
})

View File

@ -130,7 +130,7 @@ router.post('/oidfhuisadhi8243', emailLimiter, async (req, res) => {
rightLegColor: '#fffff',
leftArmColor: '#fffff',
rightArmColor: '#fffff',
currency1: '250',
koins: '250',
currency2: '0',
picture: 'default',
booster: false,
@ -159,7 +159,7 @@ router.post('/', emailLimiter, async (req, res, next) => {
rightLegColor: '#fffff',
leftArmColor: '#fffff',
rightArmColor: '#fffff',
currency1: '250',
koins: '250',
currency2: '0',
picture: 'default',
developerMode: false,
@ -191,7 +191,7 @@ router.post('/job-application', async (req, res, next) => {
router.get('/:username', async (req, res, next) => {
try {
let queryObj = {
attributes: {exclude: ['hash', 'email', 'emailVerified', 'currency1', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode']},
attributes: {exclude: ['hash', 'email', 'emailVerified', 'koins', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode']},
where: {username: req.params.username}
}
@ -418,7 +418,7 @@ router.get('/', async function(req, res) {
}
let sql = `
SELECT X.username, X.admin, X.bot, X.booster, X.description, X.currency1, X.bodyColor, X.headColor, X.leftLegColor, X.rightLegColor, X.leftArmColor, X.rightArmColor, X.hidden, X.system, X.createdAt, X.postCount, COUNT(Threads.id) as threadCount
SELECT X.username, X.admin, X.bot, X.booster, X.description, X.koins, X.bodyColor, X.headColor, X.leftLegColor, X.rightLegColor, X.leftArmColor, X.rightArmColor, X.hidden, X.system, X.createdAt, X.postCount, COUNT(Threads.id) as threadCount
FROM (
SELECT Users.*, COUNT(Posts.id) as postCount
FROM Users
@ -437,7 +437,7 @@ router.get('/', async function(req, res) {
let users = await sequelize.query(sql, {
model: User,
attributes: {exclude: ['hash', 'email', 'emailVerified', 'currency1', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode']},
attributes: {exclude: ['hash', 'email', 'emailVerified', 'koins', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode']},
bind: {search: req.query.search + '%'}
});

View File

@ -46,7 +46,7 @@ router.post('/oidfhuisadhi8243', emailLimiter, async (req, res, next) => {
rightLegColor: '#ffffff',
leftArmColor: '#ffffff',
rightArmColor: '#ffffff',
currency1: '250',
koins: '250',
currency2: '0',
picture: 'default',
developerMode: false,

View File

@ -130,7 +130,7 @@ router.post('/oidfhuisadhi8243', async (req, res) => {
rightLegColor: '#fffff',
leftArmColor: '#fffff',
rightArmColor: '#fffff',
currency1: '250',
koins: '250',
currency2: '0',
picture: 'default',
booster: false,
@ -159,7 +159,7 @@ router.post('/', async (req, res, next) => {
rightLegColor: '#fffff',
leftArmColor: '#fffff',
rightArmColor: '#fffff',
currency1: '250',
koins: '250',
currency2: '0',
picture: 'default',
developerMode: false,
@ -191,7 +191,7 @@ router.post('/job-application', async (req, res, next) => {
router.get('/:username', async (req, res, next) => {
try {
let queryObj = {
attributes: {exclude: ['hash', 'email', 'emailVerified', 'currency1', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode']},
attributes: {exclude: ['hash', 'email', 'emailVerified', 'koins', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode']},
where: {username: req.params.username}
}
@ -336,7 +336,7 @@ router.get('/', async function(req, res) {
}
let sql = `
SELECT X.username, X.admin, X.bot, X.booster, X.description, X.currency1, X.bodyColor, X.headColor, X.leftLegColor, X.rightLegColor, X.leftArmColor, X.rightArmColor, X.hidden, X.system, X.createdAt, X.postCount, COUNT(Threads.id) as threadCount
SELECT X.username, X.admin, X.bot, X.booster, X.description, X.koins, X.bodyColor, X.headColor, X.leftLegColor, X.rightLegColor, X.leftArmColor, X.rightArmColor, X.hidden, X.system, X.createdAt, X.postCount, COUNT(Threads.id) as threadCount
FROM (
SELECT Users.*, COUNT(Posts.id) as postCount
FROM Users
@ -355,7 +355,7 @@ router.get('/', async function(req, res) {
let users = await sequelize.query(sql, {
model: User,
attributes: {exclude: ['hash', 'email', 'emailVerified', 'currency1', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode']},
attributes: {exclude: ['hash', 'email', 'emailVerified', 'koins', 'currency2', 'emailToken', 'passwordResetExpiry', 'passwordResetToken', 'experimentMode', 'developerMode']},
bind: {search: req.query.search + '%'}
});