diff --git a/islands/TalkListContent.tsx b/islands/TalkListContent.tsx
index d965c9b5..492e2175 100644
--- a/islands/TalkListContent.tsx
+++ b/islands/TalkListContent.tsx
@@ -141,39 +141,7 @@ function TalkListContent({ state }: { state: AppStateType }) {
}}
/>
{settingPage.value === 2 && (
- <>
-
-
-
- {
- settingPage.value = 0;
- }}
- >
- ×
-
-
-
-
-
- >
+
)}
{settingPage.value === 1 && (
<>
@@ -315,5 +283,72 @@ function TalkListContent({ state }: { state: AppStateType }) {
}
return <>>;
}
-
+function OtherSettingPage({ settingPage }: { settingPage: any }) {
+ const addFriendById = useSignal(false);
+ const allowOtherServerUsers = useSignal(false);
+ useEffect(() => {
+ async function run() {
+ const res = await fetch("/api/v2/client/users/settings")
+ const json = await res.json();
+ addFriendById.value = json.settings.addFriendById;
+ allowOtherServerUsers.value = json.settings.allowOtherServerUsers;
+ }
+ run();
+ }, []);
+ return (
+ <>
+
+
+
+ {
+ settingPage.value = 0;
+ }}
+ >
+ ×
+
+
+
+
その他の設定
+
+
+
+
+
+
+
+ >
+ );
+}
export default TalkListContent;
diff --git a/models/userConfig.ts b/models/userConfig.ts
index 7b669c32..b0418dd7 100644
--- a/models/userConfig.ts
+++ b/models/userConfig.ts
@@ -13,7 +13,7 @@ export const friendConfigSchama = new mongoose.Schema({
blockUsers: {
type: [String],
required: true,
- default : [],
+ default: [],
validate: {
validator: function (v: string[]) {
const unique = new Set(v);
@@ -25,7 +25,7 @@ export const friendConfigSchama = new mongoose.Schema({
blockServers: {
type: [String],
required: true,
- default : [],
+ default: [],
validate: {
validator: function (v: string[]) {
const unique = new Set(v);
diff --git a/routes/api/v2/client/users/settings.ts b/routes/api/v2/client/users/settings.ts
index 44603062..6df69df1 100644
--- a/routes/api/v2/client/users/settings.ts
+++ b/routes/api/v2/client/users/settings.ts
@@ -4,21 +4,28 @@
import users from "../../../../../models/users.ts";
import userConfig from "../../../../../models/userConfig.ts";
export const handler = {
- async GET(req: Request, ctx: any) {
- if (!ctx.state.data.loggedIn) {
- return ctx.json({ status: false, message: "You are not logged in" });
- }
- const userid = ctx.state.data.userid;
- const config = await userConfig.findOne({ userid: userid });
- if (!config) {
- await userConfig.create({ userid: userid, addFriendById: true, allowOtherServerUsers: true });
- }
- return new Response(JSON.stringify({ status: true, message: "Success", settings: {
- addFriendById: config?.addFriendById,
- allowOtherServerUsers: config?.allowOtherServerUsers,
- } }), {
+ async GET(req: Request, ctx: any) {
+ if (!ctx.state.data.loggedIn) {
+ return ctx.json({ status: false, message: "You are not logged in" });
+ }
+ const userid = ctx.state.data.userid;
+ const config = await userConfig.findOne({ userid: userid });
+ if (!config) {
+ await userConfig.create({ userid: userid, addFriendById: true, allowOtherServerUsers: true });
+ }
+ return new Response(
+ JSON.stringify({
+ status: true,
+ message: "Success",
+ settings: {
+ addFriendById: config?.addFriendById,
+ allowOtherServerUsers: config?.allowOtherServerUsers,
+ },
+ }),
+ {
headers: { "Content-Type": "application/json" },
status: 200,
- });
- },
-}
\ No newline at end of file
+ },
+ );
+ },
+};