Show images inline.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3844 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2022-02-25 18:24:48 +00:00
parent f4b46cc3a0
commit ac0482d7f5
3 changed files with 15 additions and 10 deletions

View File

@ -232,8 +232,7 @@ async function getRecentPostIds(db, id, ids, limit) {
"WHERE "+
" rowid > ? AND "+
" rowid <= ? AND "+
" author IN (" + ids_batch.map(x => '?').join(", ") + ") AND "+
" json_extract(content, '$.type') = 'post' "+
" author IN (" + ids_batch.map(x => '?').join(", ") + ") "+
"ORDER BY timestamp DESC LIMIT ?",
[].concat([f.rowid, row_id_max], ids_batch, [limit]),
function(row) {

View File

@ -8,13 +8,19 @@ function markdown(md) {
var event, node;
while ((event = walker.next())) {
node = event.node;
if (event.entering && node.type == 'link') {
if (node.destination.startsWith('@') &&
node.destination.endsWith('.ed25519')) {
node.destination = '#' + node.destination;
} else if (node.destination.startsWith('%') &&
node.destination.endsWith('.sha256')) {
node.destination = '#' + node.destination;
if (event.entering) {
if (node.type == 'link') {
if (node.destination.startsWith('@') &&
node.destination.endsWith('.ed25519')) {
node.destination = '#' + node.destination;
} else if (node.destination.startsWith('%') &&
node.destination.endsWith('.sha256')) {
node.destination = '#' + node.destination;
}
} else if (node.type == 'image') {
if (node.destination.startsWith('&')) {
node.destination = '/' + node.destination + '/view';
}
}
}
}