From b1fa6d3a3d775ff855a392080edbedf67b826c83 Mon Sep 17 00:00:00 2001 From: Christian Beutel <> Date: Mon, 28 Apr 2025 17:05:20 +0200 Subject: [PATCH 1/2] fixes versioning --- docs/package.json | 2 +- web/package-lock.json | 4 ++-- web/package.json | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/package.json b/docs/package.json index c59bdc15..a48d239c 100644 --- a/docs/package.json +++ b/docs/package.json @@ -1,7 +1,7 @@ { "name": "docs", "type": "module", - "version": "0.16.4", + "version": "0.16.5", "scripts": { "dev": "astro dev", "start": "astro dev", diff --git a/web/package-lock.json b/web/package-lock.json index 847232ce..41d302d1 100644 --- a/web/package-lock.json +++ b/web/package-lock.json @@ -1,12 +1,12 @@ { "name": "wanderer", - "version": "0.15.2", + "version": "0.16.5", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "wanderer", - "version": "0.15.2", + "version": "0.16.5", "dependencies": { "@felte/validator-zod": "^1.0.18", "@fortawesome/fontawesome-free": "^6.5.1", diff --git a/web/package.json b/web/package.json index 3540a27c..6a60a5c4 100644 --- a/web/package.json +++ b/web/package.json @@ -1,6 +1,6 @@ { "name": "wanderer", - "version": "0.16.4", + "version": "0.16.5", "private": true, "scripts": { "dev": "vite dev", From 742a6d9d30c96ebd5f528a7ba6e542fc871cf74c Mon Sep 17 00:00:00 2001 From: slothful-vassal <89943360+slothful-vassal@users.noreply.github.com> Date: Wed, 30 Apr 2025 15:29:27 +0200 Subject: [PATCH 2/2] Allow to show public routes only (#262) * speedup loading some pages (reduce data amount of trail lists) * optimize code * fix save bio, if no tileset defined * improve/fix visibility filter * radio buttons -> checkboxes --------- Co-authored-by: Christian Beutel <> --- .../trail/trail_filter_panel.svelte | 58 ++++++++++++++++--- web/src/lib/i18n/locales/de.json | 1 + web/src/lib/i18n/locales/en.json | 1 + web/src/lib/i18n/locales/es.json | 1 + web/src/lib/i18n/locales/fr.json | 1 + web/src/lib/i18n/locales/hu.json | 1 + web/src/lib/i18n/locales/it.json | 1 + web/src/lib/i18n/locales/nl.json | 1 + web/src/lib/i18n/locales/pl.json | 1 + web/src/lib/i18n/locales/pt.json | 1 + web/src/lib/i18n/locales/zh.json | 1 + web/src/lib/models/trail.ts | 1 + web/src/lib/stores/trail_store.ts | 33 +++++++++++ web/src/routes/map/+page.ts | 1 + web/src/routes/profile/[id]/trails/+page.ts | 1 + web/src/routes/trails/+page.ts | 1 + 16 files changed, 96 insertions(+), 9 deletions(-) diff --git a/web/src/lib/components/trail/trail_filter_panel.svelte b/web/src/lib/components/trail/trail_filter_panel.svelte index f5a4c715..5a9340a7 100644 --- a/web/src/lib/components/trail/trail_filter_panel.svelte +++ b/web/src/lib/components/trail/trail_filter_panel.svelte @@ -3,6 +3,7 @@ import type { TrailFilter } from "$lib/models/trail"; import { searchLocations } from "$lib/stores/search_store"; import { tags_index } from "$lib/stores/tag_store"; + import { currentUser } from "$lib/stores/user_store"; import { formatDistance, formatElevation } from "$lib/util/format_util"; import { getIconForLocation } from "$lib/util/icon_util"; import { _ } from "svelte-i18n"; @@ -17,7 +18,6 @@ import type { SelectItem } from "../base/select.svelte"; import Slider from "../base/slider.svelte"; import UserSearch from "../user_search.svelte"; - import { currentUser } from "$lib/stores/user_store"; interface Props { categories: Category[]; @@ -44,7 +44,7 @@ })), ); - const radioGroupItems: RadioItem[] = [ + const radioGroupCompletenessItems: RadioItem[] = [ { text: $_("completed"), value: "completed" }, { text: $_("not-completed"), value: "not_completed" }, { text: $_("no-preference"), value: "no_preference" }, @@ -82,11 +82,6 @@ update(); } - function setPublicFilter(e: Event) { - filter.public = (e.target as HTMLInputElement).checked; - update(); - } - function setSharedFilter(e: Event) { filter.shared = (e.target as HTMLInputElement).checked; update(); @@ -111,6 +106,16 @@ update(); } + function setPrivateFilter(e: Event) { + filter.private = (e.target as HTMLInputElement).checked; + update(); + } + + function setPublicFilter(e: Event) { + filter.public = (e.target as HTMLInputElement).checked; + update(); + } + async function searchCities(q: string) { if (q.length == 0) { filter.near.lat = undefined; @@ -150,6 +155,20 @@ filter.tags = tags.map((t) => t.text); update(); } + + function getVisibiltyStatus(): number { + const isPublic = filter.public !== undefined && filter.public === true; + const isPrivate = + filter.private !== undefined && filter.private === true; + + if (isPublic === true && isPrivate === true) { + return 2; + } else if (isPublic === true) { + return 1; + } else { + return 0; + } + }
@@ -207,6 +226,22 @@ clearAfterSelect={false} label={$_("author")} > + +
+ +

{$_("visibilty-status")}

+
+ + +
{$_("shared")}
+
{/if} {$_("completion-status")}

setCompletedFilter(item)} >
diff --git a/web/src/lib/i18n/locales/de.json b/web/src/lib/i18n/locales/de.json index 1e824a5a..8011fb9c 100644 --- a/web/src/lib/i18n/locales/de.json +++ b/web/src/lib/i18n/locales/de.json @@ -325,6 +325,7 @@ "use-roads": "Nutze Straßen", "username": "Nutzername", "view": "Ansehen", + "visibilty-status": "Sichtbarkeit", "walking-speed": "Laufgeschwindigkeit", "waypoints": "{n, plural, =1 {Wegpunkt} other {Wegpunkte}}", "welcome_to": "Willkommen bei", diff --git a/web/src/lib/i18n/locales/en.json b/web/src/lib/i18n/locales/en.json index b3c5daf6..cdb0a296 100644 --- a/web/src/lib/i18n/locales/en.json +++ b/web/src/lib/i18n/locales/en.json @@ -325,6 +325,7 @@ "use-roads": "Use Roads", "username": "Username", "view": "View", + "visibilty-status": "Visibilty", "walking-speed": "", "waypoints": "{n, plural, =1 {Waypoint} other {Waypoints}}", "welcome_to": "Welcome to", diff --git a/web/src/lib/i18n/locales/es.json b/web/src/lib/i18n/locales/es.json index 2b02409f..3d9ae8a3 100644 --- a/web/src/lib/i18n/locales/es.json +++ b/web/src/lib/i18n/locales/es.json @@ -325,6 +325,7 @@ "use-roads": "Use Roads", "username": "Nombre de usuario", "view": "Ver", + "visibilty-status": "Visibilidad", "walking-speed": "", "waypoints": "{n, plural, one {}=1 {Punto de Interés} other {Puntos de Interés}}", "welcome_to": "Bienvenid@ a", diff --git a/web/src/lib/i18n/locales/fr.json b/web/src/lib/i18n/locales/fr.json index 67e618bd..87811118 100644 --- a/web/src/lib/i18n/locales/fr.json +++ b/web/src/lib/i18n/locales/fr.json @@ -325,6 +325,7 @@ "use-roads": "Use Roads", "username": "Nom d'utilisateur", "view": "Afficher", + "visibilty-status": "Visibilité", "walking-speed": "", "waypoints": "{n, plural, =1 {Point de passage} other {Points de passage}}", "welcome_to": "Bienvenue sur", diff --git a/web/src/lib/i18n/locales/hu.json b/web/src/lib/i18n/locales/hu.json index ab8b189e..4ff0fc82 100644 --- a/web/src/lib/i18n/locales/hu.json +++ b/web/src/lib/i18n/locales/hu.json @@ -325,6 +325,7 @@ "use-roads": "Use Roads", "username": "Felhasználónév", "view": "View", + "visibilty-status": "Láthatóság", "walking-speed": "", "waypoints": "{n, plural, =1 {Waypoint} other {Waypoints}}", "welcome_to": "Üdvözöljük a", diff --git a/web/src/lib/i18n/locales/it.json b/web/src/lib/i18n/locales/it.json index c8738dde..21e2664f 100644 --- a/web/src/lib/i18n/locales/it.json +++ b/web/src/lib/i18n/locales/it.json @@ -325,6 +325,7 @@ "use-roads": "Use Roads", "username": "Nome utente", "view": "Visualizza", + "visibilty-status": "Visibilità", "walking-speed": "", "waypoints": "{n, plural, =1 {Punto di passaggio} other {Punti di passaggio}}", "welcome_to": "Benvenuti a", diff --git a/web/src/lib/i18n/locales/nl.json b/web/src/lib/i18n/locales/nl.json index 70ebdaf6..afe8a96d 100644 --- a/web/src/lib/i18n/locales/nl.json +++ b/web/src/lib/i18n/locales/nl.json @@ -325,6 +325,7 @@ "use-roads": "Use Roads", "username": "Gebruikersnaam", "view": "View", + "visibilty-status": "Zichtbaarheid", "walking-speed": "", "waypoints": "{n, plural, =1 {Waypoint} other {Waypoints}}", "welcome_to": "Welkom bij", diff --git a/web/src/lib/i18n/locales/pl.json b/web/src/lib/i18n/locales/pl.json index df141134..ab258482 100644 --- a/web/src/lib/i18n/locales/pl.json +++ b/web/src/lib/i18n/locales/pl.json @@ -325,6 +325,7 @@ "use-roads": "Use Roads", "username": "Nazwa Użytkownika", "view": "Widok", + "visibilty-status": "Widoczność", "walking-speed": "", "waypoints": "{n, plural, one {Punkt} few {Punkty} many {Punktów}=1 {Punkt} other {Punktów}}", "welcome_to": "Witaj w", diff --git a/web/src/lib/i18n/locales/pt.json b/web/src/lib/i18n/locales/pt.json index 1c7496e4..32696233 100644 --- a/web/src/lib/i18n/locales/pt.json +++ b/web/src/lib/i18n/locales/pt.json @@ -325,6 +325,7 @@ "use-roads": "Use Roads", "username": "Nome de utilizador", "view": "Ver", + "visibilty-status": "Visibilidade", "walking-speed": "", "waypoints": "{n, plural, =1 {Ponto de passagem} other {Pontos de passagem}}", "welcome_to": "Bem-vindo ao", diff --git a/web/src/lib/i18n/locales/zh.json b/web/src/lib/i18n/locales/zh.json index b512759d..78eec440 100644 --- a/web/src/lib/i18n/locales/zh.json +++ b/web/src/lib/i18n/locales/zh.json @@ -325,6 +325,7 @@ "use-roads": "Use Roads", "username": "用户名", "view": "查看", + "visibilty-status": "可性见", "walking-speed": "", "waypoints": "{n, plural, =1 {路点} other {路点}}", "welcome_to": "欢迎", diff --git a/web/src/lib/models/trail.ts b/web/src/lib/models/trail.ts index 0c81c3f9..b571f6bf 100644 --- a/web/src/lib/models/trail.ts +++ b/web/src/lib/models/trail.ts @@ -107,6 +107,7 @@ interface TrailFilter { author?: string; public?: boolean; shared?: boolean; + private?: boolean; near: { lat?: number, lon?: number, diff --git a/web/src/lib/stores/trail_store.ts b/web/src/lib/stores/trail_store.ts index e5ee4597..618bce7d 100644 --- a/web/src/lib/stores/trail_store.ts +++ b/web/src/lib/stores/trail_store.ts @@ -532,6 +532,38 @@ function buildFilterText(user: AuthRecord, filter: TrailFilter, includeGeo: bool filterText += ` AND author = ${filter.author}` } + if (filter.public !== undefined || filter.private !== undefined || filter.shared !== undefined) { + filterText += " AND (" + + const showPublic = filter.public === undefined || filter.public === true; + const showPrivate = filter.private === undefined || filter.private === true; + const showShared = filter.shared !== undefined && filter.shared === true; + + if (showPublic === true) { + filterText += "(public = TRUE"; + if (showPrivate === true && (!filter.author?.length || filter.author == user?.id)) { + filterText += ` OR author = ${user?.id}`; + } + filterText += ")"; + } + else if (!filter.author?.length || filter.author == user?.id) { + filterText += "public = FALSE"; + filterText += ` AND author = ${user?.id}`; + } + + if (filter.shared !== undefined) { + if (filter.shared === true) { + filterText += ` OR shares = ${user?.id}` + } else { + filterText += ` AND NOT shares = ${user?.id}` + + } + } + + filterText += ")"; + } + + /* if (filter.public !== undefined || filter.shared !== undefined) { filterText += " AND (" if (filter.public !== undefined) { @@ -553,6 +585,7 @@ function buildFilterText(user: AuthRecord, filter: TrailFilter, includeGeo: bool } filterText += ")" } +*/ if (filter.startDate) { filterText += ` AND date >= ${new Date(filter.startDate).getTime() / 1000}` diff --git a/web/src/routes/map/+page.ts b/web/src/routes/map/+page.ts index 74770f44..ed2139ad 100644 --- a/web/src/routes/map/+page.ts +++ b/web/src/routes/map/+page.ts @@ -15,6 +15,7 @@ export const load: ServerLoad = async ({ params, locals, fetch }) => { author: "", public: true, shared: true, + private: true, near: { radius: 2000, }, diff --git a/web/src/routes/profile/[id]/trails/+page.ts b/web/src/routes/profile/[id]/trails/+page.ts index 3ef9036b..e246c24e 100644 --- a/web/src/routes/profile/[id]/trails/+page.ts +++ b/web/src/routes/profile/[id]/trails/+page.ts @@ -11,6 +11,7 @@ export const load: Load = async ({ params, fetch }) => { author: params.id, public: true, shared: true, + private: true, near: { radius: 2000, }, diff --git a/web/src/routes/trails/+page.ts b/web/src/routes/trails/+page.ts index 0b376d2c..0337eaf7 100644 --- a/web/src/routes/trails/+page.ts +++ b/web/src/routes/trails/+page.ts @@ -14,6 +14,7 @@ export const load: ServerLoad = async ({ params, locals, url, fetch }) => { author: "", public: true, shared: true, + private: true, near: { radius: 2000, },