mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 05:57:32 -07:00
enhance: only render public notes in HTML template (#8527)
* only render public notes in HTML template * fix missing import
This commit is contained in:
parent
cce6bce024
commit
aeeaae2d88
1 changed files with 6 additions and 7 deletions
|
@ -14,7 +14,7 @@ import { createBullBoard } from '@bull-board/api';
|
|||
import { BullAdapter } from '@bull-board/api/bullAdapter.js';
|
||||
import { KoaAdapter } from '@bull-board/koa';
|
||||
|
||||
import { IsNull } from 'typeorm';
|
||||
import { In, IsNull } from 'typeorm';
|
||||
import { fetchMeta } from '@/misc/fetch-meta.js';
|
||||
import config from '@/config/index.js';
|
||||
import { Users, Notes, UserProfiles, Pages, Channels, Clips, GalleryPosts } from '@/models/index.js';
|
||||
|
@ -266,7 +266,10 @@ router.get('/users/:user', async ctx => {
|
|||
|
||||
// Note
|
||||
router.get('/notes/:note', async (ctx, next) => {
|
||||
const note = await Notes.findOneBy({ id: ctx.params.note });
|
||||
const note = await Notes.findOneBy({
|
||||
id: ctx.params.note,
|
||||
visibility: In(['public', 'home']),
|
||||
});
|
||||
|
||||
if (note) {
|
||||
const _note = await Notes.pack(note);
|
||||
|
@ -283,11 +286,7 @@ router.get('/notes/:note', async (ctx, next) => {
|
|||
themeColor: meta.themeColor,
|
||||
});
|
||||
|
||||
if (['public', 'home'].includes(note.visibility)) {
|
||||
ctx.set('Cache-Control', 'public, max-age=180');
|
||||
} else {
|
||||
ctx.set('Cache-Control', 'private, max-age=0, must-revalidate');
|
||||
}
|
||||
ctx.set('Cache-Control', 'public, max-age=180');
|
||||
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue