If your app has no need for navigation, you can call event.preventDefault() in a will-navigate handler. If you know which pages your app might navigate to, check the URL in the event handler and only let navigation occur if it matches the URLs you’re expecting.
Implementing a PIN-protected general blocker or even a regular block/allow list that way looks viable to me (Caveat: my knowledge of Electron is limited). Assuming that community plug-ins are sandboxed it would have to be a feature of the Obsidian core, though – correct?
Sir, have you found any way to block the Obsidian web viewer? I relied on Cold Turkey Blocker to restrict access to some distracting websites, and it worked very well. However, I recently discovered that the built-in browser in Obsidian can bypass these restrictions.
I’m facing the same issue. I use cold turkey blocker but unfortunately Obsidian web viewer can bypass it. I noticed that cold turkey blocker can block based on the title of the window (click Win + Tab and you can see the title of the window). I would block based on the title twitch.obsidian*. Unfortunately, when you click on a link that directs you to a non-blocked site like Google and then search for something like twitch the window title doesn’t update unless you go to a different obsidian file and come back to the web viewer.
I think a useful solution would be to update the title of the window as soon as the link in the address bar changes instead of having to switch notes for the address bar to change cause that can be exploited. Additionally, adding Canvas to the windows title for canvas notes, markdown to the window title for markdown notes, and Web Viewer to the window title for Obsidian’s web viewer would also really help with blocking distractions while still using Obsidian.
I think a solution that might work is using a firewall or customizable DNS to block unwanted sites or outgoing internet traffic in general. I found this tool called Portmaster which is a customizable DNS that’s free and open-source and is not hard to use. I didn’t want to block all internet traffic from Obsidian because I use Obsidian Sync, and would like to access my notes from multiple devices.
In portmaster, if you go to apps and profiles on the left sidebar > click obsidian > click settings > under rules you can specify domains that you want to either allow or block like YouTube and Twitch. Or alternatively you can just block internet traffic in obsidian altogether.
I haven’t been following the whole discussion here, I just wanted to add that the webview plugin can be blocked using the program Plucky manual | Plucky manual.
In this program you set up a delay (e.g. 2 hours or 4 days) and can’t change the settings until that much time has passed.
I haven’t found any way to get around this app so far, it can’t easily be uninstalled or anything like that.
I’m trying to figure out how to do this using plucky. I downloaded it on my mac and have the edge browser extension, but I don’t know what to do from there. Any chance you could share a bit more about how you get this to work for blocking the webview plugin?