asciimoo / morty

Privacy aware web content sanitizer proxy as a service
GNU Affero General Public License v3.0
484 stars 57 forks source link

Site replacement #91

Open the0d0re9 opened 4 years ago

the0d0re9 commented 4 years ago

Implementation for #90

asciimoo commented 4 years ago

This can be definitely a useful feature with some polishing. First of all, I would make URLs configurable. Also, I wouldn't make it enabled by default.

the0d0re9 commented 4 years ago

URLs are configurable in the source code, and it's behind a environment variable to enable it, didn't want to enable it by default :-)

asciimoo commented 4 years ago

var REPLACE_SITES = os.Getenv("REPLACE_SITES") != "false"

It means it is active every case by default except you explicitly specify REPLACE_SITES="false" environment variable, so it is enabled by default.

URLs are configurable in the source code,

It isn't configurable, you have to recompile your code every time you'd want to change it. By configurable I mean a config file for example.

the0d0re9 commented 4 years ago

var REPLACE_SITES = os.Getenv("REPLACE_SITES") != "false"

It means it is active every case by default except you explicitly specify REPLACE_SITES="false" environment variable, so it is enabled by default.

URLs are configurable in the source code,

It isn't configurable, you have to recompile your code every time you'd want to change it. By configurable I mean a config file for example.

Damn that is embarrassing, sorry, I wrote the code last night a bit too early into the morning.

Oh dear, sorry about that. The logic never clicked in my head. Just assumed DEBUG would be disabled by default. My bad, alright. Any specific format you'd want for the configurable URLs? Also are you on Matrix? Tried to look for you in the searx channels but couldn't find you.

I think Morty is an awesome project, and I'm hoping to contribute some more changes I've been running on my instance and playing about with.

asciimoo commented 4 years ago

Damn that is embarrassing, sorry, I wrote the code last night a bit too early into the morning.

No need to apologize, we all make mistakes, that's why code review is useful. =)

Any specific format you'd want for the configurable URLs?

It would be good to use an easily editable user-readable format, what about JSON or a simple CSV?

Tried to look for you in the searx channels but couldn't find you.

I'm online both on freenode's and ircnet's #searx channel.

I think Morty is an awesome project, and I'm hoping to contribute some more changes I've been running on my instance and playing about with.

Awesome!

the0d0re9 commented 4 years ago

Added json config support and swapped to using flags rather than environment variables. :-)

the0d0re9 commented 4 years ago

Sorry for the force pushes, git is not kind to mistakes :-(

the0d0re9 commented 4 years ago

Another consideration to make, should we modify the banner to say some sites have been remapped? Obviously most of the people operating morty wouldn't abuse this maliciously, but it may be worth adding just for clarity to users.

asciimoo commented 4 years ago

Another consideration to make, should we modify the banner to say some sites have been remapped? Obviously most of the people operating morty wouldn't abuse this maliciously, but it may be worth adding just for clarity to users.

This is definitely a good idea

the0d0re9 commented 4 years ago

Another consideration to make, should we modify the banner to say some sites have been remapped? Obviously most of the people operating morty wouldn't abuse this maliciously, but it may be worth adding just for clarity to users.

This is definitely a good idea

Any preference on where this message is? or how we show the user that?

asciimoo commented 4 years ago

Any preference on where this message is? or how we show the user that?

Probably the best would be to display it on the currently viewed page if there are rewrites. What do you think?

the0d0re9 commented 4 years ago

Any preference on where this message is? or how we show the user that?

Probably the best would be to display it on the currently viewed page if there are rewrites. What do you think?

Works for me, this will require quite a bit of a refactor as the current layout of the codebase isn't super suitable for that sort of thing, is that alright?

asciimoo commented 4 years ago

I have some local changes, let me push it, probably it will make the implementation easier.

asciimoo commented 4 years ago

Pushed, take a look at the new body extension, it uses go templates, which probably makes it easier to add new values to it.

the0d0re9 commented 4 years ago

That does make it much easier, thank you :-)

asciimoo commented 4 years ago

No problem. The new layout can be buggy with sites using fancy css, so it needs a bit more refinement, but we can do it later. I tested it with quite a few sites and it works well so far.

the0d0re9 commented 4 years ago

No problem. The new layout can be buggy with sites using fancy css, so it needs a bit more refinement, but we can do it later. I tested it with quite a few sites and it works well so far.

Still tracking this, just had some personal issues that mean I've been unable to code for the last few days

asciimoo commented 4 years ago

Still tracking this, just had some personal issues that mean I've been unable to code for the last few days

Thanks, no worries, take your time. =]

mutageneral commented 3 years ago

@the0d0re9 so how is it going? no pressure, just a friendly reminder this existed :)