rxliuli / joplin-utils

Joplin-based community tool
https://joplin-utils.rxliuli.com/
MIT License
236 stars 36 forks source link

[Bug]: joplin-batch-web: unused images are not displayed #17

Closed huyz closed 3 years ago

huyz commented 3 years ago

The tool/kit where the error occurred

joplin-batch-web

Describe the bug

For the "Check for unused resources" functionality, it successfully finds unused resources, but the img links are broken. For example, it looks like this in the HTML:

http://localhost:undefined/resources/5c060c09fc1b4e6c4919c/file?token=undefined

So the port and token aren't filled in. If I open a new tab and manually fix the link, the image link does work.

Steps to reproduce the behavior

  1. Set up the port and token
  2. Go to "Check for unused resources"
  3. Click Check
  4. Notice the broken image links

Additional context

No response

rxliuli commented 3 years ago

Have you set the token and port? https://joplin-utils.rxliuli.com/web/joplin-batch-web/#/en-US/settings

huyz commented 3 years ago

For anyone who needs a workaround in the meantime, this is the code I wrote as a Chrome Dev Tools source snippet:

// Requires jQuery to be injected first as $

let port = window.prompt("Enter port (default 41184):");
if (!port) {
  port = 41184;
}

const token = window.prompt("Enter the Joplin Web Clipper token:");

$('img[src^="http://localhost:undefined"]').each((i, el) => {
  const $el = $(el);
  let src = $el.attr("src");
  src = src.replace(/undefined/, port);
  src = src.replace(/undefined/, token);
  $el.attr("src", src);
});
rxliuli commented 3 years ago

I just added the Chinese version of the FAQ document. Would you like to help translate it into English?

Chinese documents: https://joplin-utils.rxliuli.com/zh/joplin-batch-web/#%E4%BC%BC%E4%B9%8E%E6%B2%A1%E6%9C%89%E6%AD%A3%E7%A1%AE%E8%AF%B7%E6%B1%82-joplin-clipper-api-token-undefined

Refer to how to help modify the document


Just saw the reply, it seems that this error cannot be reproduced on my side. . .

image

huyz commented 3 years ago

Have you set the token and port? https://joplin-utils.rxliuli.com/web/joplin-batch-web/#/en-US/settings

Yes

Just saw the reply, it seems that this error cannot be reproduced on my side. . .

Hmm, strange. Ok, maybe just a fluke then. I'll let you know if I run into this again.