Merge branch 'master' of BezierQuadratic/FreeCompetitors into master

This commit is contained in:
Jeison Yehuda Amihud (Blender Dumbass) 2022-04-02 06:29:58 +00:00 committed by Gogs
commit b8fd05de4f
5 changed files with 22 additions and 16 deletions

8
licenses.json Normal file
View file

@ -0,0 +1,8 @@
{
"licenses": [
"GNU GPL v3.0",
"GPL3",
"GPL3+",
"MIT"
]
}

Binary file not shown.

Binary file not shown.

View file

@ -7,16 +7,13 @@
# your ability to set it up and running.
from modules import search
import json
def html(page, json):
# This function adds a rendering of the json into the page
free = search.is_free(json)
page = page + "\n <h1>"
try:
page = page + '\n<img src="'+ json["links"]["icon"] + '" alt="Logo" style="width:50px;">'
@ -118,7 +115,6 @@ def suggestions(page, json):
biggest = i[0]
for i in found:
free = search.is_free(i[-1])
if not i[0] or i[-1] == json or not free:

View file

@ -101,14 +101,16 @@ def suggest(json_data):
return found
def is_free(data):
# TODO: Add a more complex algorithm of checking if software is
# free or not. There are plenty of semi-free software like
# Unreal Engine. They have licenses but they do not give the users
# the four essential freedoms.
free = False
if "licenses" in data and data["licenses"]:
free = True
return free
def is_free(app):
if "licenses" in app and app["licenses"]:
matches = 0
with open("licenses.json", "r") as data:
all_licenses = json.load(data)
for license in app["licenses"]:
for license2 in all_licenses["licenses"]:
if license2 == license:
matches = matches + 1
break
if matches == len(app["licenses"]):
return True
return False