diff --git a/hwe/sammo/API/Message/GetRecentMessage.php b/hwe/sammo/API/Message/GetRecentMessage.php
index 815ba283..b157fcc1 100644
--- a/hwe/sammo/API/Message/GetRecentMessage.php
+++ b/hwe/sammo/API/Message/GetRecentMessage.php
@@ -29,7 +29,7 @@ class GetRecentMessage extends \sammo\BaseAPI
public function getRequiredSessionMode(): int
{
- return static::REQ_GAME_LOGIN;
+ return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
}
private function delayFrequentCall(Session $session): void
diff --git a/hwe/ts/components/MessagePanel.vue b/hwe/ts/components/MessagePanel.vue
index 32e01ff1..287b191e 100644
--- a/hwe/ts/components/MessagePanel.vue
+++ b/hwe/ts/components/MessagePanel.vue
@@ -20,18 +20,45 @@
메시지가 없습니다.
+
@@ -42,6 +69,10 @@ import { SammoAPI } from "@/SammoAPI";
import { isString } from "lodash";
import type { MsgItem, MsgResponse, MsgType } from "@/defs/API/Message";
import MessagePlate from "@/components/MessagePlate.vue";
+import { useToast } from "bootstrap-vue-3";
+import { unwrap } from "@/util/unwrap";
+
+const toasts = unwrap(useToast());
const emit = defineEmits<{
(event: "request-refresh"): void;
@@ -66,7 +97,7 @@ onMounted(() => {
const lastSequence = ref(-1);
-const initRefreshLimit = 5;
+const initRefreshLimit = 20;
let refreshLimit = initRefreshLimit;
const refreshP: Set> = new Set();
let lastRefreshDone = 0;
@@ -93,11 +124,11 @@ function updateMsgResponse(response: MsgResponse) {
}
}
- if(response.generalName != generalName.value){
+ if (response.generalName != generalName.value) {
emit("request-refresh");
return;
}
- if(response.nationID != nationID.value){
+ if (response.nationID != nationID.value) {
emit("request-refresh");
return;
}
@@ -107,7 +138,6 @@ function updateMsgResponse(response: MsgResponse) {
for (const msgType of Object.keys(messageIndexedList) as (keyof typeof messageIndexedList)[]) {
const msgList = messageIndexedList[msgType];
-
const newMsgList = response[msgType];
console.log(msgType, msgList, newMsgList);
if (newMsgList.length == 0) {
@@ -171,11 +201,19 @@ function beginRefreshTimer() {
if (refreshP.size > refreshLimit && refreshTimer) {
clearInterval(refreshTimer);
refreshTimer = null;
- alert("서버 응답이 없습니다. 새로고침을 해주세요.");
+ toasts.danger(
+ {
+ title: "메시지 자동 갱신 실패",
+ body: "서버 응답이 없습니다. 새로고침을 해주세요.",
+ },
+ {
+ delay: 1000 * 3600,
+ }
+ );
return;
}
- refreshP.add(tryRefresh());
+ void tryRefresh();
}
}, 2500);
}
@@ -196,15 +234,17 @@ async function tryRefresh() {
if (lastRefreshDone < now) {
lastRefreshDone = now;
}
-
} catch (e) {
if (isString(e)) {
- alert(e);
+ toasts.warning({
+ title: '갱신 실패',
+ body: e,
+ });
}
console.error(e);
}
- if(!response){
+ if (!response) {
return false;
}
@@ -214,6 +254,7 @@ async function tryRefresh() {
})();
void waiterP.then((result) => {
if (!result) {
+ console.error("?! result");
refreshLimit--;
} else {
refreshLimit = initRefreshLimit;