Added more / Adjusted the rendering to less recommend problematic things

This commit is contained in:
jyamihud 2022-04-02 18:28:29 +03:00
parent 5a9f686081
commit 2f0aeaf9cf
10 changed files with 125 additions and 10 deletions

17
apps/android.json Normal file
View file

@ -0,0 +1,17 @@
{"names":["Android"],
"comment":"A Mobile Operating System developed mostly by Google.",
"links":{"website":"https://www.android.com/",
"git":"https://android.googlesource.com/",
"wikipedia":"https://en.wikipedia.org/wiki/Android_(operating_system)",
"icon":"https://upload.wikimedia.org/wikipedia/commons/3/31/Android_robot_head.svg"},
"licenses":["GPL-2.0", "Apache-2.0"],
"platforms":["Mobile"],
"interface":["Touch"],
"networks_read":[],
"networks_write":[],
"formats_read":[],
"formats_write":[],
"generic_name":["Mobile Operating System", "Android/Linux"],
"issues":["Surveillance",
"Includes Non-Free Software",
"Relies on Non-Free Services"]}

View file

@ -1,6 +1,6 @@
{"names":["Dragora GNU/Linux-Libre",
"Dragora"],
"comment":"Guix comes with thousands of packages which include applications, system tools, documentation, fonts, and other digital goods readily available for installing with the GNU Guix package manager.",
"comment":"Dragora is a complete and reliable distribution of the GNU/Linux operating system that is entirely free software.",
"links":{"website":"https://dragora.org/en/index.html",
"git":"https://notabug.org/dragora/dragora",
"wikipedia":"https://en.wikipedia.org/wiki/Dragora",

16
apps/ios.json Normal file
View file

@ -0,0 +1,16 @@
{"names":["iOS"],
"comment":"A proprietary Mobile Operating System from Apple. Used in iPhones.",
"links":{"website":"apple.com",
"wikipedia":"https://en.wikipedia.org/wiki/iOS",
"icon":"https://upload.wikimedia.org/wikipedia/commons/a/ab/Icon-Mac.svg"},
"platforms":["iPhone", "iPad"],
"interface":["iOS"],
"networks_read":[],
"networks_write":[],
"formats_read":[],
"formats_write":[],
"generic_name":["Mobile Operating System"],
"issues":["Surveillance",
"Subscription",
"Non-Free Software",
"DRM"]}

18
apps/macos.json Normal file
View file

@ -0,0 +1,18 @@
{"names":["macOS",
"OSX",
"macOS X"],
"comment":"A proprietary Operating System from Apple.",
"links":{"website":"apple.com",
"wikipedia":"https://en.wikipedia.org/wiki/MacOS",
"icon":"https://upload.wikimedia.org/wikipedia/commons/a/ab/Icon-Mac.svg"},
"platforms":["PC"],
"interface":["macOS"],
"networks_read":[],
"networks_write":[],
"formats_read":[],
"formats_write":[],
"generic_name":["Operating System"],
"issues":["Surveillance",
"Subscription",
"Non-Free Software",
"DRM"]}

17
apps/macos.json~ Normal file
View file

@ -0,0 +1,17 @@
{"names":["Windows",
"Microsoft Windows"],
"comment":"A proprietary Operating System from Microsoft.",
"links":{"website":"microsoft.com",
"wikipedia":"https://en.wikipedia.org/wiki/Windows",
"icon":"https://upload.wikimedia.org/wikipedia/commons/9/94/M_box.svg"},
"platforms":["PC"],
"interface":["windows"],
"networks_read":[],
"networks_write":[],
"formats_read":[],
"formats_write":[],
"generic_name":["Operating System"],
"issues":["Surveillance",
"Subscription",
"Non-Free Software",
"DRM"]}

View file

@ -11,4 +11,5 @@
"networks_write":[],
"formats_read":[],
"formats_write":[],
"generic_name":["Operating System", "GNU/Linux"]}
"generic_name":["Operating System", "GNU/Linux",
"Mobile Operating System"]}

14
apps/replicant.json Normal file
View file

@ -0,0 +1,14 @@
{"names":["Replicant"],
"comment":"Replicant is a fully free Android distribution running on several devices, a free software mobile operating system putting the emphasis on freedom and privacy/security",
"links":{"website":"https://replicant.us/",
"git":"https://git.replicant.us/replicant",
"wikipedia":"https://en.wikipedia.org/wiki/Replicant_(operating_system)",
"icon":"https://upload.wikimedia.org/wikipedia/commons/thumb/8/8c/Replicant_logo_alpha.svg/120px-Replicant_logo_alpha.svg.png"},
"licenses":["GPL-3.0-or-later"],
"platforms":["Mobile"],
"interface":["Touch"],
"networks_read":[],
"networks_write":[],
"formats_read":[],
"formats_write":[],
"generic_name":["Mobile Operating System", "Android/Linux"]}

17
apps/windows.json Normal file
View file

@ -0,0 +1,17 @@
{"names":["Windows",
"Microsoft Windows"],
"comment":"A proprietary Operating System from Microsoft.",
"links":{"website":"microsoft.com",
"wikipedia":"https://en.wikipedia.org/wiki/Windows",
"icon":"https://upload.wikimedia.org/wikipedia/commons/9/94/M_box.svg"},
"platforms":["PC"],
"interface":["windows"],
"networks_read":[],
"networks_write":[],
"formats_read":[],
"formats_write":[],
"generic_name":["Operating System"],
"issues":["Surveillance",
"Subscription",
"Non-Free Software",
"DRM"]}

View file

@ -33,14 +33,14 @@ def html(page, json):
page = page + "<p>"+comment+"</p>"
# I want to show nothing else from if it's proprietary
if not free:
if "issues" in json:
l = json.get("issues", [])
page = page +"<h2>Anti-Features / Problems:</h2>"
for i in l:
page = page + "<br>&nbsp;&nbsp;"+i
page = page + "&nbsp;&nbsp;"+i+"<br>"
if not free:
return page
@ -87,7 +87,6 @@ def html(page, json):
"networks_write":"Interacts / Publishes to",
"formats_read":"Opens from File-Formats",
"formats_write":"Saves to File-Formats",
"issues":"Anti-Features / Problems",
"interface":"Interface",
"languages":"Programming Languages"}
@ -119,16 +118,27 @@ def suggestions(page, json):
for i in found:
if i[0] > biggest:
biggest = i[0]
more = False
for i in found:
free = search.is_free(i[-1])
if not i[0] or i[-1] == json or not free:
continue
try:
frac = int(i[0]/biggest*100)
except:
frac = 0
page = page + "<hr><br>Features match: " + str(int(i[0]/biggest*100)) + "%"
if frac < 40 and not more: # Below 40% features match
page = page + """<hr><details>
<summary><h1 title="Click to show more / less.">Problematic Competitors:</h1></summary>"""
more = True
page = page + "<hr><br>Features match: " + str(frac) + "%"
page = html(page, i[-1])
if more:
page = page + "</details>"
return page
def search_widget(page):

View file

@ -88,7 +88,12 @@ def suggest(json_data):
for b in json_data.get(c, []):
if b in i.get(c, []):
score += 1
# If software has issues of any kind we move it down.
if "issues" in i and score:
score = max(0.1, score - len(i["issues"]))
found.append([score, i])
try: