Commit ccdadeac98
Unsigned
Layout: unified · split
lib/awesome-privacy-readme-gen.py +16 −6
| @@ -35,7 +35,7 @@ def repoElement(repoUrl): | ||
| 35 | 35 | return ( |
| 36 | 36 | f"[[1]}" |
| 38 | "&labelColor=%230d1117&color=%23302982&cacheSeconds=3600)]" | |
| 38 | "&color=%235f53f4&cacheSeconds=3600)]" | |
| 39 | 39 | f"(https://github.com/{repoUrl})" |
| 40 | 40 | ) |
| 41 | 41 | |
| @@ -44,6 +44,16 @@ def tosElement(tosdrId): | ||
| 44 | 44 | return "" |
| 45 | 45 | return f"[](https://tosdr.org/en/service/{tosdrId})" |
| 46 | 46 | |
| 47 | def statsElement(isOpenSource, isSecurityAudited, isAcceptsCrypto): | |
| 48 | statsStr = "" | |
| 49 | if isOpenSource == True: | |
| 50 | statsStr += "📦 Open Source " | |
| 51 | if isSecurityAudited == True: | |
| 52 | statsStr += "🛡️ Security Audited " | |
| 53 | if isAcceptsCrypto == True: | |
| 54 | statsStr += "💰 Accepts Anonymous Payment " | |
| 55 | return statsStr | |
| 56 | ||
| 47 | 57 | def awesomePrivacyReport(categoryName, sectionName, serviceName): |
| 48 | 58 | if not serviceName: |
| 49 | 59 | return "" |
| @@ -51,7 +61,7 @@ def awesomePrivacyReport(categoryName, sectionName, serviceName): | ||
| 51 | 61 | return (name or '').lower().replace(' ', '-') |
| 52 | 62 | return ( |
| 53 | 63 | f"[![{serviceName} on Awesome Privacy]" |
| 54 | f"(https://img.shields.io/badge/{serviceName.replace(' ', '_')}-FC60A8?style=flat&logo=awesomelists&label=Awesome%20Privacy)]" | |
| 64 | f"(https://img.shields.io/badge/View%20Report-FC60A8?style=flat&logo=awesomelists&label={serviceName.replace(' ', '_')})]" | |
| 55 | 65 | f"(https://awesome-privacy.xyz/{slugify(categoryName)}/{slugify(sectionName)}/{slugify(serviceName)})" |
| 56 | 66 | ) |
| 57 | 67 | |
| @@ -67,8 +77,8 @@ def makeHref(text): | ||
| 67 | 77 | return re.sub(r'[^\w\s-]', '', text.lower()).replace(" ", "-") |
| 68 | 78 | |
| 69 | 79 | def makeContents(): |
| 70 | contents = "<details>\n" | |
| 71 | contents += "<summary><h2>Contents</h2></summary>\n" | |
| 80 | contents = "<blockquote><details>\n" | |
| 81 | contents += "<summary>📋 <b>Contents</b></summary>\n" | |
| 72 | 82 | |
| 73 | 83 | for category in data.get('categories'): |
| 74 | 84 | contents += f"\n- **{category.get('name')}**" |
| @@ -77,7 +87,7 @@ def makeContents(): | ||
| 77 | 87 | f"\n\t- [{section.get('name')}](#{makeHref(section.get('name'))}) " |
| 78 | 88 | f"({len(section.get('services') or [])})" |
| 79 | 89 | ) |
| 80 | contents += "\n</details>\n\n" | |
| 90 | contents += "\n</details></blockquote>\n\n" | |
| 81 | 91 | return contents |
| 82 | 92 | |
| 83 | 93 | def makeAwesomePrivacy(): |
| @@ -102,12 +112,12 @@ def makeAwesomePrivacy(): | ||
| 102 | 112 | markdown += ( |
| 103 | 113 | f"- **[{iconElement(app.get('url'), app.get('icon'))} {app.get('name')}]" |
| 104 | 114 | f"({app.get('url')})** - {app.get('description')} " |
| 105 | ||
| 106 | 115 | + (( |
| 107 | 116 | f"\t- <details>\n\t\t<summary>Stats</summary>\n\n\t\t" |
| 108 | 117 | f"{repoElement(app.get('github'))} " |
| 109 | 118 | f"{tosElement(app.get('tosdrId'))} " |
| 110 | 119 | f"{awesomePrivacyReport(category.get('name'), section.get('name'), app.get('name'))} \n" |
| 120 | f"{statsElement(app.get('openSource'), app.get('securityAudited'), app.get('acceptsCrypto'))} \n" | |
| 111 | 121 | f"\n\t\t</details>\n" |
| 112 | 122 | ) |
| 113 | 123 | if app.get('github') or app.get('tosdrId') else '') |