mirror of
https://github.com/PhaseII-eAmusement-Network/PhaseWeb3-Vue.git
synced 2026-09-10 10:15:14 -05:00
Add in more greetings, finish remote integrations.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
VITE_API_URL="http://10.5.7.5:8000/"
|
||||
VITE_API_KEY="your_api_key_should_be_here"
|
||||
VITE_ASSET_PATH="/assets"
|
||||
VITE_DISCORD_OAUTH_URL="https://discord.com/api/oauth2/authorize?client_id=947985989421395988&redirect_uri=https%3A%2F%2Fphaseii.network%2Faccount%2Fdiscord_callback&response_type=code&scope=identify"
|
||||
VITE_TACHI_OAUTH_URL="https://kamai.tachi.ac/oauth/request-auth?clientID=CI820ca69046783e9fb4cc7d616f985ea2cab00f5f"
|
||||
VITE_DISCORD_OAUTH_URL="https://discord.com/oauth2/authorize?client_id=947985989421395988&response_type=code&redirect_uri=http%3A%2F%2Flocalhost%3A5173%2F%23%2Fprofile%2Fintegrate%2Fdiscord&scope=identify"
|
||||
VITE_TACHI_OAUTH_URL="https://kamai.tachi.ac/oauth/request-auth?clientID=CIb72d1ff81fcfdc001ead8bde3a0ae1a7e0663a37"
|
||||
@@ -1,5 +1,5 @@
|
||||
VITE_API_URL="https://restfulsleep.phaseii.network"
|
||||
VITE_API_KEY="your_api_key_should_be_here"
|
||||
VITE_ASSET_PATH="https://cdn.phaseii.network/file/PhaseII/web-assets"
|
||||
VITE_DISCORD_OAUTH_URL=""
|
||||
VITE_TACHI_OAUTH_URL=""
|
||||
VITE_DISCORD_OAUTH_URL="https://discord.com/oauth2/authorize?client_id=947985989421395988&response_type=code&redirect_uri=https%3A%2F%2Fweb3.phaseii.network%2F%23%2Fprofile%2Fintegrate%2Fdiscord&scope=identify"
|
||||
VITE_TACHI_OAUTH_URL="https://kamai.tachi.ac/oauth/request-auth?clientID=CIce4260e1939ceed11c8e48ee857a3aef2a87ba56"
|
||||
@@ -383,5 +383,40 @@
|
||||
"author": "caldenzer",
|
||||
"header": "YO YO YO YO YO WHAT IT IS <username>",
|
||||
"comment": "hey pac man, what's up?"
|
||||
},
|
||||
{
|
||||
"author": "calgamer",
|
||||
"header": "You should probably play Time Crisis instead, <username>",
|
||||
"comment": "Time Crisis is pretty good.."
|
||||
},
|
||||
{
|
||||
"author": "caldoora",
|
||||
"header": "Did you have a good LovePlus Date, <username>",
|
||||
"comment": "I hope you did."
|
||||
},
|
||||
{
|
||||
"author": "Azui",
|
||||
"header": "Lock in, <username>!",
|
||||
"comment": "More seconds you spend picking a song means less time for MFCs!"
|
||||
},
|
||||
{
|
||||
"author": "Yonokid",
|
||||
"header": "⠀⠀<span style=margin: auto;\"><username></style>",
|
||||
"comment": "⠀⠀⠀⠀⠀How do I center it"
|
||||
},
|
||||
{
|
||||
"author": "timeripple",
|
||||
"header": "Up freaking your guitar <username>?",
|
||||
"comment": "Or got that mania for drums?"
|
||||
},
|
||||
{
|
||||
"author": "Anonymous",
|
||||
"header": "Let’s enjoy music, <username>!",
|
||||
"comment": ""
|
||||
},
|
||||
{
|
||||
"author": "timeripple",
|
||||
"header": "phasing on <username>'s II til they network",
|
||||
"comment": "networking on my phase til i II?"
|
||||
}
|
||||
]
|
||||
@@ -66,6 +66,14 @@ const routes = [
|
||||
name: "profile_integrations",
|
||||
component: () => import("@/views/Profile/IntegrationView.vue"),
|
||||
},
|
||||
{
|
||||
meta: {
|
||||
title: "Integration Callback",
|
||||
},
|
||||
path: "/profile/integrate/:service",
|
||||
name: "profile_integration_callback",
|
||||
component: () => import("@/views/Profile/IntegrationView.vue"),
|
||||
},
|
||||
{
|
||||
meta: {
|
||||
title: "Login Cards",
|
||||
|
||||
@@ -113,3 +113,31 @@ export async function APIGetPlayVideos() {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function APIRemoveIntegration(service) {
|
||||
try {
|
||||
const confirmed = window.confirm("Are you really?");
|
||||
if (confirmed) {
|
||||
const data = await mainStore.callApi(
|
||||
`/user/integrate/${service}`,
|
||||
"DELETE"
|
||||
);
|
||||
return data;
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("Error deleting integration:", error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function APIIntegrateWith(service, code) {
|
||||
try {
|
||||
const data = await mainStore.callApi(`/user/integrate/${service}`, "POST", {
|
||||
code: code,
|
||||
});
|
||||
return data;
|
||||
} catch (error) {
|
||||
console.log(`Error integrating with ${service}:`, error);
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,8 @@ export function saveUserAuthKey(sessionId, expires) {
|
||||
try {
|
||||
Cookies.set("userAuthKey", sessionId, {
|
||||
expires: expires,
|
||||
path: "",
|
||||
sameSite: "strict",
|
||||
});
|
||||
} catch (error) {
|
||||
this.errorCode = error.message;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<script setup>
|
||||
import { useMainStore } from "@/stores/main";
|
||||
import { ref, watch } from "vue";
|
||||
import { useRoute, useRouter } from "vue-router";
|
||||
import { mdiServerNetwork, mdiMessage, mdiScoreboard } from "@mdi/js";
|
||||
import SectionMain from "@/components/SectionMain.vue";
|
||||
import CardBox from "@/components/CardBox.vue";
|
||||
@@ -9,8 +10,24 @@ import UserCard from "@/components/UserCard.vue";
|
||||
import LayoutAuthenticated from "@/layouts/LayoutAuthenticated.vue";
|
||||
import SectionTitleLine from "@/components/SectionTitleLine.vue";
|
||||
import PillTag from "@/components/PillTag.vue";
|
||||
|
||||
import { APIRemoveIntegration, APIIntegrateWith } from "@/stores/api/account";
|
||||
|
||||
const $route = useRoute();
|
||||
const $router = useRouter();
|
||||
const DISCORD_OAUTH_URL = import.meta.env.VITE_DISCORD_OAUTH_URL;
|
||||
const TACHI_OAUTH_URL = import.meta.env.VITE_TACHI_OAUTH_URL;
|
||||
const serviceType = ref($route.params.service);
|
||||
|
||||
if (serviceType.value) {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const code = urlParams.get("code");
|
||||
urlParams.delete("code");
|
||||
if (code !== undefined) {
|
||||
console.log(code);
|
||||
integrateWith(serviceType.value, code);
|
||||
}
|
||||
}
|
||||
|
||||
const mainStore = useMainStore();
|
||||
|
||||
@@ -37,10 +54,32 @@ const services = [
|
||||
},
|
||||
];
|
||||
|
||||
function removeService(service) {
|
||||
const confirmed = window.confirm("Are you really?");
|
||||
if (confirmed) {
|
||||
console.log(`get fucked, ${service.id}`);
|
||||
async function removeService(service) {
|
||||
const removal_data = await APIRemoveIntegration(service.id);
|
||||
if (removal_data) {
|
||||
mainStore.userLoaded = false;
|
||||
mainStore.loadUser();
|
||||
$router.push({
|
||||
name: "profile_integrations",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
async function integrateWith(service, code) {
|
||||
const resp_data = await APIIntegrateWith(service, code);
|
||||
if (resp_data) {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
urlParams.delete("code");
|
||||
const newQuery = urlParams.toString();
|
||||
const newUrl = `${window.location.pathname}${
|
||||
newQuery ? "?" + newQuery : ""
|
||||
}`;
|
||||
window.history.replaceState(null, "", newUrl);
|
||||
mainStore.userLoaded = false;
|
||||
mainStore.loadUser();
|
||||
$router.push({
|
||||
name: "profile_integrations",
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -75,7 +114,7 @@ function removeService(service) {
|
||||
v-if="!userData[service.id] || !userData[service.id]?.linked"
|
||||
class="text-lg"
|
||||
>
|
||||
Discord isn't linked!
|
||||
{{ service.name }} isn't linked!
|
||||
</h1>
|
||||
|
||||
<template #footer>
|
||||
|
||||
Reference in New Issue
Block a user