From 240e97a449d0aaf76d2e5fc4603618f4e3cd8c1d Mon Sep 17 00:00:00 2001 From: Win81VMUser Date: Thu, 31 Jul 2025 19:50:20 +0200 Subject: [PATCH] deploy: fc508e45e9f42ef37c1d30bab384f877ca5c7651 --- ReadAll/index.js | 2 +- ReadAll/manifest.json | 2 +- template/index.js | 1 - template/manifest.json | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) delete mode 100644 template/index.js delete mode 100644 template/manifest.json diff --git a/ReadAll/index.js b/ReadAll/index.js index 5c9acaa..e6cfdc6 100644 --- a/ReadAll/index.js +++ b/ReadAll/index.js @@ -1 +1 @@ -(function(p,o,u,f,S){"use strict";let h,v,A,c,m,E,g=null,y=null,C=null,s=0;const d=6e4,T=function(){h=o.findByStoreName("GuildStore"),v=o.findByStoreName("GuildChannelStore")||o.findByStoreName("ChannelStore"),E=o.findByStoreName("ChannelStore"),c=o.findByStoreName("ReadStateStore"),A=o.findByStoreName("ActiveJoinedThreadsStore")||o.findByProps("getActiveJoinedThreadsForGuild"),m=o.findByProps("dispatch","subscribe")||o.findByStoreName("Dispatcher")},b=function(){const a=[],e=E||v;if(!e)return a;if(e.getPrivateChannels)try{const t=e.getPrivateChannels();t&&typeof t=="object"&&Object.values(t).forEach(function(n){n&&n.id&&a.push(n)})}catch{}if(a.length===0&&e.getSortedPrivateChannels)try{const t=e.getSortedPrivateChannels();Array.isArray(t)&&t.forEach(function(n){n&&n.id&&a.push(n)})}catch{}if(a.length===0&&e.getChannels)try{const t=e.getChannels("@me");t&&t.SELECTABLE&&t.SELECTABLE.forEach(function(n){const i=n.channel||n;i&&i.id&&a.push(i)})}catch{}if(a.length===0&&e.getChannel&&c?.getAllReadStates)try{const t=c.getAllReadStates();Object.keys(t).forEach(function(n){try{const i=e.getChannel(n);i&&(i.type===1||i.type===3||!i.guild_id&&!i.guildId)&&a.push(i)}catch{}})}catch{}return a},_=function(){if(!h||!c)return[];const a=[],e=h.getGuilds();return Object.values(e).forEach(function(t){if(t?.id)try{let n=[];const i=v||E;if(i?.getChannels){const r=i.getChannels(t.id);r?.SELECTABLE&&(n=n.concat(r.SELECTABLE)),r?.VOCAL&&(n=n.concat(r.VOCAL))}if(A?.getActiveJoinedThreadsForGuild)try{const r=A.getActiveJoinedThreadsForGuild(t.id),l=Object.values(r).flatMap(function(L){return Object.values(L||{})});n=n.concat(l)}catch{}n.forEach(function(r){const l=r?.channel||r;if(l?.id)try{c.hasUnread&&c.hasUnread(l.id)&&a.push({channelId:l.id,messageId:c.lastMessageId?.(l.id)||null,readStateType:0})}catch{}})}catch{}}),a},I=function(){const a=[];return b().forEach(function(e){if(e?.id)try{let t=!1;if(c.hasUnread&&(t=c.hasUnread(e.id)),!t&&c.getAllReadStates){const n=c.getAllReadStates()[e.id];n&&(t=n.mentionCount&&n.mentionCount>0||n._unreadCount&&n._unreadCount>0||n.unreadCount&&n.unreadCount>0)}t&&a.push({channelId:e.id,messageId:c.lastMessageId?.(e.id)||null,readStateType:0})}catch{}}),a},B=function(a="all"){if(!h||!c||!m)return!1;let e=[],t="";switch(a){case"server":e=_(),t="server";break;case"dm":e=I(),t="DM";break;case"all":default:e=[..._(),...I()],t="";break}if(e.length===0){const i=a==="all"?"No unread notifications found!":`No unread ${t} notifications found!`;return u.showToast(i,f.getAssetIDByName("ic_message_edit")),!0}m.dispatch({type:"BULK_ACK",context:"APP",channels:e});const n=a==="all"?`Cleared ${e.length} unread notifications!`:`Cleared ${e.length} unread ${t} notifications!`;return u.showToast(n,f.getAssetIDByName("ic_message_edit")),!0},N=function(){const a=Date.now(),e=a-s;if(e-1?(e.excludedServers.splice(n,1),v(e),!0):!1},$=function(t){const e=g();return e.excludedDMs.includes(t)?!1:(e.excludedDMs.push(t),v(e),!0)},O=function(t){const e=g(),n=e.excludedDMs.indexOf(t);return n>-1?(e.excludedDMs.splice(n,1),v(e),!0):!1},j=function(t){return g().excludedServers.includes(t)},G=function(t){return g().excludedDMs.includes(t)},J=function(t){try{return u.findByStoreName("GuildStore")?.getGuild?.(t)?.name||`Unknown Server (${t})`}catch{return`Unknown Server (${t})`}},K=function(t){try{const e=u.findByStoreName("ChannelStore")?.getChannel?.(t);if(e){if(e.name)return e.name;if(e.recipients&&e.recipients.length>0){const n=u.findByStoreName("UserStore")?.getUser?.(e.recipients[0]);return n?.username?`@${n.username}`:`Unknown User (${t})`}}return`Unknown DM (${t})`}catch{return`Unknown DM (${t})`}},V=function(){const t=g();t.excludedServers=[],t.excludedDMs=[],v(t)},_=function(){const t=g();return{servers:t.excludedServers.map(function(e){return{id:e,name:J(e)}}),dms:t.excludedDMs.map(function(e){return{id:e,name:K(e)}})}};let p,R,B,l,b,I,x=null,E=null,A=null,D=null,m=0;const y=6e4,Q=function(){p=u.findByStoreName("GuildStore"),R=u.findByStoreName("GuildChannelStore")||u.findByStoreName("ChannelStore"),I=u.findByStoreName("ChannelStore"),l=u.findByStoreName("ReadStateStore"),B=u.findByStoreName("ActiveJoinedThreadsStore")||u.findByProps("getActiveJoinedThreadsForGuild"),b=u.findByProps("dispatch","subscribe")||u.findByStoreName("Dispatcher")},q=function(){const t=[],e=I||R;if(!e)return t;if(e.getPrivateChannels)try{const n=e.getPrivateChannels();n&&typeof n=="object"&&Object.values(n).forEach(function(r){r&&r.id&&t.push(r)})}catch{}if(t.length===0&&e.getSortedPrivateChannels)try{const n=e.getSortedPrivateChannels();Array.isArray(n)&&n.forEach(function(r){r&&r.id&&t.push(r)})}catch{}if(t.length===0&&e.getChannels)try{const n=e.getChannels("@me");n&&n.SELECTABLE&&n.SELECTABLE.forEach(function(r){const a=r.channel||r;a&&a.id&&t.push(a)})}catch{}if(t.length===0&&e.getChannel&&l?.getAllReadStates)try{const n=l.getAllReadStates();Object.keys(n).forEach(function(r){try{const a=e.getChannel(r);a&&(a.type===1||a.type===3||!a.guild_id&&!a.guildId)&&t.push(a)}catch{}})}catch{}return t},N=function(){if(!p||!l)return[];const t=[],e=p.getGuilds();return Object.values(e).forEach(function(n){if(n?.id)try{let r=[];const a=R||I;if(a?.getChannels){const h=a.getChannels(n.id);h?.SELECTABLE&&(r=r.concat(h.SELECTABLE)),h?.VOCAL&&(r=r.concat(h.VOCAL))}if(B?.getActiveJoinedThreadsForGuild)try{const h=B.getActiveJoinedThreadsForGuild(n.id),f=Object.values(h).flatMap(function(w){return Object.values(w||{})});r=r.concat(f)}catch{}r.forEach(function(h){const f=h?.channel||h;if(f?.id&&!j(n.id))try{l.hasUnread&&l.hasUnread(f.id)&&t.push({channelId:f.id,messageId:l.lastMessageId?.(f.id)||null,readStateType:0})}catch{}})}catch{}}),t},T=function(){const t=[];return q().forEach(function(e){if(e?.id&&!G(e.id))try{let n=!1;if(l.hasUnread&&(n=l.hasUnread(e.id)),!n&&l.getAllReadStates){const r=l.getAllReadStates()[e.id];r&&(n=r.mentionCount&&r.mentionCount>0||r._unreadCount&&r._unreadCount>0||r.unreadCount&&r.unreadCount>0)}n&&t.push({channelId:e.id,messageId:l.lastMessageId?.(e.id)||null,readStateType:0})}catch{}}),t},C=function(t="all"){if(!p||!l||!b)return!1;let e=[],n="";switch(t){case"server":e=N(),n="server";break;case"dm":e=T(),n="DM";break;case"all":default:e=[...N(),...T()],n="";break}if(e.length===0){const a=t==="all"?"No unread notifications found!":`No unread ${n} notifications found!`;return o.showToast(a,s.getAssetIDByName("ic_message_edit")),!0}b.dispatch({type:"BULK_ACK",context:"APP",channels:e});const r=t==="all"?`Cleared ${e.length} unread notifications!`:`Cleared ${e.length} unread ${n} notifications!`;return o.showToast(r,s.getAssetIDByName("ic_message_edit")),!0},z=function(){const t=Date.now(),e=t-m;if(e