Merge branch 'main' into react/collections

This commit is contained in:
Elian Doran 2025-09-14 19:01:18 +03:00 committed by GitHub
commit ec5e7607f0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
9 changed files with 585 additions and 449 deletions

View File

@ -103,6 +103,11 @@ jobs:
fi
}
- name: Fix HTML Links
run: |
# Remove .md extensions from links in generated HTML
pnpm tsx ./scripts/fix-html-links.ts site
- name: Validate Built Site
run: |
# Basic validation that important files exist

View File

@ -67,7 +67,7 @@
"@types/xml2js": "0.4.14",
"archiver": "7.0.1",
"async-mutex": "0.5.0",
"axios": "1.11.0",
"axios": "1.12.0",
"bindings": "1.5.0",
"bootstrap": "5.3.8",
"chardet": "2.1.0",

View File

@ -424,5 +424,9 @@
"board_status_todo": "待办",
"board_status_progress": "进行中",
"board_status_done": "已完成"
},
"sql_init": {
"db_not_initialized_desktop": "数据库尚未初始化,请依照屏幕提示操作。",
"db_not_initialized_server": "数据库尚未初始化,请访问设置页面 http://[your-server-host]:{{port}} 查看如何初始化 Trilium。"
}
}

View File

@ -7,6 +7,48 @@
"scroll-to-active-note": "Scroll naar actieve notitie in de notitieboom",
"quick-search": "Snelle zoekbalk activeren",
"search-in-subtree": "Zoek naar notities in de subboom van de actieve notitie",
"expand-subtree": "Subboom van huidige notitie uitbreiden"
"expand-subtree": "Subboom van huidige notitie uitbreiden",
"collapse-tree": "Vouwt de volledige notitieboom samen",
"collapse-subtree": "Vouwt de subboom van de huidige notitie samen",
"sort-child-notes": "Kindnotities sorteren",
"creating-and-moving-notes": "Notities maken en verplaatsen",
"create-note-after": "Maak notitie na actieve notitie",
"create-note-into": "Maak notitie als onderliggende notitie van actieve notitie",
"create-note-into-inbox": "Maak een notitie in de inbox (indien gedefinieerd) of dagnotitie",
"delete-note": "Notitie verwijderen",
"move-note-up": "Notitie naar boven verplaatsen",
"move-note-down": "Notitie naar beneden verplaatsen",
"move-note-up-in-hierarchy": "Notitie hoger in hiërarchie plaatsen",
"move-note-down-in-hierarchy": "Verplaats nota in hiërarchie",
"edit-note-title": "Spring van de boom naar de notitie en de titel",
"edit-branch-prefix": "Dialoogvenster \"Bewerk takvoorvoegsel\" weergeven",
"clone-notes-to": "Geselecteerde notities klonen",
"move-notes-to": "Geselecteerde notities verplaatsen",
"note-clipboard": "Notitieblok",
"copy-notes-to-clipboard": "Kopieer geselecteerde notities naar het klembord",
"paste-notes-from-clipboard": "Plak notities uit het klembord in de actieve notitie",
"cut-notes-to-clipboard": "Geselecteerde notities naar het klembord knippen",
"select-all-notes-in-parent": "Selecteer alle notities van het huidige notitieniveau",
"add-note-above-to-the-selection": "Voeg bovenstaande opmerking toe aan de selectie",
"add-note-below-to-selection": "Voeg onderstaande opmerking toe aan de selectie",
"duplicate-subtree": "Duplicaat subboom",
"tabs-and-windows": "Tabbladen en vensters",
"open-new-tab": "Nieuw tabblad openen",
"close-active-tab": "Sluit actief tabblad",
"reopen-last-tab": "Het laatst gesloten tabblad opnieuw openen",
"activate-next-tab": "Tabblad rechts activeren",
"activate-previous-tab": "Tabblad links activeren",
"open-new-window": "Nieuw leeg venster openen",
"toggle-tray": "De toepassing weergeven/verbergen in het systeemvak",
"first-tab": "Activeer het eerste tabblad in de lijst",
"second-tab": "Activeer het tweede tabblad in de lijst",
"third-tab": "Activeer het derde tabblad in de lijst",
"fourth-tab": "Activeer het vierde tabblad in de lijst",
"fifth-tab": "Activeer het vijfde tabblad in de lijst",
"sixth-tab": "Activeer het zesde tabblad in de lijst",
"seventh-tab": "Activeer het zevende tabblad in de lijst",
"eight-tab": "Activeer het achtste tabblad in de lijst",
"ninth-tab": "Activeer het negende tabblad in de lijst",
"last-tab": "Activeer het laatste tabblad in de lijst"
}
}

View File

@ -424,5 +424,9 @@
"board_status_todo": "待辦",
"board_status_progress": "進行中",
"board_status_done": "已完成"
},
"sql_init": {
"db_not_initialized_desktop": "資料庫尚未初始化,請依螢幕指示操作。",
"db_not_initialized_server": "資料庫尚未初始化,請前往設定頁面 http://[your-server-host]:{{port}} 查看如何初始化 Trilium。"
}
}

View File

@ -163,6 +163,7 @@ function setExpandedForSubtree(req: Request) {
SELECT branches.branchId, branches.noteId FROM branches
JOIN tree ON branches.parentNoteId = tree.noteId
WHERE branches.isDeleted = 0
AND branches.isExpanded = 1
)
SELECT branchId FROM tree`,
[branchId]

View File

@ -26,20 +26,8 @@ function checkAuth(req: Request, res: Response, next: NextFunction) {
if (isElectron || noAuthentication) {
next();
return;
} else if (currentTotpStatus !== lastAuthState.totpEnabled || currentSsoStatus !== lastAuthState.ssoEnabled) {
req.session.destroy((err) => {
if (err) console.error('Error destroying session:', err);
res.redirect('login');
});
return;
} else if (currentSsoStatus) {
if (req.oidc?.isAuthenticated() && req.session.loggedIn) {
next();
return;
}
res.redirect('login');
return;
} else if (!req.session.loggedIn && !noAuthentication) {
// check redirectBareDomain option first
// cannot use options.getOptionBool currently => it will throw an error on new installations
// TriliumNextTODO: look into potentially creating an getOptionBoolOrNull instead
@ -54,6 +42,19 @@ function checkAuth(req: Request, res: Response, next: NextFunction) {
}
}
res.redirect(hasRedirectBareDomain ? "share" : "login");
} else if (currentTotpStatus !== lastAuthState.totpEnabled || currentSsoStatus !== lastAuthState.ssoEnabled) {
req.session.destroy((err) => {
if (err) console.error('Error destroying session:', err);
res.redirect('login');
});
return;
} else if (currentSsoStatus) {
if (req.oidc?.isAuthenticated() && req.session.loggedIn) {
next();
return;
}
res.redirect('login');
return;
} else {
next();
}

14
pnpm-lock.yaml generated
View File

@ -567,8 +567,8 @@ importers:
specifier: 0.5.0
version: 0.5.0
axios:
specifier: 1.11.0
version: 1.11.0(debug@4.4.1)
specifier: 1.12.0
version: 1.12.0(debug@4.4.1)
bindings:
specifier: 1.5.0
version: 1.5.0
@ -5842,8 +5842,8 @@ packages:
resolution: {integrity: sha512-zJAaP9zxTcvTHRlejau3ZOY4V7SRpiByf3/dxx2uyKxxor19tpmpV2QRsTKikckwhaPmr2dVpxxMr7jOCYVp5g==}
engines: {node: '>=6.0.0'}
axios@1.11.0:
resolution: {integrity: sha512-1Lx3WLFQWm3ooKDYZD1eXmoGO9fxYQjrycfHFC8P0sCfQVXyROp0p9PFWBehewBOdCwHc+f/b8I0fMto5eSfwA==}
axios@1.12.0:
resolution: {integrity: sha512-oXTDccv8PcfjZmPGlWsPSwtOJCZ/b6W5jAMCNcfwJbCzDckwG0jrYJFaWH1yvivfCXjVzV/SPDEhMB3Q+DSurg==}
axobject-query@4.1.0:
resolution: {integrity: sha512-qIj0G9wZbMGNLjLmg1PT6v2mE9AH2zlnADJD/2tC6E00hgmhUOfEB6greHPAfLRSufHqROIUTkw6E+M3lH0PTQ==}
@ -15113,8 +15113,6 @@ snapshots:
'@ckeditor/ckeditor5-table': 46.1.0
'@ckeditor/ckeditor5-utils': 46.1.0
ckeditor5: 46.1.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41)
transitivePeerDependencies:
- supports-color
'@ckeditor/ckeditor5-emoji@46.1.0':
dependencies:
@ -20474,7 +20472,7 @@ snapshots:
await-to-js@3.0.0: {}
axios@1.11.0(debug@4.4.1):
axios@1.12.0(debug@4.4.1):
dependencies:
follow-redirects: 1.15.9(debug@4.4.1)
form-data: 4.0.4
@ -20967,6 +20965,8 @@ snapshots:
ckeditor5-collaboration@46.1.0:
dependencies:
'@ckeditor/ckeditor5-collaboration-core': 46.1.0
transitivePeerDependencies:
- supports-color
ckeditor5-premium-features@46.1.0(bufferutil@4.0.9)(ckeditor5@46.1.0(patch_hash=8331a09d41443b39ea1c784daaccfeb0da4f9065ed556e7de92e9c77edd9eb41))(utf-8-validate@6.0.5):
dependencies:

79
scripts/fix-html-links.ts Normal file
View File

@ -0,0 +1,79 @@
#!/usr/bin/env node
/**
* Post-process HTML files generated by MkDocs to remove .md extensions from links
*/
import * as fs from 'fs';
import * as path from 'path';
/**
* Process HTML content to remove .md extensions from links
*/
function fixHtmlLinks(content: string): string {
// Replace .md extensions in href attributes
// Handle both quoted and unquoted href attributes
// First, handle quoted hrefs: href="...something.md" or href="...something.md#anchor"
content = content.replace(/href="([^"]*?)\.md(#[^"]*)?"/g, 'href="$1$2"');
// Then, handle unquoted hrefs: href=...something.md or href=...something.md#anchor
// This matches href= followed by a non-whitespace URL ending in .md
content = content.replace(/href=([^\s>]*?)\.md(#[^\s>]*)?(?=[\s>])/g, 'href=$1$2');
return content;
}
/**
* Recursively process all HTML files in a directory
*/
function processDirectory(dir: string): number {
let filesProcessed = 0;
const entries = fs.readdirSync(dir, { withFileTypes: true });
for (const entry of entries) {
const fullPath = path.join(dir, entry.name);
if (entry.isDirectory()) {
// Recursively process subdirectories
filesProcessed += processDirectory(fullPath);
} else if (entry.isFile() && entry.name.endsWith('.html')) {
// Process HTML files
const content = fs.readFileSync(fullPath, 'utf-8');
const fixedContent = fixHtmlLinks(content);
if (content !== fixedContent) {
fs.writeFileSync(fullPath, fixedContent, 'utf-8');
console.log(`Fixed: ${path.relative(process.cwd(), fullPath)}`);
filesProcessed++;
}
}
}
return filesProcessed;
}
function main(): number {
const args = process.argv.slice(2);
const siteDir = args[0] || 'site';
const fullPath = path.resolve(siteDir);
if (!fs.existsSync(fullPath)) {
console.error(`Error: Directory '${fullPath}' does not exist`);
return 1;
}
console.log(`Processing HTML files in: ${fullPath}`);
console.log('-'.repeat(50));
const filesProcessed = processDirectory(fullPath);
console.log('-'.repeat(50));
console.log(`Processed ${filesProcessed} HTML files`);
return 0;
}
// Run the main function
process.exit(main());