web/src/components/things/AddNewService.svelte

391 lines · 13291 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 serviceIosApp = writable('');
 15  const serviceAndroidApp = writable('');
 16  const serviceDiscordInvite = writable('');
 17  const serviceSubreddit = writable('');
 18  const serviceOpenSource = writable(false);
 19  const serviceSecurityAudited = writable(false);
 20  const serviceCrypto = writable(false);
 21  const additionalInfo = writable('');
 22  
 23  $: yamlText = yaml.dump([{
 24        name: $serviceName,
 25        url: $serviceUrl,
 26        icon: $serviceIcon,
 27        description: $serviceDescription,
 28        github: $serviceGithub,
 29        tosdrId: $serviceTosdrId,
 30        iosApp: $serviceIosApp,
 31        androidApp: $serviceAndroidApp,
 32        discordInvite: $serviceDiscordInvite,
 33        subreddit: $serviceSubreddit,
 34        openSource: $serviceOpenSource,
 35        securityAudited: $serviceSecurityAudited,
 36        acceptsCrypto: $serviceCrypto,
 37    }]);
 38
 39  $: issueUrl = makeAdditionRequest({
 40      listingCategory: $listingCategory,
 41      serviceName: $serviceName,
 42      serviceUrl: $serviceUrl,
 43      serviceIcon: $serviceIcon,
 44      serviceDescription: $serviceDescription,
 45      serviceGithub: $serviceGithub,
 46      serviceTosdrId: $serviceTosdrId,
 47      serviceIosApp: $serviceIosApp,
 48      serviceAndroidApp: $serviceAndroidApp,
 49      serviceDiscordInvite: $serviceDiscordInvite,
 50      serviceSubreddit: $serviceSubreddit,
 51      serviceOpenSource: $serviceOpenSource,
 52      serviceSecurityAudited: $serviceSecurityAudited,
 53      serviceCrypto: $serviceCrypto,
 54      additionalInfo: $additionalInfo,
 55  }, yamlText);
 56
 57  // Form submission handler
 58  function handleSubmit() {
 59      const formData = {
 60          listingCategory: $listingCategory,
 61          serviceName: $serviceName,
 62          serviceUrl: $serviceUrl,
 63          serviceIcon: $serviceIcon,
 64          serviceDescription: $serviceDescription,
 65          serviceGithub: $serviceGithub,
 66          serviceTosdrId: $serviceTosdrId,
 67          serviceOpenSource: $serviceOpenSource,
 68          serviceSecurityAudited: $serviceSecurityAudited,
 69          serviceCrypto: $serviceCrypto,
 70          additionalInfo: $additionalInfo,
 71          serviceIosApp: $serviceIosApp,
 72          serviceAndroidApp: $serviceAndroidApp,
 73          serviceDiscordInvite: $serviceDiscordInvite,
 74          serviceSubreddit: $serviceSubreddit,
 75      };
 76      const issueCreationUrl = makeAdditionRequest(formData, yamlText);
 77      window.open(issueCreationUrl, '_blank');
 78  }
 79</script>
 80
 81<p>
 82  Before completing this form, you must ensure that the service you are adding aligns
 83  with the <a href="/about#creteria">Requirements</a> for Awesome Privacy.
 84  <br />
 85  You'll need a GitHub account in order to submit this form.
 86</p>
 87
 88<form on:submit|preventDefault={handleSubmit}>
 89
 90  <h3>Basics</h3>
 91  <p class="sub-title-description">
 92    All fields here are required.
 93  </p>
 94
 95  <!-- Category Dropdown -->
 96  <div class="form-row">
 97    <label for="listing-category">Category</label>
 98    <select bind:value={$listingCategory} id="listing-category" required autocomplete="off">
 99      <option value="">--Please choose an option--</option>
100      <option value="Essentials">Essentials</option>
101      <option value="Communication">Communication</option>
102      <option value="Security Tools">Security Tools</option>
103      <option value="Networking">Networking</option>
104      <option value="Productivity">Productivity</option>
105      <option value="Utilities">Utilities</option>
106      <option value="Operating Systems">Operating Systems</option>
107      <option value="Development">Development</option>
108      <option value="Home and IoT">Home and IoT</option>
109      <option value="Finance">Finance</option>
110      <option value="Social">Social</option>
111      <option value="Media">Media</option>
112      <option value="Creativity">Creativity</option>
113    </select>
114    <p>
115      Choose the top-level category, which should align with
116      the <a href="/browse">one of these</a>.
117    </p>
118  </div>
119
120  <!-- Listing Name -->
121  <div class="form-row">
122    <label for="service-name">Listing Name</label>
123    <input type="text" bind:value={$serviceName} id="service-name" required autocomplete="off">
124    <p>Enter the name of the app, software or service</p>
125  </div>
126
127  <!-- Listing URL -->
128  <div class="form-row">
129    <label for="service-url">Listing URL</label>
130    <input type="url" bind:value={$serviceUrl} id="service-url" required autocomplete="off">
131    <p>Enter the fully-qualified domain name of the homepage for this listing</p>
132  </div>
133  
134  <!-- Listing Icon -->
135  <div class="form-row">
136    <label for="service-icon">Listing Icon</label>
137    <input type="url" bind:value={$serviceIcon} id="service-icon" required autocomplete="off">
138    <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>
139  </div>
140
141  <!-- Listing Description -->
142  <div class="form-row">
143    <label for="service-description">Listing Description</label>
144    <textarea bind:value={$serviceDescription} id="service-description" required autocomplete="off"></textarea>
145    <p>Please provide a description for this listing. Keep it factual and objective. Markdown is supported.</p>
146  </div>
147
148  <!-- Section 2 -->
149  <h3>Third-Party Referencing</h3>
150  <p class="sub-title-description">
151    In order to create a comprehensive listing, we combine the data inputted above with other sources,
152    to give additional context and help users make informed decisions.
153    Metrics from these services are fetched automatically at build-time from our API.
154    <br />
155    All fields are optional, but the more information you provide, the better!
156  </p>
157
158  <!-- GitHub Repository -->
159  <div class="form-row">
160    <label for="service-github">GitHub Repository</label>
161    <input type="text" bind:value={$serviceGithub} id="service-github" required autocomplete="off">
162    <p>
163      Share a link to where the project's source is located.<br />
164      Use the format [user]/[repo] e.g, lissy93/dashy
165    </p>
166  </div>
167
168  <!-- ToS;DR ID -->
169  <div class="form-row">
170    <label for="service-tosdr-id">ToS;DR ID</label>
171    <input type="number" bind:value={$serviceTosdrId} id="service-tosdr-id" autocomplete="off">
172    <p>
173      Has the Privacy policy been documented by <a href="https://tosdr.org/">tosdr.org</a>?
174      If so, please include the report reference below (this is a 3 or 4-digit numerical ID).
175      Skip section if not applicable.
176    </p>
177  </div>
178
179  <!-- Apple App Store URL -->
180  <div class="form-row">
181    <label for="service-tosdr-id">iOS App</label>
182    <input type="url" bind:value={$serviceIosApp} id="service-ios-app" autocomplete="off">
183    <p>
184      Paste the link to the mobile app on the Apple App Store.<br />
185      E.g. https://apps.apple.com/us/app/bitwarden-password-manager/id1137397744
186    </p>
187  </div>
188
189  <!-- Google Play App Store URL -->
190  <div class="form-row">
191    <label for="service-tosdr-id">Android App</label>
192    <input type="url" bind:value={$serviceAndroidApp} id="service-android-app" autocomplete="off">
193    <p>
194      Paste the link to the mobile app on the Google Play Store.<br />
195      E.g. https://play.google.com/store/apps/details?id=com.x8bit.bitwarden
196    </p>
197  </div>
198
199  <!-- Discord Server Invite Code -->
200  <div class="form-row">
201    <label for="service-tosdr-id">Discord Invite</label>
202    <input type="text" bind:value={$serviceDiscordInvite} id="service-discord-invite" autocomplete="off">
203    <p>
204      Paste the invite code to the Discord server for this service.<br />
205      E.g. If the invite URL is https://discord.com/invite/4JMAauFZBq the code is 4JMAauFZBq
206    </p>
207  </div>
208
209  <!-- Reddit sub name -->
210  <div class="form-row">
211    <label for="service-tosdr-id">Subreddit</label>
212    <input type="text" bind:value={$serviceSubreddit} id="service-subreddit" autocomplete="off">
213    <p>
214      If the service has a subreddit, please provide the name here.<br />
215      Don't include `r/` in the name, nor the full URL - just the sub name.
216    </p>
217  </div>
218
219  <!-- Section 3 - Checklist and details -->
220  <h3>Privacy Checklist</h3>
221  <p class="sub-title-description">
222    Finally, check the boxes that apply to the service you are submitting,
223    and then provide any additional information to back this up in the text area below.
224  </p>
225
226    <!-- Open Source Checkbox -->
227  <div class="form-row">
228    <label for="service-open-source">Is Open Source?</label>
229    <input type="checkbox" bind:checked={$serviceOpenSource} id="service-open-source">
230    <p>Is this service fully open source? Aka, can it be compiled from source by the user, or self-hosted?</p>
231  </div>
232
233  <!-- Security Audited Checkbox -->
234  <div class="form-row">
235    <label for="service-security-audited">Security Audited?</label>
236    <input type="checkbox" bind:checked={$serviceSecurityAudited} id="service-security-audited">
237    <p>Has this service been independently security audited by an accredited auditor?</p>
238  </div>
239
240  <!-- Accepts Crypto Checkbox -->
241  <div class="form-row">
242    <label for="service-crypto">Accepts Anon Payment?</label>
243    <input type="checkbox" bind:checked={$serviceCrypto} id="service-crypto">
244    <p>If this is a hosted and paid for service, does it accept anonymous payment methods, including crypto (e.g., Monero)?</p>
245  </div>
246
247  <div class="final-info">
248    <p>
249      Finally, please provide any supporting material, including:
250    </p>
251    <ul>
252      <li>
253        A justification of why this app/service should be included in the list
254      </li>
255      <li>
256        Links to any published security audit, if they exist
257      </li>
258      <li>
259        Links to the services privacy policy, terms of service and other relevant
260        documents where applicable
261      </li>
262      <li>
263        Your affiliation with the service.
264        For transparency, you must disclose if you are associated
265        with them or any similar items in any way
266      </li>
267      <li>Links to relevant discussions, past issues/PRs related to this service</li>
268    </ul>
269    <textarea bind:value={$additionalInfo} id="additional-info" rows="5"></textarea>
270  </div>
271
272  <button type="submit">Submit</button>
273  <a href={issueUrl} target="_blank" class="open-in-gh">Open in GitHub Issues</a>
274</form>
275
276<div class="output-yaml">
277  <p>Below is the YAML content, which will be appended to the appropriate section
278    within <a href="github.com/lissy93/awesome-privacy/blob/main/awesome-privacy.yml">awesome-privacy.yml</a>
279    upon approval.
280  </p>
281  <pre>{@html yamlText}</pre>
282  <p>Your submission will need to be reviewed by a maintainer and the community before it can be merged.</p>
283</div>
284
285<style lang="scss">
286  .form-row {
287    display: grid;
288    grid-template-columns: 1fr 3fr 2fr;
289    gap: 1rem;
290    padding: 0.5rem 0;
291    &:not(:last-child) {
292      border-bottom: 1px solid var(--transparent-accent);
293    }
294    p {
295      margin: 0;
296      font-size: 0.8rem;
297      opacity: 0.6;
298    }
299  }
300
301  .final-info {
302    display: flex;
303    flex-direction: column;
304    padding: 1rem 0;
305    gap: 1rem;
306    p {
307      margin: 0.5rem 0;
308    }
309    ul {
310      padding-left: 0.25rem;
311      margin: 0 0 0.5rem 0;
312      font-size: 0.8rem;
313      opacity: 0.6;
314      list-style: circle;
315    }
316  }
317
318  input, textarea, select {
319    width: 100%;
320    border: 1px solid var(--accent-3);
321    border-radius: var(--curve-md);
322    font-size: 1.2rem;
323    padding: 0.5rem 0.25rem;
324    background: var(--background-form);
325    color: var(--foreground);
326    &:focus {
327      outline: none;
328      border: 1px solid var(--accent);
329    }
330  }
331  input {
332    height: fit-content;
333    &[type="number"]::-webkit-outer-spin-button,
334    &[type="number"]::-webkit-inner-spin-button {
335        -webkit-appearance: none;
336        margin: 0;
337    }
338    &[type="number"] {
339        -moz-appearance: textfield;
340    }
341    &[type="checkbox"] {
342      width: 2rem;
343      height: 2rem;
344      background: var(--background-form);
345    }
346  }
347  textarea {
348    resize: vertical;
349  }
350  .open-in-gh {
351    margin: 0 auto;
352    font-size: 0.8rem;
353    opacity: 0.6;
354    display: block;
355    text-align: center;
356  }
357
358  button {
359    cursor: pointer;
360    background: var(--accent-3);
361    color: var(--accent-fg);
362    padding: 0.5rem 2rem;
363    border: 1px solid var(--box-outline);
364    box-shadow: 3px 3px 0 var(--box-outline);
365    border-radius: var(--curve-lg);
366    font-size: 1.8rem;
367    font-family: "Lekton", sans-serif;
368    margin: 1rem auto;
369    display: flex;
370    transition: all 0.2s ease-in-out;
371    &:hover {
372      background: var(--accent);
373    }
374  }
375
376  .sub-title-description {
377    margin-top: 0;
378    font-size: 0.8rem;
379    opacity: 0.6;
380  }
381
382  .output-yaml {
383    pre {
384      font-family: 'Courier New', Courier, monospace;
385      background: var(--background-form);
386      padding: 0.2rem 0.4rem;
387      border-radius: var(--curve-sm);
388      font-size: 0.9rem;
389    }
390  }
391</style>