From 2f0aeaf9cf2dac69d635db3de3c4c319e148a355 Mon Sep 17 00:00:00 2001 From: jyamihud Date: Sat, 2 Apr 2022 18:28:29 +0300 Subject: [PATCH] Added more / Adjusted the rendering to less recommend problematic things --- apps/android.json | 17 +++++++++++++++++ apps/dragora.json | 2 +- apps/ios.json | 16 ++++++++++++++++ apps/macos.json | 18 ++++++++++++++++++ apps/macos.json~ | 17 +++++++++++++++++ apps/pureOS.json | 3 ++- apps/replicant.json | 14 ++++++++++++++ apps/windows.json | 17 +++++++++++++++++ modules/render.py | 24 +++++++++++++++++------- modules/search.py | 7 ++++++- 10 files changed, 125 insertions(+), 10 deletions(-) create mode 100644 apps/android.json create mode 100644 apps/ios.json create mode 100644 apps/macos.json create mode 100644 apps/macos.json~ create mode 100644 apps/replicant.json create mode 100644 apps/windows.json diff --git a/apps/android.json b/apps/android.json new file mode 100644 index 0000000..30cb1cb --- /dev/null +++ b/apps/android.json @@ -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"]} diff --git a/apps/dragora.json b/apps/dragora.json index cf001fc..18c81fd 100644 --- a/apps/dragora.json +++ b/apps/dragora.json @@ -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", diff --git a/apps/ios.json b/apps/ios.json new file mode 100644 index 0000000..d311703 --- /dev/null +++ b/apps/ios.json @@ -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"]} diff --git a/apps/macos.json b/apps/macos.json new file mode 100644 index 0000000..8932c0e --- /dev/null +++ b/apps/macos.json @@ -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"]} diff --git a/apps/macos.json~ b/apps/macos.json~ new file mode 100644 index 0000000..5920bf2 --- /dev/null +++ b/apps/macos.json~ @@ -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"]} diff --git a/apps/pureOS.json b/apps/pureOS.json index 6cba3e6..cf7c136 100644 --- a/apps/pureOS.json +++ b/apps/pureOS.json @@ -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"]} diff --git a/apps/replicant.json b/apps/replicant.json new file mode 100644 index 0000000..fa8b774 --- /dev/null +++ b/apps/replicant.json @@ -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"]} diff --git a/apps/windows.json b/apps/windows.json new file mode 100644 index 0000000..5920bf2 --- /dev/null +++ b/apps/windows.json @@ -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"]} diff --git a/modules/render.py b/modules/render.py index a7403ab..2ba8b64 100644 --- a/modules/render.py +++ b/modules/render.py @@ -33,14 +33,14 @@ def html(page, json): page = page + "

"+comment+"

" # I want to show nothing else from if it's proprietary - if not free: - + if "issues" in json: l = json.get("issues", []) page = page +"

Anti-Features / Problems:

" for i in l: - page = page + "
  "+i + page = page + "  "+i+"
" + 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 + "

Features match: " + str(int(i[0]/biggest*100)) + "%" + if frac < 40 and not more: # Below 40% features match + page = page + """
+

Problematic Competitors:

""" + more = True + + page = page + "

Features match: " + str(frac) + "%" page = html(page, i[-1]) - + + if more: + page = page + "
" return page def search_widget(page): diff --git a/modules/search.py b/modules/search.py index a5054e3..c94fa97 100644 --- a/modules/search.py +++ b/modules/search.py @@ -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: