web/src/components/things/AddNewService.svelte
303 lines · 9978 bytes
1<script lang="ts">
2 import yaml from 'js-yaml';
3 import { writable } from 'svelte/store';
4 import { makeAdditionRequest } from '../../utils/data-src-delete-n-edit';
5
6 // Defining writable stores for each form field
7 const listingCategory = writable('');
8 const serviceName = writable('');
9 const serviceUrl = writable('');
10 const serviceIcon = writable('');
11 const serviceDescription = writable('');
12 const serviceGithub = writable('');
13 const serviceTosdrId = writable('');
14 const serviceOpenSource = writable(false);
15 const serviceSecurityAudited = writable(false);
16 const serviceCrypto = writable(false);
17 const additionalInfo = writable('');
18
19 $: yamlText = yaml.dump([{
20 name: $serviceName,
21 url: $serviceUrl,
22 icon: $serviceIcon,
23 description: $serviceDescription,
24 github: $serviceGithub,
25 tosdrId: $serviceTosdrId,
26 openSource: $serviceOpenSource,
27 securityAudited: $serviceSecurityAudited,
28 acceptsCrypto: $serviceCrypto,
29 }]);
30
31 $: issueUrl = makeAdditionRequest({
32 listingCategory: $listingCategory,
33 serviceName: $serviceName,
34 serviceUrl: $serviceUrl,
35 serviceIcon: $serviceIcon,
36 serviceDescription: $serviceDescription,
37 serviceGithub: $serviceGithub,
38 serviceTosdrId: $serviceTosdrId,
39 serviceOpenSource: $serviceOpenSource,
40 serviceSecurityAudited: $serviceSecurityAudited,
41 serviceCrypto: $serviceCrypto,
42 additionalInfo: $additionalInfo,
43 }, yamlText);
44
45 // Form submission handler
46 function handleSubmit() {
47 const formData = {
48 listingCategory: $listingCategory,
49 serviceName: $serviceName,
50 serviceUrl: $serviceUrl,
51 serviceIcon: $serviceIcon,
52 serviceDescription: $serviceDescription,
53 serviceGithub: $serviceGithub,
54 serviceTosdrId: $serviceTosdrId,
55 serviceOpenSource: $serviceOpenSource,
56 serviceSecurityAudited: $serviceSecurityAudited,
57 serviceCrypto: $serviceCrypto,
58 additionalInfo: $additionalInfo,
59 };
60 const issueCreationUrl = makeAdditionRequest(formData, yamlText);
61 window.open(issueCreationUrl, '_blank');
62 }
63</script>
64
65<p>
66 Before completing this form, you must ensure that the service you are adding aligns
67 with the <a href="/about#creteria">Requirements</a> for Awesome Privacy.
68 <br />
69 You'll need a GitHub account in order to submit this form.
70</p>
71
72<form on:submit|preventDefault={handleSubmit}>
73 <!-- Category Dropdown -->
74 <div class="form-row">
75 <label for="listing-category">Category</label>
76 <select bind:value={$listingCategory} id="listing-category" required autocomplete="off">
77 <option value="">--Please choose an option--</option>
78 <option value="Essentials">Essentials</option>
79 <option value="Communication">Communication</option>
80 <option value="Security Tools">Security Tools</option>
81 <option value="Networking">Networking</option>
82 <option value="Productivity">Productivity</option>
83 <option value="Utilities">Utilities</option>
84 <option value="Operating Systems">Operating Systems</option>
85 <option value="Development">Development</option>
86 <option value="Home and IoT">Home and IoT</option>
87 <option value="Finance">Finance</option>
88 <option value="Social">Social</option>
89 <option value="Media">Media</option>
90 <option value="Creativity">Creativity</option>
91 </select>
92 <p>
93 Choose the top-level category, which should align with
94 the <a href="/browse">one of these</a>.
95 </p>
96 </div>
97
98 <!-- Listing Name -->
99 <div class="form-row">
100 <label for="service-name">Listing Name</label>
101 <input type="text" bind:value={$serviceName} id="service-name" required autocomplete="off">
102 <p>Enter the name of the app, software or service</p>
103 </div>
104
105 <!-- Listing URL -->
106 <div class="form-row">
107 <label for="service-url">Listing URL</label>
108 <input type="url" bind:value={$serviceUrl} id="service-url" required autocomplete="off">
109 <p>Enter the fully-qualified domain name of the homepage for this listing</p>
110 </div>
111
112 <!-- Listing Icon -->
113 <div class="form-row">
114 <label for="service-icon">Listing Icon</label>
115 <input type="url" bind:value={$serviceIcon} id="service-icon" required autocomplete="off">
116 <p>Paste a URL to a square logo for the service. Dimensions must be no less than 64x64, and no more than 512x512 pixels</p>
117 </div>
118
119 <!-- Listing Description -->
120 <div class="form-row">
121 <label for="service-description">Listing Description</label>
122 <textarea bind:value={$serviceDescription} id="service-description" required autocomplete="off"></textarea>
123 <p>Please provide a description for this listing. Keep it factual and objective. Markdown is supported.</p>
124 </div>
125
126 <!-- GitHub Repository -->
127 <div class="form-row">
128 <label for="service-github">GitHub Repository</label>
129 <input type="text" bind:value={$serviceGithub} id="service-github" required autocomplete="off">
130 <p>
131 Share a link to where the project's source is located.<br />
132 Use the format [user]/[repo] e.g, lissy93/dashy
133 </p>
134 </div>
135
136 <!-- ToS;DR ID -->
137 <div class="form-row">
138 <label for="service-tosdr-id">ToS;DR ID</label>
139 <input type="number" bind:value={$serviceTosdrId} id="service-tosdr-id" autocomplete="off">
140 <p>
141 Has the Privacy policy been documented by <a href="https://tosdr.org/">tosdr.org</a>?
142 If so, please include the report reference below (this is a 3 or 4-digit numerical ID).
143 Skip section if not applicable.
144 </p>
145 </div>
146
147 <!-- Open Source Checkbox -->
148 <div class="form-row">
149 <label for="service-open-source">Is Open Source?</label>
150 <input type="checkbox" bind:checked={$serviceOpenSource} id="service-open-source">
151 <p>Is this service fully open source? Aka, can it be compiled from source by the user, or self-hosted?</p>
152 </div>
153
154 <!-- Security Audited Checkbox -->
155 <div class="form-row">
156 <label for="service-security-audited">Security Audited?</label>
157 <input type="checkbox" bind:checked={$serviceSecurityAudited} id="service-security-audited">
158 <p>Has this service been independently security audited by an accredited auditor?</p>
159 </div>
160
161 <!-- Accepts Crypto Checkbox -->
162 <div class="form-row">
163 <label for="service-crypto">Accepts Anon Payment?</label>
164 <input type="checkbox" bind:checked={$serviceCrypto} id="service-crypto">
165 <p>If this is a hosted and paid for service, does it accept anonymous payment methods, including crypto (e.g., Monero)?</p>
166 </div>
167
168 <div class="final-info">
169 <p>
170 Finally, please provide any supporting material, including:
171 </p>
172 <ul>
173 <li>
174 A justification of why this app/service should be included in the list
175 </li>
176 <li>
177 Links to any published security audit, if they exist
178 </li>
179 <li>
180 Links to the services privacy policy, terms of service and other relevant
181 documents where applicable
182 </li>
183 <li>
184 Your affiliation with the service.
185 For transparency, you must disclose if you are associated
186 with them or any similar items in any way
187 </li>
188 <li>Links to relevant discussions, past issues/PRs related to this service</li>
189 </ul>
190 <textarea bind:value={$additionalInfo} id="additional-info" rows="5"></textarea>
191 </div>
192
193 <button type="submit">Submit</button>
194 <a href={issueUrl} target="_blank" class="open-in-gh">Open in GitHub Issues</a>
195</form>
196
197<div class="output-yaml">
198 <p>Below is the YAML content, which will be appended to the appropriate section
199 within <a href="github.com/lissy93/awesome-privacy/blob/main/awesome-privacy.yml">awesome-privacy.yml</a>
200 upon approval.
201 </p>
202 <pre>{@html yamlText}</pre>
203 <p>Your submission will need to be reviewed by a maintainer and the community before it can be merged.</p>
204</div>
205
206<style lang="scss">
207 .form-row {
208 display: grid;
209 grid-template-columns: 1fr 3fr 2fr;
210 gap: 1rem;
211 padding: 0.5rem 0;
212 &:not(:last-child) {
213 border-bottom: 1px solid var(--transparent-accent);
214 }
215 p {
216 margin: 0;
217 font-size: 0.8rem;
218 opacity: 0.6;
219 }
220 }
221
222 .final-info {
223 display: flex;
224 flex-direction: column;
225 padding: 1rem 0;
226 gap: 1rem;
227 p {
228 margin: 0.5rem 0;
229 }
230 ul {
231 padding-left: 0.25rem;
232 margin: 0 0 0.5rem 0;
233 font-size: 0.8rem;
234 opacity: 0.6;
235 list-style: circle;
236 }
237 }
238
239 input, textarea {
240 width: 100%;
241 border: 1px solid var(--accent-3);
242 border-radius: var(--curve-md);
243 font-size: 1.2rem;
244 padding: 0.5rem 0;
245 &:focus {
246 outline: none;
247 border: 2px solid var(--accent);
248 }
249 }
250 input {
251 height: fit-content;
252 &[type="number"]::-webkit-outer-spin-button,
253 &[type="number"]::-webkit-inner-spin-button {
254 -webkit-appearance: none;
255 margin: 0;
256 }
257 &[type="number"] {
258 -moz-appearance: textfield;
259 }
260 &[type="checkbox"] {
261 width: 2rem;
262 height: 2rem;
263 }
264 }
265 textarea {
266 resize: vertical;
267 }
268 .open-in-gh {
269 margin: 0 auto;
270 font-size: 0.8rem;
271 opacity: 0.6;
272 display: block;
273 text-align: center;
274 }
275
276 button {
277 cursor: pointer;
278 background: var(--accent-3);
279 color: var(--accent-fg);
280 padding: 0.5rem 2rem;
281 border: 1px solid var(--foreground);
282 box-shadow: 3px 3px 0 var(--foreground);
283 border-radius: var(--curve-lg);
284 font-size: 1.8rem;
285 font-family: "Lekton", sans-serif;
286 margin: 1rem auto;
287 display: flex;
288 transition: all 0.2s ease-in-out;
289 &:hover {
290 background: var(--accent);
291 }
292 }
293
294 .output-yaml {
295 pre {
296 font-family: 'Courier New', Courier, monospace;
297 background: #cecbf780;
298 padding: 0.2rem 0.4rem;
299 border-radius: var(--curve-sm);
300 font-size: 0.9rem;
301 }
302 }
303</style>