wrote teh todo for tje banner feature

This commit is contained in:
root 2025-02-19 09:00:19 +01:00
parent 77faa0971f
commit fcd7f3d87a
2 changed files with 22 additions and 2 deletions

View file

@ -123,7 +123,7 @@ V1.0.2:
Future Versions: Future Versions:
``` ```
V1.0.2: V1.0.2:
- py: make sure that you can have different banner files: .png .jpeg .jpg and .gif (with a limit of 3Mb) - py: option 4,5 and 10: make sure that you can have different banner files: .png .jpeg .jpg and .gif (with a limit of 3Mb), all with the same resolution of 240x60
- py: in option 1, upon listing new links, if the description isn't empty, consider the link as trusted, and write it verified.csv. If description is empty, write it in unverified.csv instead. - py: in option 1, upon listing new links, if the description isn't empty, consider the link as trusted, and write it verified.csv. If description is empty, write it in unverified.csv instead.
- py: in option 2, upon trusting links, if description doesnt exist, ask the user to write one that isn't empty, and if it does exist, ask the user to press enter to keep the existing description, otherwise write a new one - py: in option 2, upon trusting links, if description doesnt exist, ask the user to write one that isn't empty, and if it does exist, ask the user to press enter to keep the existing description, otherwise write a new one
- py: merge the option 2 and 3 together, and repurpose option 3 to become "edit links attributes" - py: merge the option 2 and 3 together, and repurpose option 3 to become "edit links attributes"

View file

@ -34,6 +34,25 @@ def CheckUrl(url):
#### PROTECTIONS AGAINST MALICIOUS CSV INPUTS #### #### PROTECTIONS AGAINST MALICIOUS CSV INPUTS ####
def CheckBannerURL(path: str) -> str:
"""
In: http://participant.onion/participants/participant.onion/banner
serves to know what the real banner type is, between png, jpg, jpeg and .gif
Out: {png,jpg,jpeg,gif,NOBANNER}
"""
bannercounter=0
# TODO: try to reach (using requests) the URL/banner.{png,jpg,jpeg,gif}
# TODO: if any of them succeed,
# TODO: Check if the banner file is valid using IsBannerValid()
#TODO: if valid: return png/jpg/jpeg/gif
#TODO: if invalid REMOVE the file, and keep going (worst case = return NOBANNER at the bottom)
# TODO: if any of them fail, it should be able to continue
# TODO: if one of them fail, it must keep going and just increment bannercounter once
# TODO: if ALL of them fail, it must return NOBANNER
#TODO in lantern.py: handle when it returns png,jpg,jpeg and gif
#TODO in php: handle when it is not png, how to make sure it finds if its jpg,jpeg or gif
#TODO in lantern.py: handle when it returns NOBANNER
def IsBannerValid(path: str) -> bool: def IsBannerValid(path: str) -> bool:
""" """
Checks if the banner.png file has the correct dimensions (240x60) Checks if the banner.png file has the correct dimensions (240x60)
@ -47,7 +66,8 @@ def IsBannerValid(path: str) -> bool:
if width != 240 or height != 60: if width != 240 or height != 60:
print("INVALID BANNER DIMENSIONS, HEIGHT=",height," WIDTH=",width) print("INVALID BANNER DIMENSIONS, HEIGHT=",height," WIDTH=",width)
return False return False
# TODO:check the filesize, as you can have a gif that has
# TODO: test it on all 4 filetypes with both correct and incorrect resolutions, and with a gif that has the correct resolutions but is more than 3mb
return True return True