NoAppsAllowed Fix

This commit is contained in:
thororen1234 2024-11-06 21:53:46 -05:00
parent f9d908a4f0
commit 225c99ad4c
3 changed files with 6 additions and 6 deletions

View file

@ -14,10 +14,10 @@ export default definePlugin({
patches: [ patches: [
{ {
find: "#{intl::APP_TAG})", find: "#{intl::APP_TAG::hash}\":",
replacement: { replacement: {
match: /\i\.\i\.string\(\i\.\i#{intl::APP_TAG}\)/, match: /(#{intl::APP_TAG::hash}"):".*?"/,
replace: '"BOT"' replace: '$1:"BOT"'
} }
} }
], ],

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
import { definePluginSettings, Settings } from "@api/Settings"; import { definePluginSettings } from "@api/Settings";
import { Flex } from "@components/Flex"; import { Flex } from "@components/Flex";
import { Devs } from "@utils/constants"; import { Devs } from "@utils/constants";
import { getIntlMessage } from "@utils/discord"; import { getIntlMessage } from "@utils/discord";
@ -301,7 +301,6 @@ export default definePlugin({
const [tagName, variant] = passedTagName.split("-"); const [tagName, variant] = passedTagName.split("-");
if (!passedTagName) return getIntlMessage("APP_TAG"); if (!passedTagName) return getIntlMessage("APP_TAG");
const tag = tags.find(({ name }) => tagName === name); const tag = tags.find(({ name }) => tagName === name);
if (!tag && Settings.plugins.NoAppsAllowed.enabled) return "BOT";
if (!tag) return getIntlMessage("APP_TAG"); if (!tag) return getIntlMessage("APP_TAG");
if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return getIntlMessage("APP_TAG"); if (variant === "BOT" && tagName !== "WEBHOOK" && this.settings.store.dontShowForBots) return getIntlMessage("APP_TAG");
@ -310,7 +309,6 @@ export default definePlugin({
case "OP": case "OP":
return `${getIntlMessage("BOT_TAG_FORUM_ORIGINAL_POSTER")}${tagText}`; return `${getIntlMessage("BOT_TAG_FORUM_ORIGINAL_POSTER")}${tagText}`;
case "BOT": case "BOT":
if (Settings.plugins.NoAppsAllowed.enabled) return `BOT • ${tagText}`;
return `${getIntlMessage("APP_TAG")}${tagText}`; return `${getIntlMessage("APP_TAG")}${tagText}`;
default: default:
return tagText; return tagText;

View file

@ -27,6 +27,8 @@ export function canonicalizeMatch<T extends RegExp | string>(match: T): T {
const isString = typeof match === "string"; const isString = typeof match === "string";
const hasSpecialChars = !Number.isNaN(Number(hashed[0])) || hashed.includes("+") || hashed.includes("/"); const hasSpecialChars = !Number.isNaN(Number(hashed[0])) || hashed.includes("+") || hashed.includes("/");
if (modifier === "hash") return hashed;
if (hasSpecialChars) { if (hasSpecialChars) {
return isString return isString
? `["${hashed}"]` ? `["${hashed}"]`