Merge branch 'main' into federation

This commit is contained in:
Christian Beutel
2025-06-21 10:09:03 +02:00
18 changed files with 82 additions and 11 deletions

4
web/package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "wanderer",
"version": "0.17.0-beta",
"version": "0.17.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "wanderer",
"version": "0.17.0-beta",
"version": "0.17.0",
"dependencies": {
"@felte/validator-zod": "^1.0.18",
"@fortawesome/fontawesome-free": "^6.5.1",

View File

@@ -1,6 +1,6 @@
{
"name": "wanderer",
"version": "0.17.0-beta",
"version": "0.17.0",
"private": true,
"scripts": {
"dev": "vite dev",

View File

@@ -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();
@@ -116,6 +111,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;
@@ -155,6 +160,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;
}
}
</script>
<div class="trail-filter p-8 border border-input-border rounded-xl">
@@ -236,6 +255,7 @@
>{$_("shared")}</label
>
</div>
<hr class="my-4 border-separator" />
{/if}
<MultiSelect
@@ -355,8 +375,12 @@
<p class="text-sm font-medium pb-4">{$_("completion-status")}</p>
<RadioGroup
name="completed"
items={radioGroupItems}
selected={2}
items={radioGroupCompletenessItems}
selected={filter.completed === undefined
? 2
: filter.completed === true
? 0
: 1}
onchange={(item) => setCompletedFilter(item)}
></RadioGroup>
</div>

View File

@@ -347,6 +347,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",

View File

@@ -347,6 +347,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",

View File

@@ -347,6 +347,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",

View File

@@ -347,6 +347,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",

View File

@@ -347,6 +347,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",

View File

@@ -347,6 +347,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",

View File

@@ -347,6 +347,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",

View File

@@ -347,6 +347,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",

View File

@@ -347,6 +347,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",

View File

@@ -347,6 +347,7 @@
"use-roads": "Use Roads",
"username": "用户名",
"view": "查看",
"visibilty-status": "可性见",
"walking-speed": "",
"waypoints": "{n, plural, =1 {路点} other {路点}}",
"welcome_to": "欢迎",

View File

@@ -112,6 +112,7 @@ interface TrailFilter {
author?: string;
public?: boolean;
shared?: boolean;
private?: boolean;
near: {
lat?: number,
lon?: number,

View File

@@ -524,6 +524,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) {
@@ -545,6 +577,7 @@ function buildFilterText(user: AuthRecord, filter: TrailFilter, includeGeo: bool
}
filterText += ")"
}
*/
if (filter.liked === true) {
filterText += ` AND likes = ${user?.actor}`

View File

@@ -16,6 +16,7 @@ export const load: ServerLoad = async ({ params, locals, fetch }) => {
public: true,
shared: true,
liked: false,
private: true,
near: {
radius: 2000,
},

View File

@@ -17,6 +17,7 @@ export const load: Load = async ({ params, fetch, parent }) => {
public: true,
shared: true,
liked: false,
private: true,
near: {
radius: 2000,
},

View File

@@ -15,6 +15,7 @@ export const load: ServerLoad = async ({ params, locals, url, fetch }) => {
public: true,
shared: true,
liked: false,
private: true,
near: {
radius: 2000,
},