fenjalien / obsidian-typst

Renders typst code blocks in Obsidian into images using Typst through the power of WASM!
Apache License 2.0
327 stars 15 forks source link

[Bug] Access Denied on mobile #53

Closed iamrecursion closed 2 months ago

iamrecursion commented 2 months ago

Whenever trying to load a package on mobile, even one that is actually downloaded into the packages folder, I get the following error

iled to load file (access denied)
   ╭─[/Scratchpad.md:3:9]
   │
 3 │ #import "@preview/cetz:0.2.2"           as draw    // Diagrams with code (like TikZ)
   │ 
   │ Help: cannot read file outside of project root you can adjust the project root with the --root argument
───╯

Yes, it actually appears cut off like this. I have confirmed that the file is actually downloaded using the vault API.

This is on iOS specifically, with the latest stable version of Obsidian.

d-kaue commented 2 months ago

Hi @iamrecursion, I think I've found the cause of the problem, but I don't have an iOS device to test.

If you could edit the file main.js in the directory .obsidian/plugins/typst/ and go to line 844.

Replace require("path").isAbsolute(path) with false.

The change should be equal this:

- if (require("path").isAbsolute(path)) {
+ if (false) {

Save and reload the plugin.

iamrecursion commented 2 months ago

This does not appear to change anything unfortunately.

fenjalien commented 2 months ago

I've just noticed this is a duplicate of #38, failing to read files on iOS is a known bug and I still don't have any access to an Apple device to properly debug and resolve this problem.