mirror of
https://github.com/Dasemu/X-GeoBlock.git
synced 2026-11-26 07:16:10 +00:00
refactor: simplify interface and enable sharing defaults
This commit is contained in:
1 parent
e12164c312
commit
9ba1021acd
11 files changed
+53
-45
No files matched your search
@@ -12,7 +12,7 @@ X GeoBlock is a Manifest V3 browser extension for Chromium and Firefox. While yo
|
||||
- Provides a searchable country and region checklist with flags, an enable switch, and optional hidden-post placeholders.
|
||||
- Includes opt-in debug logging for every lookup and filtering decision.
|
||||
- By default, stores all settings and lookup results only in browser extension storage. No data is sent to third parties unless cloud contribution is explicitly enabled.
|
||||
- Uses the project Cloudflare Worker + D1 collaborative cache at `x-geoblock-cache.dariosevilla.es`, with signed opt-in contributions and three-installation consensus.
|
||||
- Uses the project Cloudflare Worker + D1 collaborative cache at `x-geoblock-cache.dariosevilla.es`, with signed contributions and three-installation consensus. Contributions are enabled by default and can be disabled in settings.
|
||||
|
||||
## Install from source in Chromium
|
||||
|
||||
|
||||
+10
-2
@@ -3,6 +3,7 @@ if (typeof XGeoConfig === "undefined") importScripts("lib/config.js", "lib/cloud
|
||||
const extensionApi = globalThis.browser || chrome;
|
||||
|
||||
const CACHE_KEY = "userCache";
|
||||
const DEFAULTS_MIGRATION_KEY = "defaultsV2Applied";
|
||||
const LOCAL_CACHE_TTL_MS = 30 * 24 * 60 * 60 * 1000;
|
||||
const activeRequests = new Map();
|
||||
const pendingFrameLookups = new Map();
|
||||
@@ -12,8 +13,15 @@ let lastRequestAt = 0;
|
||||
const MAX_CONCURRENT_REQUESTS = 3;
|
||||
|
||||
extensionApi.runtime.onInstalled.addListener(async () => {
|
||||
const current = await extensionApi.storage.sync.get(XGeoConfig.DEFAULT_SETTINGS);
|
||||
await extensionApi.storage.sync.set(current);
|
||||
const current = await extensionApi.storage.sync.get(null);
|
||||
const local = await extensionApi.storage.local.get({ [DEFAULTS_MIGRATION_KEY]: false });
|
||||
const next = { ...XGeoConfig.DEFAULT_SETTINGS, ...current, cloudCacheEndpoint: XGeoConfig.CLOUD_CACHE_ENDPOINT };
|
||||
if (!local[DEFAULTS_MIGRATION_KEY]) {
|
||||
next.showPlaceholder = true;
|
||||
next.contributeCloudCache = true;
|
||||
await extensionApi.storage.local.set({ [DEFAULTS_MIGRATION_KEY]: true });
|
||||
}
|
||||
await extensionApi.storage.sync.set(next);
|
||||
});
|
||||
|
||||
extensionApi.runtime.onMessage.addListener((message, sender, sendResponse) => {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
# Collaborative cloud cache
|
||||
|
||||
The cloud cache uses the Cloudflare Worker and D1 schema in `worker/`. Extension builds use `https://x-geoblock-cache.dariosevilla.es` for reads. Contributing observations is a separate opt-in choice.
|
||||
The cloud cache uses the Cloudflare Worker and D1 schema in `worker/`. Extension builds use `https://x-geoblock-cache.dariosevilla.es` for reads. Contributing observations is enabled by default and can be disabled in settings.
|
||||
|
||||
## Data flow
|
||||
|
||||
|
||||
+1
-1
@@ -6,4 +6,4 @@ The extension reads public account About pages from `x.com` using the X session
|
||||
|
||||
The extension reads post author links in X timelines only to decide whether to display those posts. It does not read or store post text.
|
||||
|
||||
The collaborative cache at `x-geoblock-cache.dariosevilla.es` receives SHA-256 hashes of public usernames for lookups. If contribution is enabled separately, signed reports also contain the observed location, timestamp, and parser version. The service never receives following relationships, blacklist settings, post contents, or raw usernames. Public username hashes remain enumerable and must not be treated as anonymous data.
|
||||
The collaborative cache at `x-geoblock-cache.dariosevilla.es` receives SHA-256 hashes of public usernames for lookups. Contributions are enabled by default and can be disabled in settings; signed reports contain the observed location, timestamp, and parser version. The service never receives following relationships, blacklist settings, post contents, or raw usernames. Public username hashes remain enumerable and must not be treated as anonymous data.
|
||||
+2
-2
@@ -7,10 +7,10 @@
|
||||
enabled: true,
|
||||
blacklist: [],
|
||||
skipFollowed: true,
|
||||
showPlaceholder: false,
|
||||
showPlaceholder: true,
|
||||
debugMode: false,
|
||||
cloudCacheEndpoint: CLOUD_CACHE_ENDPOINT,
|
||||
contributeCloudCache: false
|
||||
contributeCloudCache: true
|
||||
});
|
||||
|
||||
const COUNTRY_ALIASES = Object.freeze({
|
||||
|
||||
+13
-14
@@ -1,37 +1,36 @@
|
||||
:root { color-scheme:dark; font:15px/1.5 Inter,ui-sans-serif,system-ui,sans-serif; --bg:#060a0e; --panel:#0b1218; --panel2:#0e1820; --line:#1b2b36; --line2:#28404d; --text:#e8f7fb; --muted:#78909c; --cyan:#45e6ff; --lime:#adff2f; --amber:#ffbe55; }
|
||||
:root { color-scheme:dark; font:15px/1.5 Inter,ui-sans-serif,system-ui,sans-serif; --bg:#090d12; --panel:#111920; --panel2:#142029; --line:#293944; --line2:#38505e; --text:#f3f7f9; --muted:#a4b2ba; --cyan:#58ddf2; --lime:#b7f45b; --amber:#ffbe55; }
|
||||
* { box-sizing:border-box; }
|
||||
body { margin:0; min-height:100vh; background:radial-gradient(circle at 70% -20%,#102c39 0,transparent 38%),var(--bg); color:var(--text); }
|
||||
body::before { content:""; position:fixed; inset:0; pointer-events:none; opacity:.22; background-image:linear-gradient(rgba(69,230,255,.055) 1px,transparent 1px),linear-gradient(90deg,rgba(69,230,255,.055) 1px,transparent 1px); background-size:32px 32px; mask-image:linear-gradient(to bottom,#000,transparent 80%); }
|
||||
body::before { content:""; position:fixed; inset:0; pointer-events:none; opacity:.12; background-image:linear-gradient(rgba(69,230,255,.055) 1px,transparent 1px),linear-gradient(90deg,rgba(69,230,255,.055) 1px,transparent 1px); background-size:32px 32px; mask-image:linear-gradient(to bottom,#000,transparent 80%); }
|
||||
.noise { position:fixed; inset:0; pointer-events:none; opacity:.025; background-image:url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
|
||||
main { position:relative; width:min(920px,calc(100% - 40px)); margin:0 auto; padding:46px 0 70px; }
|
||||
.masthead { display:flex; align-items:center; justify-content:space-between; margin-bottom:30px; }
|
||||
.identity { display:flex; align-items:center; gap:17px; }
|
||||
.logo-shell { width:68px; height:68px; display:grid; place-items:center; border:1px solid #285064; border-radius:16px; background:linear-gradient(145deg,#132935,#081117); box-shadow:0 0 38px rgba(69,230,255,.1),inset 0 1px rgba(255,255,255,.04); }
|
||||
.logo-shell img { width:53px; height:53px; object-fit:contain; }
|
||||
.kicker,.section-tag,.system-state,.counter,.connected,.endpoint,.actions button { font-family:"SFMono-Regular",Consolas,"Liberation Mono",monospace; letter-spacing:.1em; }
|
||||
.kicker,.section-tag,.system-state,.counter,.connected,.endpoint { font-family:"SFMono-Regular",Consolas,"Liberation Mono",monospace; letter-spacing:.06em; }
|
||||
.kicker,.section-tag { margin:0 0 3px; color:var(--cyan); font-size:10px; font-weight:700; }
|
||||
h1 { margin:0; font-size:34px; line-height:1.1; letter-spacing:-.035em; }
|
||||
.lead { margin:5px 0 0; color:var(--muted); font-size:14px; }
|
||||
.system-state { display:flex; align-items:center; gap:10px; padding:10px 13px; border:1px solid var(--line); border-radius:8px; background:rgba(8,16,21,.7); }
|
||||
.system-state small,.system-state strong { display:block; font-size:9px; }.system-state small { color:var(--muted); }.system-state strong { margin-top:2px; color:var(--lime); }
|
||||
.system-state { display:flex; align-items:center; gap:9px; padding:9px 12px; border:1px solid var(--line); border-radius:8px; background:rgba(15,24,30,.8); }
|
||||
.system-state strong { color:var(--lime); font-size:10px; }
|
||||
.state-dot { width:9px; height:9px; border-radius:50%; background:var(--lime); box-shadow:0 0 13px rgba(173,255,47,.75); }
|
||||
form { display:grid; gap:16px; }
|
||||
.panel { position:relative; padding:25px; border:1px solid var(--line); border-radius:14px; background:linear-gradient(145deg,rgba(14,24,32,.96),rgba(8,14,19,.97)); box-shadow:inset 0 1px rgba(255,255,255,.025),0 18px 50px rgba(0,0,0,.12); }
|
||||
.panel { position:relative; padding:23px; border:1px solid var(--line); border-radius:14px; background:linear-gradient(145deg,rgba(19,29,37,.98),rgba(13,20,26,.98)); box-shadow:inset 0 1px rgba(255,255,255,.025),0 18px 50px rgba(0,0,0,.12); }
|
||||
.panel::after { content:""; position:absolute; top:-1px; left:25px; width:70px; height:1px; background:var(--cyan); box-shadow:0 0 10px var(--cyan); opacity:.65; }
|
||||
.master-panel { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:20px; }
|
||||
.panel-index { color:#294450; font:700 36px/1 "SFMono-Regular",Consolas,monospace; }
|
||||
.master-panel { display:grid; grid-template-columns:1fr auto; align-items:center; gap:20px; }
|
||||
.panel-copy h2,.section-head h2 { margin:0; font-size:20px; letter-spacing:-.015em; }.panel-copy p:last-child,.hint { margin:5px 0 0; color:var(--muted); font-size:13px; }
|
||||
.section-head { display:flex; align-items:flex-start; justify-content:space-between; gap:20px; margin-bottom:18px; }
|
||||
.counter { flex:none; margin-top:4px; padding:6px 9px; border:1px solid var(--line2); border-radius:5px; color:#9db4bf; font-size:9px; }
|
||||
.counter { flex:none; margin-top:4px; padding:6px 9px; border:1px solid var(--line2); border-radius:5px; color:#bdd0d8; font-size:10px; }
|
||||
.switch { display:flex; align-items:center; gap:9px; cursor:pointer; }.switch input { position:absolute; opacity:0; }.switch b { color:var(--muted); font:700 9px "SFMono-Regular",Consolas,monospace; letter-spacing:.1em; }.track { width:48px; height:26px; padding:4px; border:1px solid #2a3c46; border-radius:99px; background:#111b21; transition:.2s; }.track span { display:block; width:16px; height:16px; border-radius:50%; background:#657b86; transition:.2s; }.switch input:checked + .track { border-color:rgba(69,230,255,.7); background:rgba(69,230,255,.1); }.switch input:checked + .track span { transform:translateX(22px); background:var(--cyan); box-shadow:0 0 12px rgba(69,230,255,.75); }.switch input:checked ~ b { color:var(--cyan); }
|
||||
.country-tools { display:flex; align-items:center; gap:10px; margin-bottom:11px; }.search-shell { flex:1; display:flex; align-items:center; gap:10px; padding:0 13px; border:1px solid var(--line2); border-radius:8px; background:#070c10; color:var(--cyan); }.search-shell:focus-within { border-color:#3cbdd0; box-shadow:0 0 0 3px rgba(69,230,255,.07); }.search-shell input { width:100%; border:0; outline:0; padding:11px 0; background:transparent; color:var(--text); font:inherit; }.search-shell input::placeholder { color:#506872; }
|
||||
button { cursor:pointer; }.ghost,.primary,.danger { border-radius:7px; padding:11px 14px; font-weight:700; }.ghost { border:1px solid var(--line2); background:transparent; color:#8da4ae; font:700 9px "SFMono-Regular",Consolas,monospace; letter-spacing:.08em; }.ghost:hover { border-color:var(--cyan); color:var(--cyan); }
|
||||
button { cursor:pointer; }.ghost,.primary,.danger { border-radius:7px; padding:11px 14px; font-weight:700; }.ghost { border:1px solid var(--line2); background:transparent; color:#b6c4ca; font:700 12px Inter,ui-sans-serif,system-ui,sans-serif; }.ghost:hover { border-color:var(--cyan); color:var(--cyan); }
|
||||
.country-list { display:grid; grid-template-columns:repeat(auto-fill,minmax(190px,1fr)); gap:7px; max-height:420px; overflow:auto; scrollbar-color:#284550 #081016; padding:10px; border:1px solid var(--line); border-radius:10px; background:#070c10; }
|
||||
.country-option { display:flex; align-items:center; gap:9px; min-width:0; padding:8px 9px; border:1px solid transparent; border-radius:7px; cursor:pointer; transition:.15s; }.country-option:hover { border-color:#203844; background:#0e1a21; }.country-option:has(input:checked) { border-color:rgba(69,230,255,.32); background:rgba(69,230,255,.075); }.country-option[hidden] { display:none; }.country-option input { accent-color:var(--cyan); }.country-flag { font-size:19px; line-height:1; }.country-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:13px; }
|
||||
.setting-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; }.setting-card { display:flex; align-items:flex-start; gap:11px; padding:14px; border:1px solid var(--line); border-radius:9px; background:#091017; cursor:pointer; transition:.15s; }.setting-card:hover { border-color:#2d4a58; }.setting-card input { position:absolute; opacity:0; }.checkmark { flex:0 0 auto; width:18px; height:18px; border:1px solid #34505c; border-radius:4px; background:#071015; }.setting-card input:checked + .checkmark { border-color:var(--cyan); background:var(--cyan); box-shadow:0 0 12px rgba(69,230,255,.25); }.setting-card input:checked + .checkmark::after { content:""; display:block; width:8px; height:4px; margin:4px 0 0 4px; border:solid #041014; border-width:0 0 2px 2px; transform:rotate(-45deg); }.setting-card strong,.setting-card small { display:block; }.setting-card strong { font-size:13px; }.setting-card small { margin-top:3px; color:var(--muted); font-size:11px; line-height:1.45; }
|
||||
.connected { display:flex; align-items:center; gap:7px; padding:6px 9px; border:1px solid rgba(173,255,47,.22); border-radius:5px; color:var(--lime); font-size:9px; }.connected i { width:6px; height:6px; border-radius:50%; background:var(--lime); box-shadow:0 0 9px rgba(173,255,47,.75); }
|
||||
.endpoint { display:grid; grid-template-columns:auto 1fr auto; align-items:center; gap:13px; margin-bottom:11px; padding:12px 13px; border:1px solid var(--line); border-radius:8px; background:#070d12; color:var(--muted); font-size:9px; }.endpoint code { overflow:hidden; color:#b8d6df; font-size:12px; letter-spacing:0; text-overflow:ellipsis; }.lock { color:#4f6873; }
|
||||
.setting-grid { display:grid; grid-template-columns:repeat(2,1fr); gap:10px; }.setting-card { display:flex; align-items:flex-start; gap:11px; padding:14px; border:1px solid var(--line); border-radius:9px; background:#091017; cursor:pointer; transition:.15s; }.setting-card:hover { border-color:#2d4a58; }.setting-card input { position:absolute; opacity:0; }.checkmark { flex:0 0 auto; width:18px; height:18px; border:1px solid #34505c; border-radius:4px; background:#071015; }.setting-card input:checked + .checkmark { border-color:var(--cyan); background:var(--cyan); box-shadow:0 0 12px rgba(69,230,255,.25); }.setting-card input:checked + .checkmark::after { content:""; display:block; width:8px; height:4px; margin:4px 0 0 4px; border:solid #041014; border-width:0 0 2px 2px; transform:rotate(-45deg); }.setting-card strong,.setting-card small { display:block; }.setting-card strong { font-size:13px; }.setting-card small { margin-top:3px; color:var(--muted); font-size:12px; line-height:1.4; }
|
||||
.connected { display:flex; align-items:center; gap:7px; padding:6px 9px; border:1px solid rgba(183,244,91,.28); border-radius:5px; color:var(--lime); font-size:10px; }.connected i { width:6px; height:6px; border-radius:50%; background:var(--lime); box-shadow:0 0 9px rgba(173,255,47,.75); }
|
||||
.endpoint { margin-bottom:11px; padding:12px 13px; border:1px solid var(--line); border-radius:8px; background:#0c1318; }.endpoint code { overflow:hidden; color:#b8d6df; font-size:12px; letter-spacing:0; text-overflow:ellipsis; }.lock { color:#4f6873; }
|
||||
.contribution { max-width:none; }
|
||||
.actions { display:flex; align-items:center; justify-content:space-between; min-height:50px; padding:4px 1px; }.actions > div { display:flex; gap:10px; }.primary { border:1px solid #2bc7de; background:linear-gradient(90deg,rgba(23,158,180,.25),rgba(69,230,255,.1)); color:var(--cyan); }.primary:hover { background:rgba(69,230,255,.16); box-shadow:0 0 20px rgba(69,230,255,.1); }.danger { border:1px solid #44363a; background:transparent; color:#c28c94; }.danger:hover { border-color:#a45762; color:#ff9aa7; }#status { min-width:170px; margin:0; color:var(--lime); font:11px "SFMono-Regular",Consolas,monospace; text-align:right; }
|
||||
button:focus-visible,input:focus-visible,label:has(input:focus-visible) { outline:2px solid var(--cyan); outline-offset:2px; }
|
||||
@media (max-width:680px) { main { width:min(100% - 24px,920px); padding-top:24px; }.masthead { align-items:flex-start; }.system-state { display:none; }.master-panel { grid-template-columns:auto 1fr; }.master-panel .switch { grid-column:2; }.section-head { display:block; }.counter,.connected { display:inline-flex; margin-top:10px; }.setting-grid { grid-template-columns:1fr; }.endpoint { grid-template-columns:1fr; }.endpoint span { display:none; }.actions { align-items:flex-start; gap:12px; flex-direction:column; }.actions > div { width:100%; }.actions button { flex:1; }#status { text-align:left; } }
|
||||
@media (max-width:680px) { main { width:min(100% - 24px,920px); padding-top:24px; }.masthead { align-items:flex-start; }.system-state { display:none; }.master-panel { grid-template-columns:1fr; }.section-head { display:block; }.counter,.connected { display:inline-flex; margin-top:10px; }.setting-grid { grid-template-columns:1fr; }.endpoint { grid-template-columns:1fr; }.endpoint span { display:none; }.actions { align-items:flex-start; gap:12px; flex-direction:column; }.actions > div { width:100%; }.actions button { flex:1; }#status { text-align:left; } }
|
||||
+14
-15
@@ -5,39 +5,38 @@
|
||||
<div class="noise" aria-hidden="true"></div>
|
||||
<main>
|
||||
<header class="masthead">
|
||||
<div class="identity"><div class="logo-shell"><img src="../icons/icon.png" alt=""></div><div><p class="kicker">XGB // CONTROL SYSTEM</p><h1>X GeoBlock</h1><p class="lead">Geographic signal filtering for your X timeline.</p></div></div>
|
||||
<div class="system-state"><span class="state-dot"></span><div><small>SYSTEM STATUS</small><strong>OPERATIONAL</strong></div></div>
|
||||
<div class="identity"><div class="logo-shell"><img src="../icons/icon.png" alt=""></div><div><h1>X GeoBlock</h1><p class="lead">Location filtering for your X timeline.</p></div></div>
|
||||
<div class="system-state"><span class="state-dot"></span><strong>Operational</strong></div>
|
||||
</header>
|
||||
|
||||
<form id="settings">
|
||||
<section class="panel master-panel">
|
||||
<div class="panel-index">01</div>
|
||||
<div class="panel-copy"><p class="section-tag">CORE</p><h2>Filter engine</h2><p>Analyze posts as they enter the timeline and apply your location rules.</p></div>
|
||||
<label class="switch" for="enabled"><input id="enabled" type="checkbox"><span class="track"><span></span></span><b>ACTIVE</b></label>
|
||||
<div class="panel-copy"><h2>Filtering</h2><p>Apply location rules as posts load.</p></div>
|
||||
<label class="switch" for="enabled"><input id="enabled" type="checkbox"><span class="track"><span></span></span><b>Enabled</b></label>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<div class="section-head"><div><p class="section-tag">02 // TARGET MATRIX</p><h2>Blocked locations</h2><p class="hint">Select countries or broader regions reported by X. The list starts empty.</p></div><div class="counter" id="selection-count">0 locations selected</div></div>
|
||||
<div class="country-tools"><label class="search-shell"><span aria-hidden="true">⌕</span><input id="country-search" type="search" placeholder="Search location database…" autocomplete="off"></label><button type="button" class="ghost" id="clear-selection">CLEAR ALL</button></div>
|
||||
<div class="section-head"><div><h2>Blocked locations</h2><p class="hint">Countries and regions reported by X.</p></div><div class="counter" id="selection-count">0 locations selected</div></div>
|
||||
<div class="country-tools"><label class="search-shell"><span aria-hidden="true">⌕</span><input id="country-search" type="search" placeholder="Search locations…" autocomplete="off"></label><button type="button" class="ghost" id="clear-selection">Clear</button></div>
|
||||
<div id="country-list" class="country-list"></div>
|
||||
</section>
|
||||
|
||||
<section class="panel">
|
||||
<div class="section-head"><div><p class="section-tag">03 // BEHAVIOR</p><h2>Interface controls</h2></div></div>
|
||||
<div class="section-head"><div><h2>Behavior</h2></div></div>
|
||||
<div class="setting-grid">
|
||||
<label class="setting-card"><input id="placeholder" type="checkbox"><span class="checkmark"></span><span><strong>Reveal controls</strong><small>Show a clickable marker where a post was hidden.</small></span></label>
|
||||
<label class="setting-card"><input id="debug-mode" type="checkbox"><span class="checkmark"></span><span><strong>Diagnostic stream</strong><small>Write detailed activity to the X page console.</small></span></label>
|
||||
<label class="setting-card"><input id="skip-followed" type="checkbox"><span class="checkmark"></span><span><strong>Ignore followed accounts</strong><small>Always allow posts from accounts you follow.</small></span></label>
|
||||
<label class="setting-card"><input id="placeholder" type="checkbox"><span class="checkmark"></span><span><strong>Reveal controls</strong><small>Show a marker for hidden posts.</small></span></label>
|
||||
<label class="setting-card"><input id="debug-mode" type="checkbox"><span class="checkmark"></span><span><strong>Debug logging</strong><small>Log activity in the X console.</small></span></label>
|
||||
<label class="setting-card"><input id="skip-followed" type="checkbox"><span class="checkmark"></span><span><strong>Ignore followed accounts</strong><small>Always allow accounts you follow.</small></span></label>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
<section class="panel cloud-panel">
|
||||
<div class="section-head"><div><p class="section-tag">04 // DISTRIBUTED CACHE</p><h2>Cloud relay</h2><p class="hint">Confirmed shared results reduce requests to X. Reads are enabled automatically.</p></div><span class="connected"><i></i>CONNECTED</span></div>
|
||||
<div class="endpoint"><span>ENDPOINT</span><code>x-geoblock-cache.dariosevilla.es</code><span class="lock" aria-label="Fixed endpoint">LOCKED</span></div>
|
||||
<label class="setting-card contribution"><input id="cloud-contribute" type="checkbox"><span class="checkmark"></span><span><strong>Contribute observations</strong><small>Send a SHA-256 username hash and observed location. Following data, posts and your blocklist stay local.</small></span></label>
|
||||
<div class="section-head"><div><h2>Cloud cache</h2><p class="hint">Shared results reduce requests to X.</p></div><span class="connected"><i></i>Connected</span></div>
|
||||
<div class="endpoint"><code>x-geoblock-cache.dariosevilla.es</code></div>
|
||||
<label class="setting-card contribution"><input id="cloud-contribute" type="checkbox"><span class="checkmark"></span><span><strong>Contribute observations</strong><small>Share hashed usernames and detected locations.</small></span></label>
|
||||
</section>
|
||||
|
||||
<footer class="actions"><div><button type="submit" class="primary">SAVE CONFIGURATION</button><button type="button" class="danger" id="clear">PURGE LOCAL CACHE</button></div><p id="status" role="status"></p></footer>
|
||||
<footer class="actions"><div><button type="submit" class="primary">Save settings</button><button type="button" class="danger" id="clear">Clear cache</button></div><p id="status" role="status"></p></footer>
|
||||
</form>
|
||||
</main>
|
||||
<script src="../lib/config.js"></script><script src="../lib/countries.js"></script><script src="../lib/cloud-cache.js"></script><script src="options.js"></script>
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
:root { color-scheme: dark; font: 14px/1.45 Inter, ui-sans-serif, system-ui, sans-serif; --bg:#070b10; --panel:#0d141c; --line:#1c2b38; --cyan:#45e6ff; --lime:#adff2f; --muted:#78909f; }
|
||||
:root { color-scheme: dark; font: 14px/1.45 Inter, ui-sans-serif, system-ui, sans-serif; --bg:#0a0e13; --panel:#121b22; --line:#2a3a45; --cyan:#58ddf2; --lime:#b7f45b; --muted:#a0afb7; }
|
||||
* { box-sizing:border-box; }
|
||||
body { margin:0; min-width:340px; background:var(--bg); color:#edfaff; }
|
||||
body::before { content:""; position:fixed; inset:0; pointer-events:none; opacity:.24; background-image:linear-gradient(rgba(69,230,255,.07) 1px,transparent 1px),linear-gradient(90deg,rgba(69,230,255,.07) 1px,transparent 1px); background-size:24px 24px; mask-image:linear-gradient(to bottom,#000,transparent 72%); }
|
||||
body::before { content:""; position:fixed; inset:0; pointer-events:none; opacity:.12; background-image:linear-gradient(rgba(69,230,255,.07) 1px,transparent 1px),linear-gradient(90deg,rgba(69,230,255,.07) 1px,transparent 1px); background-size:24px 24px; mask-image:linear-gradient(to bottom,#000,transparent 72%); }
|
||||
main { position:relative; padding:20px; }
|
||||
.brand { display:flex; align-items:center; gap:11px; margin-bottom:18px; }
|
||||
.logo-shell { width:43px; height:43px; display:grid; place-items:center; border:1px solid #244253; border-radius:11px; background:linear-gradient(145deg,#132430,#081016); box-shadow:0 0 24px rgba(69,230,255,.09); }
|
||||
|
||||
+4
-4
@@ -1,12 +1,12 @@
|
||||
<!doctype html>
|
||||
<html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>X GeoBlock</title><link rel="stylesheet" href="popup.css"></head>
|
||||
<body><main>
|
||||
<header class="brand"><div class="logo-shell"><img src="../icons/icon.png" alt=""></div><div><p class="eyebrow">NETWORK FILTER</p><h1>X GeoBlock</h1></div><span class="version" id="version">v—</span></header>
|
||||
<header class="brand"><div class="logo-shell"><img src="../icons/icon.png" alt=""></div><div><h1>X GeoBlock</h1><p class="eyebrow">Timeline location filter</p></div><span class="version" id="version">v—</span></header>
|
||||
<section class="status-card">
|
||||
<div class="status-line"><span class="pulse" aria-hidden="true"></span><span>FILTER ENGINE</span><strong id="engine-status">ONLINE</strong></div>
|
||||
<div class="status-line"><span class="pulse" aria-hidden="true"></span><span>Filter status</span><strong id="engine-status">Online</strong></div>
|
||||
<label class="switch-row" for="enabled"><span><strong>Protection</strong><small>Scan posts as they load</small></span><span class="switch"><input id="enabled" type="checkbox"><span class="slider"></span></span></label>
|
||||
</section>
|
||||
<div class="metric"><span>BLOCKLIST</span><strong id="summary">—</strong></div>
|
||||
<div class="metric"><span>Blocklist</span><strong id="summary">—</strong></div>
|
||||
<div class="cloud-line"><span class="cloud-dot"></span><span>Cloud cache linked</span></div>
|
||||
<button id="settings"><span>OPEN CONTROL PANEL</span><span aria-hidden="true">→</span></button>
|
||||
<button id="settings"><span>Open settings</span><span aria-hidden="true">→</span></button>
|
||||
</main><script src="../lib/config.js"></script><script src="popup.js"></script></body></html>
|
||||
+3
-3
@@ -6,13 +6,13 @@ const engineStatus = document.querySelector("#engine-status");
|
||||
document.querySelector("#version").textContent = `v${extensionApi.runtime.getManifest().version}`;
|
||||
extensionApi.storage.sync.get(XGeoConfig.DEFAULT_SETTINGS).then((value) => {
|
||||
enabled.checked = value.enabled;
|
||||
summary.textContent = `${String(value.blacklist.length).padStart(2, "0")} LOCATIONS`;
|
||||
engineStatus.textContent = value.enabled ? "ONLINE" : "PAUSED";
|
||||
summary.textContent = `${value.blacklist.length} locations`;
|
||||
engineStatus.textContent = value.enabled ? "Online" : "Paused";
|
||||
document.body.dataset.enabled = String(value.enabled);
|
||||
});
|
||||
enabled.addEventListener("change", () => {
|
||||
extensionApi.storage.sync.set({ enabled: enabled.checked });
|
||||
engineStatus.textContent = enabled.checked ? "ONLINE" : "PAUSED";
|
||||
engineStatus.textContent = enabled.checked ? "Online" : "Paused";
|
||||
document.body.dataset.enabled = String(enabled.checked);
|
||||
});
|
||||
document.querySelector("#settings").addEventListener("click", () => extensionApi.runtime.openOptionsPage());
|
||||
@@ -31,6 +31,8 @@ test("normalizes country aliases", () => {
|
||||
test("uses the production collaborative cache endpoint", () => {
|
||||
assert.equal(config.CLOUD_CACHE_ENDPOINT, "https://x-geoblock-cache.dariosevilla.es");
|
||||
assert.equal(config.DEFAULT_SETTINGS.cloudCacheEndpoint, config.CLOUD_CACHE_ENDPOINT);
|
||||
assert.equal(config.DEFAULT_SETTINGS.contributeCloudCache, true);
|
||||
assert.equal(config.DEFAULT_SETTINGS.showPlaceholder, true);
|
||||
});
|
||||
test("followed-account exemption is configurable", () => {
|
||||
assert.equal(config.shouldBlock("Lebanon", ["Lebanon"], true, true), false);
|
||||
|
||||
Reference in new issue
Block a user