yuanzhoucq / Tab-Space

A Safari extension born for improving your web browsing productivity.
https://mytab.space
102 stars 15 forks source link

[BUG] Doesn't work with Pi-hole #53

Open ssnkhan opened 3 years ago

ssnkhan commented 3 years ago

Describe the bug Does not allow saves if static.mytab.space is blocked, for instance via a Pi-hole.

To Reproduce Steps to reproduce the behavior:

  1. Set global policy to block .space gTLD
  2. Try to save tabs
  3. Cannot move beyond Connecting to Tab Space App...

Expected behavior Should be able to save tabs

Screenshots N/A

Desktop (please complete the following information):

Additional context

  1. Why is there a need for any network activity from this app?
  2. What exactly is being sent or retrieved from static.mytab.space? Can it not be bundled with the app?
  3. Where are my tabs saved -- locally, on iCloud, or a third-party server that you manage?
ssnkhan commented 3 years ago

I can see from Developer tools that the resource being fetched is http://static.mytab.space/storage.html?method=get, the blocking of which causes the following errors:

[Error] Failed to load resource: Could not connect to the server. (storage.html, line 0)
[Error] TypeError: null is not an object (evaluating 'this.bridge.send')
    ie (chunk-vendors.7667d0cc.js:7:12047)
    re (chunk-vendors.7667d0cc.js:7:11959)
    ee (chunk-vendors.7667d0cc.js:7:11604)
    ne (chunk-vendors.7667d0cc.js:7:11807)
    ne (chunk-vendors.7667d0cc.js:7:11670)
    (anonymous function) (chunk-vendors.7667d0cc.js:7:26494)
    toggle (chunk-vendors.7667d0cc.js:68:19664)
    toggle
    change (chunk-vendors.7667d0cc.js:68:22916)
    ne (chunk-vendors.7667d0cc.js:7:11670)

The resource appears to be a simple html file:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Tab Space Storage</title>
</head>
<body>
  <div id="tab-space-backup-storage"></div>
</body>
</html>
gingerbeardman commented 3 years ago

This html page is the basis of the app. Don't block it.

robb-romans commented 3 years ago

This html page is the basis of the app. Don't block it.

What does this mean, please?

@ssnkhan listed the following questions in their original text:

gingerbeardman commented 3 years ago

What does this mean, please?

Tab Space uses this HTML page stub as the basis for its user interface.

I'm just a user so I won't answer the other questions.

gingerbeardman commented 3 years ago

OK I figure I can answer these questions with evidence.

  1. Why is there a need for any network activity from this app?

Web inspector shows:

  1. What exactly is being sent or retrieved from static.mytab.space?

Web inspector shows:

Can it not be bundled with the app?

No idea. Maybe?

Until then you could serve local copies of both from your Pi-Hole using host redirection.

  1. Where are my tabs saved -- locally, on iCloud, or a third-party server that you manage?
ssnkhan commented 3 years ago

Given that storage.html is such a simple (and static) file, it really ought to be bundled with the app, rather than needing to be fetched from a third-party server.

gingerbeardman commented 3 years ago

Sure, though maybe there's a technical reason why it has to be loaded from a server? Only the developer @yuanzhoucq can answer that

yuanzhoucq commented 3 years ago

@gingerbeardman Thanks so much for helping me answer these questions.

@ssnkhan @gingerbeardman In fact, the storage.html thing is a small trick. Apple blocks the communication between a Safari extension and the webpages hosted by any extensions, include itself. I don't know why. So I have to offer a placeholder webpage to make this communication possible. I tried hard to remove it -- but unfortunately I did not come up with a better solution. I have set Cache-Control: max-age=31536000, i.e. one-year valid period, for this file. But it seems that Safari has its own thought...😂

If you have a better solution for this issue, I will be very glad to remove the file from Tab Space. Thanks!

yuanzhoucq commented 3 years ago

A possible solution would be setting up a local web server to host this file. Then Tab Space would be able to work without any external connection. But I think this would consume more system resource than necessary, which makes it inelegant.