Merge branch 'dev'
This commit is contained in:
commit
8c85b08b5b
4 changed files with 22 additions and 5 deletions
|
|
@ -98,6 +98,9 @@ export function Boo({ channel }: { channel: Channel; }) {
|
|||
});
|
||||
const [isCleared, setIsCleared] = useState(false);
|
||||
|
||||
const lastMessageTimestampMs = lastMessage ? new Date(lastMessage.timestamp).getTime() : 0;
|
||||
const isInactive = !!lastMessage && settings.store.maxInactiveTimeMs > 0 && Number.isFinite(lastMessageTimestampMs) && Date.now() - lastMessageTimestampMs > settings.store.maxInactiveTimeMs;
|
||||
|
||||
useEffect(() => {
|
||||
if (!lastMessage || !currentUserId) return;
|
||||
|
||||
|
|
@ -167,7 +170,7 @@ export function Boo({ channel }: { channel: Channel; }) {
|
|||
}
|
||||
|
||||
// if exempted or bot (if setting enabled), remove from ghost tracking
|
||||
if (isExempted || (settings.store.ignoreBots && lastMessage.author.bot)) {
|
||||
if (isExempted || (settings.store.ignoreBots && lastMessage.author.bot) || isInactive) {
|
||||
if (countedChannels.has(id)) {
|
||||
countedChannels.delete(id);
|
||||
setBooCount(getBooCount() - 1);
|
||||
|
|
@ -187,9 +190,9 @@ export function Boo({ channel }: { channel: Channel; }) {
|
|||
setBooCount(getBooCount() + 1);
|
||||
}
|
||||
}
|
||||
}, [state.isCurrentUser, state.isDataProcessed, id, lastMessage?.id]);
|
||||
}, [state.isCurrentUser, state.isDataProcessed, id, lastMessage?.id, isInactive]);
|
||||
|
||||
if (!state.isDataProcessed || !currentUserId || !lastMessage || state.isCurrentUser || isChannelExempted(channel) || isCleared || (settings.store.ignoreBots && lastMessage.author.bot))
|
||||
if (!state.isDataProcessed || !currentUserId || !lastMessage || state.isCurrentUser || isChannelExempted(channel) || isCleared || (settings.store.ignoreBots && lastMessage.author.bot) || isInactive)
|
||||
return null;
|
||||
|
||||
if (!settings.store.showDmIcons) return null;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,18 @@ export const settings = definePluginSettings({
|
|||
description: "Ignore DMs from bots",
|
||||
default: true,
|
||||
restartNeeded: false
|
||||
},
|
||||
maxInactiveTimeMs: {
|
||||
type: OptionType.SELECT,
|
||||
description: "Only ghost DMs active within this timeframe",
|
||||
options: [
|
||||
{ label: "No limit", value: 0, default: true },
|
||||
{ label: "1 hour", value: 60 * 60 * 1000 },
|
||||
{ label: "1 day", value: 24 * 60 * 60 * 1000 },
|
||||
{ label: "1 week", value: 7 * 24 * 60 * 60 * 1000 },
|
||||
{ label: "1 month", value: 30 * 24 * 60 * 60 * 1000 },
|
||||
],
|
||||
restartNeeded: false
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { Settings } from "@api/Settings";
|
||||
import { migratePluginSettings, Settings } from "@api/Settings";
|
||||
import { Logger } from "@utils/Logger";
|
||||
|
||||
import { settings, SettingsStore } from "./settings";
|
||||
|
|
@ -97,6 +97,8 @@ function setStoreValue(key: SettingsKey, value: boolean | string | number) {
|
|||
export function migrateOldSettings() {
|
||||
if (Settings.plugins.RichPresence._migrated) return;
|
||||
|
||||
migratePluginSettings("RichPresence", "AudioBookShelfRichPresence", "GensokyoRadioRPC", "JellyfinRichPresence", "ListenBrainzRPC", "StatsfmPresence", "TosuRPC");
|
||||
|
||||
for (const migration of migrations) {
|
||||
const oldSettings = Settings.plugins[migration.oldPlugin];
|
||||
if (!oldSettings) continue;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ export default function SekaiStickersModal({ modalProps, settings }: { modalProp
|
|||
const [curve, setCurve] = React.useState<boolean>(false);
|
||||
const [isImgLoaded, setImgLoaded] = React.useState<boolean>(false);
|
||||
const [position, setPosition] = React.useState<{ x: number, y: number; }>({ x: characters[character].defaultText.x, y: characters[character].defaultText.y });
|
||||
const [spaceSize, setSpaceSize] = React.useState<number>(1);
|
||||
const [spaceSize, setSpaceSize] = React.useState<number>(36);
|
||||
let canvast!: HTMLCanvasElement;
|
||||
const img = new Image();
|
||||
img.crossOrigin = "anonymous";
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue