Closed AntoineJT closed 3 years ago
Je garde le test unitaire, il ne vérifie pas l'ouverture du fichier mais que le "parser" ignore bien les commentaires dans l'output. Avant de squash merge cette PR, il faudra bien entendu détailler cette nouvelle fonctionnalité dans le README
Discordbot/2.0
) pour lesquels nous n'aurons pas à consommer d'utilisation, mais auxquels nous n'aurons carrément pas à renvoyer le contenu de la page, mais uniquement le <head>
This commit adds a view count whitelist: a txt file containing IP addresses which may not decrement remaining views counter.
When using the bin, it is annoying to burn views because of the discord preview system (see #91).
That's why I implemented a list of whitelisted IP addresses, containing only Discord bot IPs for the moment. Because it may contain more IPs in the future, I implemented a basic txt parser, allowing to add comments starting with
#
.I also added a unit test with it, because I don't want it to be broken.
Please note that this list is not official and is subject to changes. It is therefore not fully reliable, but this is largely better than matching on the user-agent, which is something not reliable at all.
Maybe we can combine both technique: like logging the user-agents containing
Discordbot/2.0;
, and counting views on whitelisted IPs that do not contain this in their user-agent. That's an idea for later, but for now, I don't think this is useful and therefore, we can make use of this new system, for other things later maybe.