diff --git a/islands/TalkListContent.tsx b/islands/TalkListContent.tsx
index ef5a7904..d965c9b5 100644
--- a/islands/TalkListContent.tsx
+++ b/islands/TalkListContent.tsx
@@ -5,6 +5,7 @@ import GetAddFriendKey from "./getAddFriendKey.tsx";
import FriendRequest from "./FriendRequest.tsx";
import { AppStateType } from "../util/types.ts";
import { useSignal } from "@preact/signals";
+import { useEffect } from "preact/hooks";
function TalkListContent({ state }: { state: AppStateType }) {
if (state.page.value === 0) {
return <>>;
@@ -139,6 +140,41 @@ function TalkListContent({ state }: { state: AppStateType }) {
}
}}
/>
+ {settingPage.value === 2 && (
+ <>
+
+
+
+ {
+ settingPage.value = 0;
+ }}
+ >
+ ×
+
+
+
+
+
+ >
+ )}
{settingPage.value === 1 && (
<>
@@ -203,20 +239,20 @@ function TalkListContent({ state }: { state: AppStateType }) {
info.icon = true;
}
}
- if(icon.name !== "" && nickName !== ""){
- if(info.nickName === true && info.icon === true){
+ if (icon.name !== "" && nickName !== "") {
+ if (info.nickName === true && info.icon === true) {
alert("保存しました");
settingPage.value = 0;
//リロード
window.location.href = "/setting";
}
- if(info.nickName === false && info.icon === true){
+ if (info.nickName === false && info.icon === true) {
alert("ニックネームの保存に失敗しました");
}
- if(info.nickName === true && info.icon === false){
+ if (info.nickName === true && info.icon === false) {
alert("アイコンの保存に失敗しました");
}
- if(info.nickName === false && info.icon === false){
+ if (info.nickName === false && info.icon === false) {
alert("保存に失敗しました");
}
}
diff --git a/models/userConfig.ts b/models/userConfig.ts
index f9be7d00..7b669c32 100644
--- a/models/userConfig.ts
+++ b/models/userConfig.ts
@@ -13,6 +13,7 @@ export const friendConfigSchama = new mongoose.Schema({
blockUsers: {
type: [String],
required: true,
+ default : [],
validate: {
validator: function (v: string[]) {
const unique = new Set(v);
@@ -24,6 +25,7 @@ export const friendConfigSchama = new mongoose.Schema({
blockServers: {
type: [String],
required: true,
+ 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 6fc788db..44603062 100644
--- a/routes/api/v2/client/users/settings.ts
+++ b/routes/api/v2/client/users/settings.ts
@@ -1,3 +1,24 @@
//現在の設定を取得
// GET /api/v2/client/users/settings
// -> { status: boolean, message: string, settings: Settings }
+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,
+ } }), {
+ headers: { "Content-Type": "application/json" },
+ status: 200,
+ });
+ },
+}
\ No newline at end of file