|
| 1 | +<template lang="pug"> |
| 2 | +div |
| 3 | + h4.mb-3 Security & CORS |
| 4 | + |
| 5 | + b-alert(show variant="info" class="mb-4") |
| 6 | + h5.alert-heading Require Restart |
| 7 | + p.mb-0 Changing settings in this section requires stopping and restarting the server for the changes to take effect. |
| 8 | + |
| 9 | + b-form-group(label="Fixed CORS origins" label-cols-md=4 description="Configure general CORS origins with exact matches (e.g. http://localhost:8080). Comma-separated.") |
| 10 | + b-input(v-model="cors" type="text") |
| 11 | + |
| 12 | + b-form-group(label="Regex CORS origins" label-cols-md=4 description="Configure CORS origins with regular expressions. Useful for browser extensions (e.g. chrome-extension://.* or moz-extension://.*). Comma-separated.") |
| 13 | + b-input(v-model="corsregex" type="text") |
| 14 | + |
| 15 | + h5.mt-4 Extensions Shortcuts |
| 16 | + b-form-group(label-cols-md=4) |
| 17 | + b-form-checkbox(v-model="cors_allow_aw_chrome_extension") Allow ActivityWatch extension (Chrome) |
| 18 | + template(#description) |
| 19 | + div Chrome extensions use a stable, persistent ID, so the official extension is reliably supported. |
| 20 | + |
| 21 | + b-form-group(label-cols-md=4) |
| 22 | + b-form-checkbox(v-model="cors_allow_all_mozilla_extension") Allow all Firefox extensions (DANGEROUS) |
| 23 | + template(#description) |
| 24 | + div Every version of a Mozilla extension has its own ID to avoid fingerprinting. This is why you must either allow all extensions or manually configure your specific ID. |
| 25 | + div.mt-2.text-danger(v-if="cors_allow_all_mozilla_extension") |
| 26 | + | ⚠️ DANGEROUS: Not recommended for security. If enabled, any installed extension can access your ActivityWatch data. Use this only if you know what extensions you have and assume full responsibility. |
| 27 | + div(v-else) |
| 28 | + | Recommended for security. To allow a specific extension safely: |
| 29 | + ol.mt-2.mb-1 |
| 30 | + li Go to <code>about:debugging#/runtime/this-firefox</code> in your browser. |
| 31 | + li Look for your extension and copy the <b>Manifest URL</b> (e.g. <code>moz-extension://4b931c07dededdedff152/manifest.json</code>). |
| 32 | + li Remove <code>manifest.json</code> from the end (to get <code>moz-extension://4b931c07dededdedff152</code>). |
| 33 | + li Paste it into the <b>Regex CORS origins</b> field above (use a comma to separate if not empty). |
| 34 | + |
| 35 | + |
| 36 | +</template> |
| 37 | + |
| 38 | +<script lang="ts"> |
| 39 | +import { useSettingsStore } from '~/stores/settings'; |
| 40 | +
|
| 41 | +export default { |
| 42 | +
|
| 43 | + computed: { |
| 44 | + cors: { |
| 45 | + get() { |
| 46 | + return useSettingsStore().cors; |
| 47 | + }, |
| 48 | + set(cors) { |
| 49 | + useSettingsStore().update({ cors }); |
| 50 | + }, |
| 51 | + }, |
| 52 | + corsregex: { |
| 53 | + get() { |
| 54 | + return useSettingsStore().cors_regex; |
| 55 | + }, |
| 56 | + set(cors_regex) { |
| 57 | + useSettingsStore().update({ cors_regex }); |
| 58 | + }, |
| 59 | + }, |
| 60 | + cors_allow_aw_chrome_extension: { |
| 61 | + get() { |
| 62 | + return useSettingsStore().cors_allow_aw_chrome_extension; |
| 63 | + }, |
| 64 | + set(cors_allow_aw_chrome_extension) { |
| 65 | + useSettingsStore().update({ cors_allow_aw_chrome_extension }); |
| 66 | + }, |
| 67 | + }, |
| 68 | + cors_allow_all_mozilla_extension: { |
| 69 | + get() { |
| 70 | + return useSettingsStore().cors_allow_all_mozilla_extension; |
| 71 | + }, |
| 72 | + set(cors_allow_all_mozilla_extension) { |
| 73 | + useSettingsStore().update({ cors_allow_all_mozilla_extension }); |
| 74 | + }, |
| 75 | + }, |
| 76 | + }, |
| 77 | +}; |
| 78 | +</script> |
0 commit comments