zadam / trilium

Build your personal knowledge base with Trilium Notes
GNU Affero General Public License v3.0
27.41k stars 1.93k forks source link

I recently studied the API. When getting content through the interface, the picture prompts: Logged in session not found. #4828

Closed openapphub closed 3 months ago

openapphub commented 3 months ago

Trilium Version

0.63.7

What operating system are you using?

macOS

What is your setup?

Local + server sync

Operating System Version

macos

Description

Get the img tag node through the /notes/{noteId}/content interface<img style="aspect-ratio:1012/1185;" src="api/attachments/OfFAHS3RFFOC/image/8-8.jpg" alt = "image.png" width="1012" height="1185">, when rendering with rich text, it prompts: "Logged in session not established".

I tried

Please give me some advice on how to load image resources correctly?

Error logs

No response

zerebos commented 3 months ago

Are you trying to use Trilium as an image CDN? Why are you trying to access the image directly like that? You should put the image in a share (perhaps a share raw depending on the usecase)

openapphub commented 3 months ago

Are you trying to use Trilium as an image CDN? Why are you trying to access the image directly like that? You should put the image in a share (perhaps a share raw depending on the usecase)

It is not used as an image CDN, but content is obtained through the interface. The information returned by the content interface is prompted when I render this information (rich text) for display. Picture cannot be echoed

zerebos commented 3 months ago

I'm still unclear on what exactly you're trying to do here, but you should not be remotely hotlinking the images stored in Trilium outside of share trees.

openapphub commented 3 months ago

My idea is this, to develop a page that shows the daily events. Get all the notes in a topic directory through a custom interface, and display the note content. Basically, I've done everything I need, but I don't know how to display the pictures.

image
openapphub commented 3 months ago

I tried several times and found that some pictures don't work and some work fine, so I'm even more puzzled~. Re-uploaded the photo that required logging in and found it didn't need to be verified.

Accessing the database, comparing the fields of both looks similar, nothing special.

login required

https://note.xxx.com/api/attachments/ua1ttd4hgYsh/image/640.jpg https://note.xxx.com/api/attachments/OfFAHS3RFFOC/image/8-8.jpg

direct access

https://note.xxx.com/api/attachments/4I07nIUxpsAV/image/image.png

zerebos commented 3 months ago

My idea is this, to develop a page that shows the daily events. Get all the notes in a topic directory through a custom interface, and display the note content. Basically, I've done everything I need, but I don't know how to display the pictures. image

It sounds like you're recreating the shared notes feature essentially.

openapphub commented 3 months ago

My idea is this, to develop a page that shows the daily events. Get all the notes in a topic directory through a custom interface, and display the note content. Basically, I've done everything I need, but I don't know how to display the pictures. image

It sounds like you're recreating the shared notes feature essentially.

Hmmmmmmmmm .... ~, it does seem to be the case, I see . Analyzing first will add the share path, so it's OK.