NanoAdblocker / NanoCore

An adblocker
GNU General Public License v3.0
457 stars 22 forks source link

add auto-update of the title #129

Open KonoromiHimaries opened 6 years ago

KonoromiHimaries commented 6 years ago

example. https://gist.githubusercontent.com/KonoromiHimaries/479fe60bbc5691500e23231217b6974c/raw/adfe9c3fe91603742a9c6cb0a498302276995ee6/test

2018-03-03-nano panel sterowania

and when i change ! Title: test1 to ! Title: test2 and update my filters https://gist.githubusercontent.com/KonoromiHimaries/479fe60bbc5691500e23231217b6974c/raw/994971f318aad6c605296f3273752f5e9460ab7f/test

i still have the same title name in the panel

2018-03-03-nano panel sterowania

jspenguin2017 commented 6 years ago

Yea, I noticed this too. The title is only parsed when importing the filter.

jspenguin2017 commented 6 years ago

I'm not sure if allowing the title to update would open potential abuse. If the title changes unexpectedly, the user can get confused.

KonoromiHimaries commented 6 years ago

would open potential abuse.

maybe you can create a blacklist of the filter-lists?

If the title changes unexpectedly, the user can get confused.

maybe you can add a code-name or also anything. example. hash, specific filter icon

jspenguin2017 commented 6 years ago

maybe you can create a blacklist of the filter-lists?

I will implement a blacklist, but I ain't got time to police filter names.

maybe you can add a code-name or also anything. example. hash, specific filter icon

No. If I ever accept icon for filter lists, I'll let the list author to choose the icon. It doesn't make sense for me to impose an icon on their filters.

jspenguin2017 commented 6 years ago

Actually, the title for custom filters are always parsed, but it is not saved past the first fetch.

The title entry of nano.availableFilterLists seems to be updated, but I'm not sure how is that handled after, I need to trace it deeper. The title doesn't update for uBO neither, right?

jspenguin2017 commented 6 years ago

I think I figured out why, adding new filter will run the following code:

        // In nano.loadFilterLists
        vAPI.storage.set({ 'availableFilterLists': µb.availableFilterLists });

        vAPI.messaging.broadcast({
            what: 'staticFilteringDataChanged',
            parseCosmeticFilters: µb.userSettings.parseAllABPHideFilters,
            ignoreGenericCosmeticFilters: µb.userSettings.ignoreGenericCosmeticFilters,
            listKeys: loadedListKeys
        });

Which stores the title and updates the dashboard, but updating the filter will not run the code above.

I think if you add or remove another filter then the title would update, I haven't test it though, I'll classify this as a bug and not by design.

cc @gorhill