Changeset 9946a68 in Klonkt for src/services
- Timestamp:
- 09/04/2026 12:12:19 PM (5 days ago)
- Branches:
- main
- Children:
- 1d1fdc9
- Parents:
- 8151340
- Location:
- src/services
- Files:
-
- 6 edited
-
ActivityPubService.js (modified) (2 diffs)
-
ArchiveImportService.js (modified) (2 diffs)
-
SqliteSessionStore.js (modified) (1 diff)
-
ap-inbox.js (modified) (3 diffs)
-
ap-timeline.js (modified) (2 diffs)
-
guardianship/delivery.js (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/services/ActivityPubService.js
r8151340 r9946a68 19 19 import fs from 'fs'; 20 20 import path from 'path'; 21 import db from '../config/database.js';21 import db, { NU_ISO } from '../config/database.js'; 22 22 import HtmlSanitizerService from './HtmlSanitizerService.js'; 23 23 import AudioEmbedService from './AudioEmbedService.js'; … … 1482 1482 function iStmts() { 1483 1483 if (!_insI) { 1484 _insI = db.prepare( 'INSERT OR IGNORE INTO ap_interactions (kind, post_id, object_uri, actor_uri, actor_name, actor_handle, actor_url, actor_icon, content, published, parent_uri, visibility, emoji_json, actor_emoji_json, created_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,CURRENT_TIMESTAMP)');1484 _insI = db.prepare(`INSERT OR IGNORE INTO ap_interactions (kind, post_id, object_uri, actor_uri, actor_name, actor_handle, actor_url, actor_icon, content, published, parent_uri, visibility, emoji_json, actor_emoji_json, created_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,${NU_ISO})`); 1485 1485 _delLA = db.prepare('DELETE FROM ap_interactions WHERE kind = ? AND post_id = ? AND actor_uri = ?'); 1486 1486 _delReply = db.prepare("DELETE FROM ap_interactions WHERE kind = 'reply' AND object_uri = ?"); 1487 1487 _listI = db.prepare('SELECT id, kind, object_uri, parent_uri, actor_uri, actor_name, actor_handle, actor_url, actor_icon, content, published, created_at, acted_boost, acted_like, visibility, emoji_json, actor_emoji_json FROM ap_interactions WHERE post_id = ? ORDER BY created_at ASC'); 1488 1488 _getI = db.prepare('SELECT * FROM ap_interactions WHERE id = ?'); 1489 _insO = db.prepare( 'INSERT INTO ap_outbox (id, site_slug, post_id, post_slug, in_reply_to, to_actor, to_handle, content, language, attachments, created_at) VALUES (?,?,?,?,?,?,?,?,?,?,CURRENT_TIMESTAMP)');1489 _insO = db.prepare(`INSERT INTO ap_outbox (id, site_slug, post_id, post_slug, in_reply_to, to_actor, to_handle, content, language, attachments, created_at) VALUES (?,?,?,?,?,?,?,?,?,?,${NU_ISO})`); 1490 1490 _listO = db.prepare('SELECT * FROM ap_outbox WHERE post_id = ? ORDER BY created_at ASC'); 1491 1491 _getO = db.prepare('SELECT * FROM ap_outbox WHERE id = ?'); -
src/services/ArchiveImportService.js
r8151340 r9946a68 23 23 import crypto from 'crypto'; 24 24 import { randomUUID } from 'crypto'; 25 import db from '../config/database.js';25 import db, { NU_ISO } from '../config/database.js'; 26 26 import { MEDIA_ROOT, AUDIO_ROOT } from '../config/paths.js'; 27 27 import { FORMAT_VERSION, parseFollowingCsv } from './ArchiveExportService.js'; … … 413 413 const insReply = db.prepare(`INSERT OR IGNORE INTO ap_interactions 414 414 (kind, post_id, object_uri, actor_uri, actor_name, actor_handle, content, published, parent_uri, created_at) 415 VALUES ('reply', ?, ?, ?, ?, ?, ?, ?, ?, CURRENT_TIMESTAMP)`);415 VALUES ('reply', ?, ?, ?, ?, ?, ?, ?, ?, ${NU_ISO})`); 416 416 417 417 db.transaction(() => { -
src/services/SqliteSessionStore.js
r8151340 r9946a68 35 35 this._stmtDestroy = db.prepare('DELETE FROM sessions WHERE sid = ?'); 36 36 this._stmtTouch = db.prepare('UPDATE sessions SET expiresAt = ? WHERE sid = ?'); 37 this._stmtCount = db.prepare("SELECT COUNT(*) AS c FROM sessions WHERE expiresAt> datetime('now')");37 this._stmtCount = db.prepare("SELECT COUNT(*) AS c FROM sessions WHERE datetime(expiresAt) > datetime('now')"); 38 38 this._stmtClear = db.prepare('DELETE FROM sessions'); 39 this._stmtAll = db.prepare("SELECT sid, data FROM sessions WHERE expiresAt> datetime('now')");40 this._stmtGc = db.prepare("DELETE FROM sessions WHERE expiresAt<= datetime('now')");39 this._stmtAll = db.prepare("SELECT sid, data FROM sessions WHERE datetime(expiresAt) > datetime('now')"); 40 this._stmtGc = db.prepare("DELETE FROM sessions WHERE datetime(expiresAt) <= datetime('now')"); 41 41 } 42 42 -
src/services/ap-inbox.js
r8151340 r9946a68 17 17 * guardian-broers in de dienst, zoals gateOutgoingFollow bij stap 7. 18 18 */ 19 import db from '../config/database.js';19 import db, { NU_ISO } from '../config/database.js'; 20 20 import HtmlSanitizerService from './HtmlSanitizerService.js'; 21 21 import * as Guardianship from './guardianship/index.js'; … … 130 130 if (++_seenSinceSnoei >= 500) { 131 131 _seenSinceSnoei = 0; 132 const r = db.prepare(`DELETE FROM ap_seen_notes WHERE created_at< datetime('now', '-${SEEN_NOTES_DAYS} days')`).run();132 const r = db.prepare(`DELETE FROM ap_seen_notes WHERE datetime(created_at) < datetime('now', '-${SEEN_NOTES_DAYS} days')`).run(); 133 133 if (r.changes) console.log(`[AP] seen notes: ${r.changes} pruned`); 134 134 } … … 751 751 const ouder = safeUrl(typeof o.inReplyTo === 'string' ? o.inReplyTo : (o.inReplyTo && o.inReplyTo.id)) || null; 752 752 const r = db.prepare(`INSERT OR IGNORE INTO ap_mentions (slug, object_uri, note_url, actor_uri, actor_name, actor_handle, actor_icon, actor_url, content, published, in_reply_to, help_request, wave, has_guardians, emoji_json, actor_emoji_json, media_json, created_at) 753 VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, CURRENT_TIMESTAMP)`)753 VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,${NU_ISO})`) 754 754 .run(slug, o.id, safeUrl(o.url) || null, actorUri, ai.name, ai.handle, ai.icon, ai.url, html, o.published || null, ouder, help ? 1 : 0, wave ? 1 : 0, hasG ? 1 : 0, 755 755 extractEmojiTags(o.tag), emojiJsonOf(ai.emojis), mediaFromNote(o)); -
src/services/ap-timeline.js
r8151340 r9946a68 13 13 * wireTimeline, hetzelfde injectiepatroon als guardianship en ap-c2s. 14 14 */ 15 import db, { isoSql } from '../config/database.js';15 import db, { isoSql, NU_ISO } from '../config/database.js'; 16 16 17 17 // De helper woont sinds shaer-a937 in config/database.js: elke plek die … … 30 30 export function tlStmts() { 31 31 if (!_insTl) { 32 _insTl = db.prepare( 'INSERT OR IGNORE INTO ap_timeline (id, slug, author_uri, author_name, author_handle, author_icon, author_url, content, url, published, media_json, nsfw, cw, created_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,CURRENT_TIMESTAMP)');32 _insTl = db.prepare(`INSERT OR IGNORE INTO ap_timeline (id, slug, author_uri, author_name, author_handle, author_icon, author_url, content, url, published, media_json, nsfw, cw, created_at) VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,${NU_ISO})`); 33 33 _listTl = db.prepare(`SELECT * FROM ap_timeline WHERE slug = ? ORDER BY ${STEMPEL('COALESCE(published, created_at)')} DESC LIMIT ? OFFSET ?`); 34 34 _delTl = db.prepare('DELETE FROM ap_timeline WHERE id = ?'); -
src/services/guardianship/delivery.js
r8151340 r9946a68 12 12 */ 13 13 import crypto from 'crypto'; 14 import db from '../../config/database.js';14 import db, { NU_ISO } from '../../config/database.js'; 15 15 import { carriesGuardians } from './context.js'; 16 16 … … 124 124 const id = crypto.randomUUID(); 125 125 db.prepare(`INSERT INTO ap_outbox (id, site_slug, post_id, post_slug, in_reply_to, to_actor, to_handle, content, language, attachments, visibility, to_actors, help_request, wave, away_until, created_at) 126 VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?, CURRENT_TIMESTAMP)`)126 VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,${NU_ISO})`) 127 127 .run(id, site.slug, '', null, inReplyTo || null, resolved[0].uri, resolved[0].handle, content, lang, media.length ? JSON.stringify(media) : null, 'direct', JSON.stringify(resolved.map((r) => r.uri)), helpRequest ? 1 : 0, wave ? 1 : 0, awayUntil || null); 128 128 const row = getOutboxRow(id);
Note:
See TracChangeset
for help on using the changeset viewer.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)