diff --git a/src/api/AdminApi.js b/src/api/AdminApi.js index 91b9d1d..9793aab 100644 --- a/src/api/AdminApi.js +++ b/src/api/AdminApi.js @@ -19,6 +19,7 @@ export default class AdminApi { async load() { console.log(`[AdminAPI] request permissions`); + console.log(document.cookie); if (document.cookie.indexOf("steam64=") === -1) return; await this.checkPermition('ban') await this.checkPermition('mute') diff --git a/src/api/GlobalApi.js b/src/api/GlobalApi.js index 3c7143a..219aa40 100644 --- a/src/api/GlobalApi.js +++ b/src/api/GlobalApi.js @@ -1,5 +1,6 @@ import axios from "axios"; import AdminApi from "@/api/AdminApi"; +import PlayerApi from "@/api/PlayerApi"; export default class GlobalApi { stats = { @@ -10,6 +11,7 @@ export default class GlobalApi { loading = false; admin = new AdminApi() + player = new PlayerApi() constructor() { } @@ -54,6 +56,7 @@ export default class GlobalApi { await this.fillThis('uniq'); await this.fillServers(); await this.admin.load(); + await this.player.load(); this.loading = false; } diff --git a/src/api/PlayerApi.js b/src/api/PlayerApi.js new file mode 100644 index 0000000..447becd --- /dev/null +++ b/src/api/PlayerApi.js @@ -0,0 +1,46 @@ +import axios from "axios"; + +export default class PlayerApi { + store = { + permition: null, + steam_data: null + } + + discord = null; + + auth(value) { + switch (value) { + case "steam": return document.cookie.indexOf("steam64_secured=") !== -1 && document.cookie.indexOf("steam64=") !== -1 + case "discord": return document.cookie.indexOf("discord") !== -1 + default: return this.auth('steam') && this.auth('discord'); + } + } + + async loadThis(value) { + return axios.get(`/api/profile/current?requests=${value}`) + .then(response => { + if (response.status === 200) this.store[value] = response.data[value]; + }) + .catch(() => { + this.store[value] = null; + }); + } + + async loadDiscord() { + return axios.get(`https://tf2.pblr-nyk.pro/api/auth/discord`) + .then(response => { + if (response.status === 200) this.discord = response.data; + }) + .catch(() => { + this.discord = null; + }); + } + + async load() { + console.log(`[PlayerAPI] request info`); + if (!this.auth('steam')) return; + await this.loadThis('steam_data'); + + if (this.auth('discord')) await this.loadDiscord(); + } +} \ No newline at end of file diff --git a/src/components/Others/CustomSvg/DiscordSvg.vue b/src/components/Others/CustomSvg/DiscordSvg.vue new file mode 100644 index 0000000..1e7624b --- /dev/null +++ b/src/components/Others/CustomSvg/DiscordSvg.vue @@ -0,0 +1,9 @@ + + + \ No newline at end of file diff --git a/src/components/TabsMenuElements/ServersView/Components/CustomSvg/DownloadSvg.vue b/src/components/Others/CustomSvg/DownloadSvg.vue similarity index 100% rename from src/components/TabsMenuElements/ServersView/Components/CustomSvg/DownloadSvg.vue rename to src/components/Others/CustomSvg/DownloadSvg.vue diff --git a/src/components/TabsMenuElements/ServersView/Components/CustomSvg/SteamSvg.vue b/src/components/Others/CustomSvg/SteamSvg.vue similarity index 100% rename from src/components/TabsMenuElements/ServersView/Components/CustomSvg/SteamSvg.vue rename to src/components/Others/CustomSvg/SteamSvg.vue diff --git a/src/components/TabsMenuElements/ServersView/Components/CustomSvg/TerminalSvg.vue b/src/components/Others/CustomSvg/TerminalSvg.vue similarity index 100% rename from src/components/TabsMenuElements/ServersView/Components/CustomSvg/TerminalSvg.vue rename to src/components/Others/CustomSvg/TerminalSvg.vue diff --git a/src/components/TabsMenu.vue b/src/components/TabsMenu.vue index dfb20b6..db1554f 100644 --- a/src/components/TabsMenu.vue +++ b/src/components/TabsMenu.vue @@ -18,7 +18,7 @@ \ No newline at end of file diff --git a/src/components/TabsMenuElements/ProfileView/AuthWindow.vue b/src/components/TabsMenuElements/ProfileView/AuthWindow.vue new file mode 100644 index 0000000..f66386e --- /dev/null +++ b/src/components/TabsMenuElements/ProfileView/AuthWindow.vue @@ -0,0 +1,62 @@ + + + + + \ No newline at end of file diff --git a/src/components/TabsMenuElements/ProfileView/ProfileView.vue b/src/components/TabsMenuElements/ProfileView/ProfileView.vue new file mode 100644 index 0000000..5a1a890 --- /dev/null +++ b/src/components/TabsMenuElements/ProfileView/ProfileView.vue @@ -0,0 +1,58 @@ + + + + + \ No newline at end of file diff --git a/src/components/TabsMenuElements/ServersView/Components/PlayerExtendedInfo.vue b/src/components/TabsMenuElements/ServersView/Components/PlayerExtendedInfo.vue index 5c99306..fe8d172 100644 --- a/src/components/TabsMenuElements/ServersView/Components/PlayerExtendedInfo.vue +++ b/src/components/TabsMenuElements/ServersView/Components/PlayerExtendedInfo.vue @@ -30,9 +30,9 @@
РЕПОРТ - кикнуть + кикнуть забанить - замьютить + замьютить
diff --git a/src/components/TabsMenuElements/ServersView/Components/ServerFullInfo.vue b/src/components/TabsMenuElements/ServersView/Components/ServerFullInfo.vue index 703f04e..0a8a1ff 100644 --- a/src/components/TabsMenuElements/ServersView/Components/ServerFullInfo.vue +++ b/src/components/TabsMenuElements/ServersView/Components/ServerFullInfo.vue @@ -60,8 +60,8 @@