codePreviews+fedimbed: allow unembedded spoilers to be spoilers

This commit is contained in:
Cynthia Foxwell 2023-12-05 11:24:09 -07:00
parent b665eb9e02
commit 2a5b546401
2 changed files with 4 additions and 4 deletions

View file

@ -3,11 +3,11 @@ const {MessageFlags} = require("@projectdysnomia/dysnomia").Constants;
const events = require("../lib/events.js"); const events = require("../lib/events.js");
const {hasFlag} = require("../lib/guildSettings.js"); const {hasFlag} = require("../lib/guildSettings.js");
const REGEX_GITHUB = const REGEX_GITHUB =
/(?:\s|^)(\|\|\s*)?https?:\/\/(www\.)?github\.com\/[a-z0-9-]+\/[a-z0-9-]+\/blob\/([a-z0-9-_.#/]*)(\s+\|\|)?/gi; /(?:\s|^)(\|\|\s*)?https?:\/\/(www\.)?github\.com\/[a-z0-9-]+\/[a-z0-9-]+\/blob\/([a-z0-9-_.#/]*)(\s*\|\|)?/gi;
const REGEX_GITLAB = const REGEX_GITLAB =
/(?:\s|^)(\|\|\s*)?https?:\/\/.+?\/[a-z0-9-]+\/[a-z0-9-]+\/-\/blob\/([a-z0-9-_.#/]*)(\s+\|\|)?/gi; /(?:\s|^)(\|\|\s*)?https?:\/\/.+?\/[a-z0-9-]+\/[a-z0-9-]+\/-\/blob\/([a-z0-9-_.#/]*)(\s*\|\|)?/gi;
const REGEX_GITEA = const REGEX_GITEA =
/(?:\s|^)(\|\|\s*)?https?:\/\/.+?\/[a-z0-9-]+\/[a-z0-9-]+\/src\/branch\/([a-z0-9-_.#/]*)(\s+\|\|)?/gi; /(?:\s|^)(\|\|\s*)?https?:\/\/.+?\/[a-z0-9-]+\/[a-z0-9-]+\/src\/branch\/([a-z0-9-_.#/]*)(\s*\|\|)?/gi;
const REGEX_SPOILER = /(?:\s|^)\|\|([\s\S]+?)\|\|/; const REGEX_SPOILER = /(?:\s|^)\|\|([\s\S]+?)\|\|/;
function unindent(str) { function unindent(str) {

View file

@ -12,7 +12,7 @@ const FRIENDLY_USERAGENT =
"HiddenPhox/fedimbed (https://gitdab.com/Cynosphere/HiddenPhox)"; "HiddenPhox/fedimbed (https://gitdab.com/Cynosphere/HiddenPhox)";
const URLS_REGEX = const URLS_REGEX =
/(?:\s|^)(\|\|\s*)?(https?:\/\/[^\s<]+[^<.,:;"'\]\s])(\s+\|\|)?/g; /(?:\s|^)(\|\|\s*)?(https?:\/\/[^\s<]+[^<.,:;"'\]\s])(\s*\|\|)?/g;
const SPOILER_REGEX = /(?:\s|^)\|\|([\s\S]+?)\|\|/; const SPOILER_REGEX = /(?:\s|^)\|\|([\s\S]+?)\|\|/;
const PATH_REGEX = { const PATH_REGEX = {