Skip to content

Commit

Permalink
3.11.21
Browse files Browse the repository at this point in the history
  • Loading branch information
green1052 committed Jan 11, 2025
1 parent 8ea976c commit 75e1867
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dcrefresher-reborn",
"version": "3.11.20",
"version": "3.11.21",
"description": "디시인사이드 개선 확장 프로그램",
"devDependencies": {
"@swc/core": "^1.10.7",
Expand Down
7 changes: 5 additions & 2 deletions src/core/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ const InternalUpdateMode = (
* @param type 차단 종류
* @param content 차단 내용
* @param isRegex 정규식인지에 대한 여부
* @param isAdvanced 고급 차단인지에 대한 여부
* @param gallery 특정 갤러리에만 해당하면 갤러리의 ID 값
* @param extra 차단 목록에서의 식별을 위한 추가 값
* @param mode 차단 모드
Expand All @@ -176,6 +177,7 @@ export const add = (
type: RefresherBlockType,
content: string,
isRegex: boolean,
isAdvanced: boolean,
gallery?: string,
extra?: string,
mode?: RefresherBlockDetectMode
Expand All @@ -190,7 +192,7 @@ export const add = (
", "
)}]`;

InternalAddToList(type, content, isRegex, gallery, extra, mode);
InternalAddToList(type, content, isRegex, isAdvanced, gallery, extra, mode);

try {
SendToBackground();
Expand Down Expand Up @@ -317,6 +319,7 @@ export const setStore = (store: BlockCache, mode: BlockModeCache): void => {
key as RefresherBlockType,
block.content,
block.isRegex,
block.isAdvanced,
block.gallery,
block.extra,
block.mode
Expand Down Expand Up @@ -357,7 +360,7 @@ communicate.addHook("updateBlocks", (data) => {
requestAnimationFrame(async () => {
storage.get<string[]>("refresher.blockQueue").then((value) => {
for (const dccon of value) {
InternalAddToList("DCCON", dccon, false);
InternalAddToList("DCCON", dccon, false, false);
}
});

Expand Down
35 changes: 34 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {modules} from "./core/modules";
import "./core/block";

import "./core/updateCheck";
import * as storage from "./utils/storage";

console.log("🍊⚓ Initializing DCRefresher Reborn.");

Expand All @@ -17,4 +18,36 @@ Promise
const took = (performance.now() - loadStart).toFixed(2);
console.log(`🍊✔️ DCRefresher Reborn Module Loaded. took ${took}ms.`);
filter.run();
});
});


(async () => {
const BLOCK_NAMESPACE = "__REFRESHER_BLOCK";

const BLOCK_TYPES_KEYS: RefresherBlockType[] = [
"NICK",
"ID",
"IP",
"TITLE",
"TEXT",
"COMMENT",
"DCCON",
"TAB",
"IMAGE"
];

BLOCK_TYPES_KEYS.forEach(async (key) => {
const keyCache = await storage.get<RefresherBlockValue[]>(
`${BLOCK_NAMESPACE}:${key}`
);

keyCache.forEach((value) => {
value.isAdvanced ??= false;
});

await storage.set(
`${BLOCK_NAMESPACE}:${key}`,
keyCache
);
});
})();
5 changes: 4 additions & 1 deletion src/modules/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ export default {
"DCCON",
path,
false,
false,
undefined,
`${title} [${packageIdx}]`
);
Expand All @@ -273,6 +274,7 @@ export default {
"DCCON",
`^(${list.join("|")})$`,
true,
false,
undefined,
`[묶음] ${title} [${packageIdx}]`
);
Expand All @@ -291,6 +293,7 @@ export default {
"DCCON",
code,
false,
false,
undefined,
`${title} [${packageIdx}]`
);
Expand Down Expand Up @@ -319,7 +322,7 @@ export default {

if (!value || !extra) return;

block.add(type, value, false, undefined, extra);
block.add(type, value, false, false, undefined, extra);
Toast.show(
`${block.TYPE_NAMES[type]} ${value}을(를) 차단했습니다.`,
false,
Expand Down

0 comments on commit 75e1867

Please sign in to comment.