mirror of
https://github.com/thiloho/archtika.git
synced 2025-11-22 02:41:35 +01:00
Merge pull request #31 from archtika/devel
Render line breaks in change log and add more usernames to the blacklist
This commit is contained in:
13
rest-api/db/migrations/20250323134405_username_blocklist.sql
Normal file
13
rest-api/db/migrations/20250323134405_username_blocklist.sql
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
-- migrate:up
|
||||||
|
ALTER TABLE internal.user
|
||||||
|
DROP CONSTRAINT username_not_blocked;
|
||||||
|
|
||||||
|
ALTER TABLE internal.user
|
||||||
|
ADD CONSTRAINT username_not_blocked CHECK (LOWER(username) NOT IN ('admin', 'administrator', 'api', 'auth', 'blog', 'cdn', 'docs', 'help', 'login', 'logout', 'profile', 'preview', 'previews', 'register', 'settings', 'setup', 'signin', 'signup', 'support', 'test', 'www'));
|
||||||
|
|
||||||
|
-- migrate:down
|
||||||
|
ALTER TABLE internal.user
|
||||||
|
DROP CONSTRAINT username_not_blocked;
|
||||||
|
|
||||||
|
ALTER TABLE internal.user
|
||||||
|
ADD CONSTRAINT username_not_blocked CHECK (LOWER(username) NOT IN ('admin', 'administrator', 'api', 'auth', 'blog', 'cdn', 'docs', 'help', 'login', 'logout', 'profile', 'register', 'settings', 'setup', 'signin', 'signup', 'support', 'test', 'www'));
|
||||||
@@ -141,9 +141,13 @@
|
|||||||
<button type="submit">Compute diff</button>
|
<button type="submit">Compute diff</button>
|
||||||
</form>
|
</form>
|
||||||
{#if form?.logId === id && form?.currentDiff}
|
{#if form?.logId === id && form?.currentDiff}
|
||||||
<pre>{@html DOMPurify.sanitize(form.currentDiff, {
|
<pre>{@html DOMPurify.sanitize(
|
||||||
ALLOWED_TAGS: ["ins", "del"]
|
// .replace takes escaped text representations of line breaks and converts them to real line breaks that render correctly in HTML
|
||||||
})}</pre>
|
form.currentDiff.replace(/\\r\\n|\\n|\\r/g, "\n"),
|
||||||
|
{
|
||||||
|
ALLOWED_TAGS: ["ins", "del"]
|
||||||
|
}
|
||||||
|
)}</pre>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user