Commit 3b8bd7b44b

3b8bd7b44bd44dab8f8f6066d993a098e084165d

parent: afb5c8f830

Unsigned

Alicia Sykes <alicia@omg.lol> · 2024-03-01 18:04 UTC

Improved additional info to display for each listing

Layout: unified · split

web/src/components/things/PrivacyPolicyDetails.astro +17 −3
@@ -28,7 +28,7 @@ const getIconName = (clasification: string) => {
2828 {(priv.points && priv.points.length) > 0 && (
2929 <div class="left">
3030 <h4>Privacy Policy Summary</h4>
31 <ul>
31 <ul class="no-point">
3232 {priv.points.map((point) => (
3333 <li class={`clasification ${point.case.classification}`}>
3434 <FontAwesome iconName={getIconName(point.case.classification)} />
@@ -70,8 +70,11 @@ const getIconName = (clasification: string) => {
7070 )}
7171 {priv.points && priv.points.length > 0 && (
7272 <h4>About the Data</h4>
73 <p>This data is kindly provided by <a href="https://tosdr.org/">tosdr.org</a></p>
74 <p>View the full report at: <a href={`https://tosdr.org/en/service/${priv.id}`}>tosdr.org/en/service/{priv.id}</a></p>
73 <p class="about-tosdr">
74 This data is kindly provided by <a href="https://tosdr.org/">tosdr.org</a>.
75 Read full report at: <a href={`https://tosdr.org/en/service/${priv.id}`}>#{priv.id}</a>
76
77 </p>
7578 )}
7679 </div>
7780</div>
@@ -111,6 +114,7 @@ h4 {
111114 li {
112115 :global(svg) {
113116 width: 1rem;
117 margin-right: 0.2rem;
114118 }
115119 &.clasification {
116120 &.good :global(svg) { color: #35b969; }
@@ -137,6 +141,10 @@ h4 {
137141 opacity: 0.7;
138142 }
139143 }
144 &.no-point {
145 list-style: none;
146 padding-left: 0.25rem;
147 }
140148 }
141149
142150 .rating {
@@ -158,4 +166,10 @@ h4 {
158166 color: var(--rating-color);
159167 border-color: var(--rating-color);
160168 }
169
170 .about-tosdr {
171 display: inline;
172 font-size: 0.8rem;
173 opacity: 0.7;
174 }
161175</style>
web/src/pages/[...listing].astro +155 −12
@@ -12,6 +12,8 @@ import { fetchGitHubStats } from '@utils/fetch-repo-info';
1212import { fetchTosdrPrivacy } from '@utils/fetch-privacy-policy';
1313import { fetchWebsiteInfo } from '@utils/fetch-website-info';
1414import { parseMarkdown, formatLink } from '@utils/parse-markdown';
15import FontAwesome from '@components/form/FontAwesome.svelte';
16import Button from '@components/form/Button.astro';
1517
1618interface Props extends Service {
1719 slug: string;
@@ -27,9 +29,9 @@ const {
2729 tosdrId,
2830 icon,
2931 followWith,
30 // securityAudited,
31 // openSource,
32 // acceptsCrypto,
32 securityAudited,
33 openSource,
34 acceptsCrypto,
3335 parentSection,
3436 categoryName,
3537} = Astro.props;
@@ -103,14 +105,15 @@ export async function getStaticPaths() {
103105 });
104106}
105107
106// const makePaginationLinks = () => {
107// const index = otherSections.findIndex(section => section.name === title);
108// const previousSection = index > 0 ? otherSections[index - 1].name : null;
109// const nextSection = index < otherSections.length - 1 ? otherSections[index + 1].name : null;
110// return { previous: previousSection, next: nextSection };
111// };
108const makePaginationLinks = () => {
109 const allServices = parentSection.services || [];
110 const index = allServices.findIndex(item => item.name === name);
111 const previousItem = index > 0 ? allServices[index - 1].name : null;
112 const nextItem = index < allServices.length - 1 ? allServices[index + 1].name : null;
113 return { previous: previousItem, next: nextItem };
114};
112115
113// const { previous, next } = makePaginationLinks();
116const { previous, next } = makePaginationLinks();
114117
115118
116119const ignoredSites = ['github.gom', 'wikipedia.'];
@@ -151,7 +154,63 @@ const websiteData = (url && !ignoredSites.some(ignoredSite => url.includes(ignor
151154 data-service-url={formatLink(url)}
152155 src={icon || `https://icon.horse/icon/${formatLink(url)}`}
153156 />
157 <div>
154158 <p class="description" set:html={parseMarkdown(description)}></p>
159 <ul>
160 { url && (
161 <li>
162 <b>Homepage:</b>
163 <a href={url}>{formatLink(url)}</a>
164 </li>
165 )}
166 { github && (
167 <li>
168 <b>GitHub:</b>
169 <a href={`https://github.com/${github}`}>github.com/{github}</a>
170 </li>
171 )}
172 { tosdrId && (
173 <li>
174 <b>ToS;DR:</b>
175 <a href={`https://tosdr.org/en/service/${tosdrId}`}>{`tosdr.org/en/service/${tosdrId}`}</a>
176 </li>
177 )}
178 { url && (
179 <li>
180 <b>Web info:</b>
181 <a href={`https://web-check.xyz/results/${formatLink(url)}`}>{`web-check.xyz/results/${formatLink(url)}`}</a>
182 </li>
183 )}
184 </ul>
185 </div>
186 </div>
187 <div class="highlights">
188 { securityAudited && (
189 <span class="meta-item great" title={`${name} has been security audited by an accredited auditor, with results published publicly`}>
190 <FontAwesome iconName="securityAudited" /> Security Audited
191 </span>
192 )}
193 { acceptsCrypto && (
194 <span class="meta-item great" title={`${name} accepts anonymous payment methods`}>
195 <FontAwesome iconName="cryptoAccepted" /> Crypto Payments Accepted
196 </span>
197 )}
198 { securityAudited === false && (
199 <span class="meta-item warning" title={`${name} has not been audited`}>
200 <FontAwesome iconName="notSecurityAudited" /> No Security Audit
201 </span>
202 )}
203 { (openSource === false) && (
204 <span class="warning">
205 <FontAwesome iconName="closedSource" />
206 Not Open Source
207 </span>
208 )}
209 { openSource || (github && openSource !== false) ? (
210 <span class="meta-item great" title={`${name} is open source`}>
211 <FontAwesome iconName="openSource" /> Open Source
212 </span>
213 ) : null }
155214 </div>
156215 </section>
157216 { privacyData && (
@@ -188,6 +247,24 @@ const websiteData = (url && !ignoredSites.some(ignoredSite => url.includes(ignor
188247 sectionName={parentSection.name}
189248 />
190249 </section>
250
251 <div class="pagination-navigation">
252 { previous ? (
253 <Button url={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(previous)}`}>
254 <span>← Previous</span>
255 <p>{previous}</p>
256 </Button>
257 ) : <p class="nothing"></p>}
258 <a href={`/${slugify(categoryName)}/${slugify(parentSection.name)}`} class="go-to-category">
259 View {parentSection.name} ({(parentSection.services || []).length})
260 </a>
261 { next && (
262 <Button url={`/${slugify(categoryName)}/${slugify(parentSection.name)}/${slugify(next)}`}>
263 <span>Next →</span>
264 <p>{next}</p>
265 </Button>
266 )}
267 </div>
191268 </main>
192269</Layout>
193270
@@ -261,10 +338,29 @@ h3 {
261338.intro {
262339 font-size: 1.2rem;
263340 font-style: italic;
264 opacity: 0.7;
341 opacity: 0.9;
265342 display: flex;
266 align-items: center;
267343 gap: 0.5rem;
344 .service-icon {
345 border-radius: var(--curve-md);
346 margin-top: 1rem;
347 }
348 h4 {
349 margin-bottom: 0;
350 }
351 ul {
352 padding-left: 1rem;
353 list-style: circle;
354 font-style: normal;
355 font-size: 1rem;
356 margin-top: 0;
357 b {
358 font-size: 1rem;
359 font-weight: 400;
360 min-width: 85px;
361 display: inline-block;
362 }
363 }
268364}
269365
270366.pagination-navigation {
@@ -343,4 +439,51 @@ h3 {
343439 }
344440}
345441
442.highlights {
443 display: flex;
444 gap: 1rem;
445 flex-wrap: wrap;
446 align-items: center;
447 justify-content: end;
448
449 .meta-item, .warning {
450 display: flex;
451 align-items: center;
452 // justify-content: center;
453 gap: 0.25rem;
454 opacity: 0.6;
455 font-size: 0.9rem;
456 padding: 0.5rem 0;
457 :global(svg) {
458 color: var(--foreground);
459 width: 1.2rem;
460 height: 1.2rem;
461 }
462 a {
463 text-decoration: none;
464 color: var(--foreground);
465 display: flex;
466 gap: 0.25rem;
467 &:hover {
468 color: var(--accent-3);
469 :global(svg) {
470 color: var(--accent-3);
471 }
472 }
473 }
474 }
475 .warning {
476 color: var(--danger);
477 :global(svg) {
478 color: var(--danger);
479 }
480 }
481 .great {
482 color: #007930; // var(--success);
483 :global(svg) {
484 color: #007930; // var(--success);
485 }
486 }
487}
488
346489</style>
web/src/utils/fetch-privacy-policy.ts +1 −1
@@ -1,6 +1,6 @@
11
22export const fetchTosdrPrivacy = async (serviceId: string): Promise<PrivacyPolicyResponse | null> => {
3 const endpoint = `https://api.tosdr.org/service/v2?id=${serviceId}`;
3 const endpoint = `https://privacy-policies.as93.workers.dev/${serviceId}`;
44 try {
55 return await fetch(endpoint).then((res) => res.json());
66 } catch (error) {