Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v2.16.4 #228

Merged
merged 12 commits into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/(Layout)/desktop/HeaderBar/HeaderBar.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ $logoBG: rgba(0, 190, 245, 35%);
height: 3.7rem;
width: 85dvw;
margin: 2rem auto;
margin-bottom: 0;

display: flex;
flex-direction: row;
Expand All @@ -13,8 +14,8 @@ $logoBG: rgba(0, 190, 245, 35%);
cursor: default;
user-select: none;

& > img {
&>img {
margin: auto 0;
cursor: pointer;
}
}
}
12 changes: 7 additions & 5 deletions app/(Layout)/splitBlock.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@

.app {
width: 90dvw;
height: 65dvh;
max-height: 65dvh;
height: 70dvh;
// max-height: 70dvh;
border-radius: 1.8rem;
margin: auto;
margin-left: auto;
margin-right: auto;

display: grid;
grid-gap: 1.2rem;
grid-gap: 1rem;
grid-template-columns: repeat(10, 1fr);
grid-auto-rows: 1fr;

Expand All @@ -21,7 +22,8 @@
background-color: transparent;
grid-column: span 7;
max-width: 90dvw;
max-height: 65dvh;
// max-height: 70dvh;
height: 100%;
border-radius: $border-radius;

overflow-y: auto;
Expand Down
4 changes: 2 additions & 2 deletions app/(home)/desktop/Information.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const Information = () => {
})();
}, []);

const pageSize = 5;
const pageSize = 3;
const { data, isLoading } = useTopPost({ pageSize });

if (isLoading) {
Expand All @@ -67,7 +67,7 @@ const Information = () => {
<div className={style.information}>
<div className={style.wrapper}>
<div className={style.likedPosts}>
<h2>Top 5 Posts</h2>
<h2>Top 3 Posts</h2>
<div className={style.likePostWrapper}>
{data?.pages[0].map((item: TThread) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion app/(home)/desktop/ThreadsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const ThreadsList = () => {
) : (
<InfinityThreadsList
data={data}
height="65dvh"
height="70dvh"
fetchNextPage={fetchNextPage}
isFetchingNextPage={isFetchingNextPage}
announcementData={announcementData}
Expand Down
4 changes: 2 additions & 2 deletions app/[userID]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ function UserInfinityThreadList({ id }: { id: string }) {
) : (
<InfinityThreadsList
data={data}
height="65dvh"
height="70dvh"
fetchNextPage={fetchNextPage}
isFetchingNextPage={isFetchingNextPage}
/>
Expand All @@ -111,7 +111,7 @@ function SIGInfinityThreadList({ id }: { id: string }) {
) : (
<InfinityThreadsList
data={data}
height="65dvh"
height="70dvh"
fetchNextPage={fetchNextPage}
isFetchingNextPage={isFetchingNextPage}
/>
Expand Down
16 changes: 7 additions & 9 deletions app/api/auth/[...nextauth]/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ import axios from "axios";
import GoogleProvider from "next-auth/providers/google";

const emoji: { [key: string]: string } = {
"developer": "<:developer:1222933983164235876>",
developer: "<:developer:1222933983164235876>",
"10.21_user": "<:1021user:1222933998913851442>",
"bug_hunter": "<:bughunter:1245079303000031282>",
bug_hunter: "<:bughunter:1245079303000031282>",
};

const handler = NextAuth({
Expand Down Expand Up @@ -47,28 +47,26 @@ const handler = NextAuth({
data.append("code", response.data.code);
data.append("class", response.data.class || "No Class");

if (badges.length > 0) {

if (response.data.badge.length > 0) {
badges[0]?.split(",").forEach((badge: string) => {
badgeData += emoji[badge];
badgeData += " ";
});

}

data.append("badge", badgeData || "No Badge");
data.append("badge", badgeData !== "" ? badgeData : "No Badge");

axios(`${process.env.NEXTAUTH_URL}/api/webhook/login`, {
fetch(`${process.env.NEXTAUTH_URL}/api/webhook/login`, {
method: "POST",
data: data,
body: data,
});
}
}
return true;
},
async jwt({ token, account }) {
const _token = token;
if (account) {
if (account) {
_token.accessToken = account?.access_token;
}

Expand Down
90 changes: 46 additions & 44 deletions app/api/webhook/login/route.ts
Original file line number Diff line number Diff line change
@@ -1,89 +1,91 @@
import axios from "axios";
import { NextRequest, NextResponse } from "next/server";

export async function POST(req : NextRequest) {
export async function POST(req: NextRequest) {
const data = await req.formData();
const content = {
username: "MDSIG Login",
avatar_url: "https://cdn.discordapp.com/attachments/1222932958667870279/1222933028259496080/sig2_pfp__1.png",
avatar_url:
"https://sig.mingdao.edu.tw/images/sig2pfp.png",
embeds: [
{
"title":`${data.get("name")} ${((req.url.includes("localhost")) || (req.url.includes("-dev")) ? "(Development)" : "") }`,
"description": data.get("description"),
"color": parseInt("0x34e718"),
"thumbnail": {
"url": data.get("avatar"),
title: `${data.get("name")} ${req.url.includes("localhost") ? "(Development)" : ""}${req.url.includes("dev") ? "(Development)" : ""}`,
description: data.get("description"),
color: parseInt("0x34e718"),
thumbnail: {
url: data.get("avatar"),
},
"fields": [
fields: [
{
"name": "ID",
"value": data.get("id"),
"inline": true
name: "ID",
value: data.get("id"),
inline: true,
},
{
"name": "Custom ID",
"value": data.get("customId"),
"inline": true
name: "Custom ID",
value: data.get("customId"),
inline: true,
},
{
"name": "Identity",
"value": data.get("identity"),
"inline": true
name: "Identity",
value: data.get("identity"),
inline: true,
},
{
"name": "Email",
"value": data.get("email"),
"inline": true
name: "Email",
value: data.get("email"),
inline: true,
},
{
"name": "Badge",
"value": data.get("badge") || "No Data",
"inline": true
name: "Badge",
value: data.get("badge") || "No Data",
inline: true,
},
{
"name": "\u200b",
"value": "\u200b",
"inline": true
name: "\u200b",
value: "\u200b",
inline: true,
},
{
"name": "Code",
"value": data.get("code"),
"inline": true
name: "Code",
value: data.get("code"),
inline: true,
},
{
"name": "Class",
"value": data.get("class"),
"inline": true
name: "Class",
value: data.get("class"),
inline: true,
},
{
"name": "\u200b",
"value": "\u200b",
"inline": true
name: "\u200b",
value: "\u200b",
inline: true,
},
],
"timestamp": new Date().toISOString(),
"footer": {
"text": "MDSIG 2.0 Login System",
"icon_url": "https://cdn.discordapp.com/attachments/1222932958667870279/1222933028259496080/sig2_pfp__1.png?ex=66180422&is=66058f22&hm=a0229ab4733f6a2c4d2db217500663987351acdee83ff724afcfddc84e61fc45&",
timestamp: new Date().toISOString(),
footer: {
text: "MDSIG 2.0 Login System",
icon_url:
"https://sig.mingdao.edu.tw/images/sig2pfp.png",
},
},
],
};

axios(String(process.env.NEXT_PUBLIC_WEBHOOK_LOGIN),{
axios(String(process.env.NEXT_PUBLIC_WEBHOOK_LOGIN), {
method: "POST",
headers: {
"Content-type": "application/json"
"Content-type": "application/json",
},
data: JSON.stringify(content),
});
return NextResponse.json({ "message": "Request Sent!" });

return NextResponse.json({ message: "Request Sent!" });
}

export const dynamic = "force-dynamic";
export const dynamicParams = false;
export const revalidate = false;
export const fetchCache = "auto";
export const runtime = "nodejs";
export const preferredRegion = "auto";
export const preferredRegion = "auto";
8 changes: 4 additions & 4 deletions app/dashboard/(Dashboard)/Desktop/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

.wrapper {
padding-top: 1.2rem;
max-height: 65dvh;
height: 65dvh;
max-height: 70dvh;
height: 70dvh;
max-width: 60rem;
width: 90dvw;
margin-left: auto;
Expand Down Expand Up @@ -46,7 +46,7 @@
}

.sigChart {
height: calc(65dvh - 7.2rem);
height: calc(70dvh - 7.2rem);
width: 90dvw;
max-width: 60rem;
background-color: $panel-background-color;
Expand All @@ -69,5 +69,5 @@

.chartBar {
height: auto !important;
width: auto !important;
width: 100% !important;
}
1 change: 1 addition & 0 deletions app/data/(Data)/mobile/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@
padding: $mobile-border-radius;
border: 1px solid #003f47;
overflow: hidden;
padding-right: 0.2rem;

&::-webkit-scrollbar {
width: 0.25rem;
Expand Down
16 changes: 11 additions & 5 deletions app/info/(Info)/desktop/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,23 @@ export default function Desktop() {
<p>前端版本號: {(ping && Object.keys(ping).length !== 0) && "v"}{ping?.Frontend?.currentVersion}</p>
<p>後端版本號: {(ping && Object.keys(ping).length !== 0) && "v"}{ping?.Backend?.currentVersion}</p>
<br />
<p>前端運行時間:{ping?.Frontend?.uptime.replace("days,", "天").replace("hours,", "時").replace("minutes,", "分").replace("seconds", "秒").replace("day,", "天").replace("hour,", "時").replace("minute,", "分").replace("second", "秒")}</p>
<p>後端運行時間:{ping?.Backend?.uptime.replace("days,", "天").replace("hours,", "時").replace("minutes,", "分").replace("seconds", "秒").replace("day,", "天").replace("hour,", "時").replace("minute,", "分").replace("second", "秒")}</p>
<p>前端運行時間:{timeEn2Zh(ping?.Frontend?.uptime)}</p>
<p>後端運行時間:{timeEn2Zh(ping?.Backend?.uptime)}</p>
<br />
<p>訪問<Link href={"https://sig-uptime.lazco.dev/status/main"} target="_blank">狀態頁面</Link>獲取更多詳細信息</p>
<p>訪問<Link href={"https://status.sig.school/"} target="_blank">狀態頁面</Link>獲取更多詳細信息</p>
<p className={styles.endText}><Link href={"https://sig.mingdao.edu.tw/ping"} target="_blank">前端</Link></p>
<img src="https://sig-uptime.lazco.dev/api/badge/15/uptime?labelPrefix=前端+&style=for-the-badge" alt="frontend-status" className={styles.statusImg} />
<img src="https://status.sig.school/api/badge/1/uptime?labelPrefix=前端+&style=for-the-badge" alt="frontend-status" className={styles.statusImg} />
<p className={styles.endText}><Link href={"https://sig-api.mingdao.edu.tw/ping"} target="_blank">後端</Link></p>
<img src="https://sig-uptime.lazco.dev/api/badge/5/uptime?labelPrefix=後端+&style=for-the-badge" alt="backend-status" className={styles.statusImg} />
<img src="https://status.sig.school/api/badge/8/uptime?labelPrefix=後端+&style=for-the-badge" alt="backend-status" className={styles.statusImg} />
<p className={styles.endText}>資料庫</p>
<img src="https://status.sig.school/api/badge/6/uptime?labelPrefix=資料庫+&style=for-the-badge" alt="backend-status" className={styles.statusImg} />
</div>
</div>
</div>
</div>
);
}

function timeEn2Zh(time: string) {
return time?.replace("month,", "月").replace("months,", "月").replace("days,", "天").replace("hours,", "時").replace("minutes,", "分").replace("seconds", "秒").replace("day,", "天").replace("hour,", "時").replace("minute,", "分").replace("second", "秒").replace("month", "月").replace("months", "月").replace("days", "天").replace("hours", "時").replace("minutes", "分").replace("day", "天").replace("hour", "時").replace("minute", "分");
}
6 changes: 0 additions & 6 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import { Providers } from "./providers";
import "@/app/styles/globals.scss";

// Utils
import Script from "next/script";
import { Metadata } from "next";
import { Device } from "./device";

Expand All @@ -23,11 +22,6 @@ export default function RootLayout({
}) {
return (
<>
<Script
async
src="https://sig-analytics.lazco.dev/script.js"
data-website-id="e034897b-bce7-4a20-b5e8-4c98ef67e30d"
></Script>
<html lang="en">
<GoogleTagManager gtmId="GTM-NGM7R8S8" />
<body>
Expand Down
2 changes: 1 addition & 1 deletion app/post/[postID]/(post)/mobile/Replies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export default function Replies({ post }: { post: TThread }) {

return (
<div
className={styles.wrapper + (extended ? " h-[65dvh] !bg-white" : " h-[6.5rem]")}
className={styles.wrapper + (extended ? " h-[70dvh] !bg-white" : " h-[6.5rem]")}
onClick={() => {
if (!extended) setExtended(true);
}}>
Expand Down
2 changes: 1 addition & 1 deletion app/styles/globals.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ body {
background: linear-gradient(127deg, rgba(255, 217, 103, 1) 0%, rgb(205, 205, 205) 25%, rgba(116, 197, 233, 1) 50%, rgba(13, 154, 217, 1) 75%, rgba(81, 147, 224, 1) 100%);

display: grid;
grid-template-rows: 15% 70% 15%;
grid-template-rows: 12% 74% 14%;
}

.wrapMobile {
Expand Down
2 changes: 1 addition & 1 deletion components/Information/desktop/Skeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const InformationSkeleton = () => {
<div className={skeleton.information}>
<div className={skeleton.wrapper}>
<div className={skeleton.likedPosts}>
<h2>Top 5 Posts</h2>
<h2>Top 3 Posts</h2>
<div className={skeleton.likePostWrapper}>
{topPost.map((sig, index) => {
return (<TopPost key={index} />);
Expand Down
2 changes: 1 addition & 1 deletion components/PostEditor/desktop/Editor.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$editor-background: white;

.editor {
height: 65dvh;
height: 70dvh;
padding: 0.25rem 0;
background-color: $editor-background;
border-radius: $border-radius;
Expand Down
Loading
Loading