@@ -398,10 +380,10 @@
{{ $store.state.client.bannerText }}
@@ -463,16 +445,16 @@ export default {
},
updateDismissed() {
localStorage.setItem(
- "update-" + this.$store.state.client.clientVersion,
- true
+ "update-" + this.$store.state.client.clientVersion,
+ true
);
this.updateModal = false;
},
showUpdate() {
if (
- !localStorage.getItem(
- "update-" + this.$store.state.client.clientVersion
- )
+ !localStorage.getItem(
+ "update-" + this.$store.state.client.clientVersion
+ )
) {
this.updateModal = true;
} else {
@@ -487,118 +469,118 @@ export default {
doRegister() {
this.register.loading = true;
this.axios
- .post("/api/v1/passkey/register", {
- username: this.register.username,
- password: this.register.password,
- email: this.register.email,
- confirm: this.register.confirm,
- agree: this.register.agree,
- })
- .then((res) => {
- this.register.loading = false;
- this.registerModal = false;
- this.$store.commit("setToken", res.data.token);
- localStorage.setItem("token", JSON.stringify(res.data.token));
- this.getInfo();
- this.$buefy.snackbar.open({
- message: this.$t("errors.registered"),
- type: "is-info",
- });
- })
- .catch((e) => {
- this.register.loading = false;
-
- AjaxErrorHandler(this.$store)(e, (error, errors) => {
- let path = error.path;
-
- if (this.errors[path] !== undefined) {
- this.errors[path] = error.message;
- } else {
- errors.push(error.message);
- }
- });
+ .post("/api/v1/passkey/register", {
+ username: this.register.username,
+ password: this.register.password,
+ email: this.register.email,
+ confirm: this.register.confirm,
+ agree: this.register.agree,
+ })
+ .then((res) => {
+ this.register.loading = false;
+ this.registerModal = false;
+ this.$store.commit("setToken", res.data.token);
+ localStorage.setItem("token", JSON.stringify(res.data.token));
+ this.getInfo();
+ this.$buefy.snackbar.open({
+ message: this.$t("errors.registered"),
+ type: "is-info",
});
+ })
+ .catch((e) => {
+ this.register.loading = false;
+
+ AjaxErrorHandler(this.$store)(e, (error, errors) => {
+ let path = error.path;
+
+ if (this.errors[path] !== undefined) {
+ this.errors[path] = error.message;
+ } else {
+ errors.push(error.message);
+ }
+ });
+ });
},
doLogin() {
this.login.loading = true;
this.axios
- .post("/api/v1/users/login", {
- username: this.login.username,
- password: this.login.password,
- })
- .then((res) => {
- this.login.loading = false;
- this.$store.commit("setToken", res.data.token);
- if (!this.login.doNotSaveToken) {
- localStorage.setItem("token", JSON.stringify(res.data.token));
- }
- Object.assign(axios.defaults, {
- headers: { Authorization: this.$store.state.user.token },
- });
- this.loginModal = false;
- this.axios
- .get(
- process.env.VUE_APP_APIENDPOINT +
- process.env.VUE_APP_APIVERSION +
- "/" +
- "userinfo"
- )
- .then((res) => {
- this.$store.commit("setUsername", res.data.username);
- 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.$store.commit("setID", res.data.id);
- this.$store.commit("setBot", res.data.bot);
- this.$buefy.snackbar.open({
- message: this.$t("errors.login"),
- type: "is-info",
- });
- })
- .catch(() => {
- this.$buefy.snackbar.open({
- message: this.$t("errors.authFail"),
- type: "is-warning",
- });
- });
- })
- .catch((e) => {
- this.login.loading = false;
- AjaxErrorHandler(this.$store)(e);
- this.axios
- .get(
- process.env.VUE_APP_APIENDPOINT +
- process.env.VUE_APP_APIVERSION +
- "/" +
- "userinfo"
- )
- .then((res) => {
- this.$store.commit("setUsername", res.data.username);
- 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.$store.commit("setID", res.data.id);
- this.$store.commit("setBot", res.data.bot);
- })
- .catch(() => {
- this.$buefy.snackbar.open({
- message: this.$t("errors.authFail"),
- type: "is-warning",
- });
- });
-
- AjaxErrorHandler(this.$store)(e, (error, errors) => {
- let path = error.path;
-
- if (this.errors[path] !== undefined) {
- this.errors[path] = error.message;
- } else {
- errors.push(error.message);
- }
- });
+ .post("/api/v1/users/login", {
+ username: this.login.username,
+ password: this.login.password,
+ })
+ .then((res) => {
+ this.login.loading = false;
+ this.$store.commit("setToken", res.data.token);
+ if (!this.login.doNotSaveToken) {
+ localStorage.setItem("token", JSON.stringify(res.data.token));
+ }
+ Object.assign(axios.defaults, {
+ headers: { Authorization: this.$store.state.user.token },
});
+ this.loginModal = false;
+ this.axios
+ .get(
+ process.env.VUE_APP_APIENDPOINT +
+ process.env.VUE_APP_APIVERSION +
+ "/" +
+ "userinfo"
+ )
+ .then((res) => {
+ this.$store.commit("setUsername", res.data.username);
+ 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.$store.commit("setID", res.data.id);
+ this.$store.commit("setBot", res.data.bot);
+ this.$buefy.snackbar.open({
+ message: this.$t("errors.login"),
+ type: "is-info",
+ });
+ })
+ .catch(() => {
+ this.$buefy.snackbar.open({
+ message: this.$t("errors.authFail"),
+ type: "is-warning",
+ });
+ });
+ })
+ .catch((e) => {
+ this.login.loading = false;
+ AjaxErrorHandler(this.$store)(e);
+ this.axios
+ .get(
+ process.env.VUE_APP_APIENDPOINT +
+ process.env.VUE_APP_APIVERSION +
+ "/" +
+ "userinfo"
+ )
+ .then((res) => {
+ this.$store.commit("setUsername", res.data.username);
+ 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.$store.commit("setID", res.data.id);
+ this.$store.commit("setBot", res.data.bot);
+ })
+ .catch(() => {
+ this.$buefy.snackbar.open({
+ message: this.$t("errors.authFail"),
+ type: "is-warning",
+ });
+ });
+
+ AjaxErrorHandler(this.$store)(e, (error, errors) => {
+ let path = error.path;
+
+ if (this.errors[path] !== undefined) {
+ this.errors[path] = error.message;
+ } else {
+ errors.push(error.message);
+ }
+ });
+ });
},
logout() {
localStorage.removeItem("token");
@@ -607,36 +589,36 @@ export default {
headers: { Authorization: this.$store.state.user.token },
});
this.axios
- .get(
- process.env.VUE_APP_APIENDPOINT +
- process.env.VUE_APP_APIVERSION +
- "/" +
- "userinfo"
- )
- .then((res) => {
- this.$store.commit("setUsername", res.data.username);
- 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.$store.commit("setID", res.data.id);
- this.$store.commit("setBot", res.data.bot);
- this.$buefy.snackbar.open({
- message: this.$t("errors.logout"),
- type: "is-info",
- });
- })
- .catch(() => {
- this.$buefy.snackbar.open({
- message: this.$t("errors.logout"),
- type: "is-info",
- });
+ .get(
+ process.env.VUE_APP_APIENDPOINT +
+ process.env.VUE_APP_APIVERSION +
+ "/" +
+ "userinfo"
+ )
+ .then((res) => {
+ this.$store.commit("setUsername", res.data.username);
+ 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.$store.commit("setID", res.data.id);
+ this.$store.commit("setBot", res.data.bot);
+ this.$buefy.snackbar.open({
+ message: this.$t("errors.logout"),
+ type: "is-info",
});
+ })
+ .catch(() => {
+ this.$buefy.snackbar.open({
+ message: this.$t("errors.logout"),
+ type: "is-info",
+ });
+ });
},
fakeUser() {
this.$store.commit("fakeUser");
this.$buefy.snackbar.open(
- `WARNING: You have fake authenticated, you do not have authenticated API access. Use for debug purposes only.`
+ `WARNING: You have fake authenticated, you do not have authenticated API access. Use for debug purposes only.`
);
Object.assign(axios.defaults, {
headers: { Authorization: this.$store.state.user.token },
@@ -644,79 +626,28 @@ export default {
},
dailyReward(notify) {
this.axios
- .get(
- process.env.VUE_APP_APIENDPOINT +
- process.env.VUE_APP_APIVERSION +
- "/" +
- "users/reward"
- )
- .then((res) => {
- this.$store.commit("setKoins", res.data.koins);
- })
- .catch((e) => {
- if (notify) {
- AjaxErrorHandler(this.$store)(e);
- }
- });
+ .get(
+ process.env.VUE_APP_APIENDPOINT +
+ process.env.VUE_APP_APIVERSION +
+ "/" +
+ "users/reward"
+ )
+ .then((res) => {
+ this.$store.commit("setKoins", res.data.koins);
+ })
+ .catch((e) => {
+ if (notify) {
+ AjaxErrorHandler(this.$store)(e);
+ }
+ });
},
getInfo() {
Object.assign(axios.defaults, {
headers: { Authorization: this.$store.state.user.token },
});
this.axios
- .get(
- process.env.VUE_APP_APIENDPOINT +
- process.env.VUE_APP_APIVERSION +
- "/" +
- "kaverti/state"
- )
- .then((res) => {
- this.$store.commit("setSettings", res.data.state);
- this.$store.commit("setVersion", res.data.state.latestCanaryVersion);
- this.$store.commit("setAPIVersion", res.data.apiVersion);
- })
- .catch(() => {
- this.$buefy.snackbar.open({
- message: this.$t("errors.down"),
- type: "is-info",
- });
- });
- this.axios
- .get(
- process.env.VUE_APP_APIENDPOINT +
- process.env.VUE_APP_APIVERSION +
- "/" +
- "userinfo"
- )
- .then((res) => {
- this.$store.commit("setUsername", res.data.username);
- 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.$store.commit("setID", res.data.id);
- this.$store.commit("setBot", res.data.bot);
- this.$store.commit("setDescription", res.data.description);
- this.$store.commit("setExecutive", res.data.executive);
- this.settings.general.description.value = res.data.description;
- this.loading = false;
- })
- .catch(() => {
- this.$buefy.snackbar.open({
- message: this.$t("errors.authFail"),
- type: "is-warning",
- });
- this.loading = false;
- });
- },
- },
- mounted() {
- Object.assign(axios.defaults, {
- headers: { Authorization: this.$store.state.user.token },
- });
- this.axios
.get(
- process.env.VUE_APP_APIENDPOINT +
+ process.env.VUE_APP_APIENDPOINT +
process.env.VUE_APP_APIVERSION +
"/" +
"kaverti/state"
@@ -732,9 +663,9 @@ export default {
type: "is-info",
});
});
- this.axios
+ this.axios
.get(
- process.env.VUE_APP_APIENDPOINT +
+ process.env.VUE_APP_APIENDPOINT +
process.env.VUE_APP_APIVERSION +
"/" +
"userinfo"
@@ -758,21 +689,72 @@ export default {
type: "is-warning",
});
this.loading = false;
- console.log(this.getBannerId());
});
+ },
+ },
+ mounted() {
+ Object.assign(axios.defaults, {
+ headers: { Authorization: this.$store.state.user.token },
+ });
+ this.axios
+ .get(
+ process.env.VUE_APP_APIENDPOINT +
+ process.env.VUE_APP_APIVERSION +
+ "/" +
+ "kaverti/state"
+ )
+ .then((res) => {
+ this.$store.commit("setSettings", res.data.state);
+ this.$store.commit("setVersion", res.data.state.latestCanaryVersion);
+ this.$store.commit("setAPIVersion", res.data.apiVersion);
+ })
+ .catch(() => {
+ this.$buefy.snackbar.open({
+ message: this.$t("errors.down"),
+ type: "is-info",
+ });
+ });
+ this.axios
+ .get(
+ process.env.VUE_APP_APIENDPOINT +
+ process.env.VUE_APP_APIVERSION +
+ "/" +
+ "userinfo"
+ )
+ .then((res) => {
+ this.$store.commit("setUsername", res.data.username);
+ 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.$store.commit("setID", res.data.id);
+ this.$store.commit("setBot", res.data.bot);
+ this.$store.commit("setDescription", res.data.description);
+ this.$store.commit("setExecutive", res.data.executive);
+ this.settings.general.description.value = res.data.description;
+ this.loading = false;
+ })
+ .catch(() => {
+ this.$buefy.snackbar.open({
+ message: this.$t("errors.authFail"),
+ type: "is-warning",
+ });
+ this.loading = false;
+ console.log(this.getBannerId());
+ });
this.$nextTick(() => {
this.dailyReward(false);
this.showUpdate();
this.axios
- .get(
- process.env.VUE_APP_APIENDPOINT +
- process.env.VUE_APP_APIVERSION +
- "/" +
- "relationships/getAllPendingCanAccept"
- )
- .then((res) => {
- this.friendCount = res.data.count;
- });
+ .get(
+ process.env.VUE_APP_APIENDPOINT +
+ process.env.VUE_APP_APIVERSION +
+ "/" +
+ "relationships/getAllPendingCanAccept"
+ )
+ .then((res) => {
+ this.friendCount = res.data.count;
+ });
});
},
};
diff --git a/src/main.js b/src/main.js
index 0b6101d..a58f694 100644
--- a/src/main.js
+++ b/src/main.js
@@ -1,68 +1,69 @@
-import Vue from 'vue'
-import App from './App.vue'
-import router from './router'
-import store from './store'
-import Buefy, {Snackbar} from 'buefy'
-import axios from 'axios'
-import VueAxios from 'vue-axios'
-import i18n from './i18n'
-import moment from 'moment'
-import VMdEditor from '@kangc/v-md-editor';
-import '@kangc/v-md-editor/lib/style/base-editor.css';
-import enUS from '@kangc/v-md-editor/lib/lang/en-US';
-import createHljsTheme from '@kangc/v-md-editor/lib/theme/hljs';
-import json from 'highlight.js/lib/languages/json';
+import Vue from "vue";
+import App from "./App.vue";
+import router from "./router";
+import store from "./store";
+import Buefy, { Snackbar } from "buefy";
+import axios from "axios";
+import VueAxios from "vue-axios";
+import i18n from "./i18n";
+import moment from "moment";
+import VMdEditor from "@kangc/v-md-editor";
+import "@kangc/v-md-editor/lib/style/base-editor.css";
+import enUS from "@kangc/v-md-editor/lib/lang/en-US";
+import createHljsTheme from "@kangc/v-md-editor/lib/theme/hljs";
+import json from "highlight.js/lib/languages/json";
const hljsTheme = createHljsTheme();
-import io from 'socket.io-client'
+import io from "socket.io-client"
import VueSocketIO from "vue-socket.io";
import NProgress from "vue-nprogress";
-Vue.use(NProgress)
-const nprogress = new NProgress()
+
+Vue.use(NProgress);
+const nprogress = new NProgress();
Vue.use(
new VueSocketIO({
- debug: true,
- connection: io(process.env.VUE_APP_GATEWAYENDPOINT), // options object is Optional
+ debug: true,
+ connection: io(process.env.VUE_APP_GATEWAYENDPOINT), // options object is Optional
})
);
-Vue.use(VMdEditor)
-VMdEditor.lang.use('en-US', enUS);
+Vue.use(VMdEditor);
+Vue.use(VueAxios, axios);
+Vue.use(Buefy);
+
+// Axios Headers
+const jwtToken = localStorage.getItem("token");
+axios.defaults.headers.common["Authorization"] = jwtToken;
+
+Vue.config.productionTip = false;
+Vue.prototype.$snackbar = Snackbar;
+
+// BBCode Configuration
+VMdEditor.lang.use("en-US", enUS);
hljsTheme.extend((md, hljs) => {
- md.set({
- html: false, // Enable HTML tags in source
- xhtmlOut: false, // Use '/' to close single tags (
).
- // This is only for full CommonMark compatibility.
- breaks: true, // Convert '\n' in paragraphs into
- langPrefix: 'language-', // CSS language prefix for fenced blocks. Can be
- // useful for external highlighters.
- linkify: true, // Autoconvert URL-like text to links
- image: false,
-
- // Enable some language-neutral replacement + quotes beautification
- typographer: true,
-
- // Double + single quotes replacement pairs, when typographer enabled,
- // and smartquotes on. Could be either a String or an Array.
- //
- // For example, you can use '«»„“' for Russian, '„“‚‘' for German,
- // and ['«\xA0', '\xA0»', '‹\xA0', '\xA0›'] for French (including nbsp).
- quotes: '“”‘’'
- })
- md.disable('image')
- hljs.registerLanguage('json', json);
+ md.set({
+ html: false,
+ xhtmlOut: false,
+ breaks: true,
+ langPrefix: "language-",
+ linkify: true,
+ image: false,
+ typographer: true,
+ quotes: "“”‘’"
+ });
+ md.disable("image");
+ hljs.registerLanguage("json", json);
});
-Vue.use(VueAxios, axios)
-Vue.use(Buefy)
-Vue.config.productionTip = false
-Vue.prototype.$snackbar = Snackbar
-Vue.filter('formatDate', function(value) {
- if (value) {
- return moment(String(value)).format('hh:mm A, DD/MM/YYYY')
- }
-})
+
+// Date Format Configuration
+Vue.filter("formatDate", function(value) {
+ if (value) {
+ return moment(String(value)).format("hh:mm A, DD/MM/YYYY");
+ }
+});
+
new Vue({
- nprogress,
- router,
- store,
- i18n,
- render: h => h(App)
-}).$mount('#app')
+ nprogress,
+ router,
+ store,
+ i18n,
+ render: h => h(App)
+}).$mount("#app");
\ No newline at end of file
diff --git a/src/views/Forums.vue b/src/views/Forums.vue
index 077a803..9fda3fa 100644
--- a/src/views/Forums.vue
+++ b/src/views/Forums.vue
@@ -27,12 +27,12 @@
>
-