strart trail sharing implementation
This commit is contained in:
64
db/migrations/1715276397_created_users_anonymous.go
Normal file
64
db/migrations/1715276397_created_users_anonymous.go
Normal file
@@ -0,0 +1,64 @@
|
|||||||
|
package migrations
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
|
"github.com/pocketbase/dbx"
|
||||||
|
"github.com/pocketbase/pocketbase/daos"
|
||||||
|
m "github.com/pocketbase/pocketbase/migrations"
|
||||||
|
"github.com/pocketbase/pocketbase/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
m.Register(func(db dbx.Builder) error {
|
||||||
|
jsonData := `{
|
||||||
|
"id": "xku110v5a5xbufa",
|
||||||
|
"created": "2024-05-09 17:39:57.419Z",
|
||||||
|
"updated": "2024-05-09 17:39:57.419Z",
|
||||||
|
"name": "users_anonymous",
|
||||||
|
"type": "view",
|
||||||
|
"system": false,
|
||||||
|
"schema": [
|
||||||
|
{
|
||||||
|
"system": false,
|
||||||
|
"id": "cknini6y",
|
||||||
|
"name": "username",
|
||||||
|
"type": "text",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"min": null,
|
||||||
|
"max": null,
|
||||||
|
"pattern": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"indexes": [],
|
||||||
|
"listRule": null,
|
||||||
|
"viewRule": null,
|
||||||
|
"createRule": null,
|
||||||
|
"updateRule": null,
|
||||||
|
"deleteRule": null,
|
||||||
|
"options": {
|
||||||
|
"query": "SELECT id, username FROM users"
|
||||||
|
}
|
||||||
|
}`
|
||||||
|
|
||||||
|
collection := &models.Collection{}
|
||||||
|
if err := json.Unmarshal([]byte(jsonData), &collection); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return daos.New(db).SaveCollection(collection)
|
||||||
|
}, func(db dbx.Builder) error {
|
||||||
|
dao := daos.New(db);
|
||||||
|
|
||||||
|
collection, err := dao.FindCollectionByNameOrId("xku110v5a5xbufa")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return dao.DeleteCollection(collection)
|
||||||
|
})
|
||||||
|
}
|
||||||
87
db/migrations/1715276572_updated_users_anonymous.go
Normal file
87
db/migrations/1715276572_updated_users_anonymous.go
Normal file
@@ -0,0 +1,87 @@
|
|||||||
|
package migrations
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
|
"github.com/pocketbase/dbx"
|
||||||
|
"github.com/pocketbase/pocketbase/daos"
|
||||||
|
m "github.com/pocketbase/pocketbase/migrations"
|
||||||
|
"github.com/pocketbase/pocketbase/models/schema"
|
||||||
|
"github.com/pocketbase/pocketbase/tools/types"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
m.Register(func(db dbx.Builder) error {
|
||||||
|
dao := daos.New(db);
|
||||||
|
|
||||||
|
collection, err := dao.FindCollectionByNameOrId("xku110v5a5xbufa")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
collection.ListRule = types.Pointer("@request.auth.id != \"\"")
|
||||||
|
|
||||||
|
collection.ViewRule = types.Pointer("@request.auth.id != \"\"")
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.Schema.RemoveField("cknini6y")
|
||||||
|
|
||||||
|
// add
|
||||||
|
new_username := &schema.SchemaField{}
|
||||||
|
if err := json.Unmarshal([]byte(`{
|
||||||
|
"system": false,
|
||||||
|
"id": "qzkmy7nv",
|
||||||
|
"name": "username",
|
||||||
|
"type": "text",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"min": null,
|
||||||
|
"max": null,
|
||||||
|
"pattern": ""
|
||||||
|
}
|
||||||
|
}`), new_username); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
collection.Schema.AddField(new_username)
|
||||||
|
|
||||||
|
return dao.SaveCollection(collection)
|
||||||
|
}, func(db dbx.Builder) error {
|
||||||
|
dao := daos.New(db);
|
||||||
|
|
||||||
|
collection, err := dao.FindCollectionByNameOrId("xku110v5a5xbufa")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
collection.ListRule = nil
|
||||||
|
|
||||||
|
collection.ViewRule = nil
|
||||||
|
|
||||||
|
// add
|
||||||
|
del_username := &schema.SchemaField{}
|
||||||
|
if err := json.Unmarshal([]byte(`{
|
||||||
|
"system": false,
|
||||||
|
"id": "cknini6y",
|
||||||
|
"name": "username",
|
||||||
|
"type": "text",
|
||||||
|
"required": false,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"min": null,
|
||||||
|
"max": null,
|
||||||
|
"pattern": ""
|
||||||
|
}
|
||||||
|
}`), del_username); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
collection.Schema.AddField(del_username)
|
||||||
|
|
||||||
|
// remove
|
||||||
|
collection.Schema.RemoveField("qzkmy7nv")
|
||||||
|
|
||||||
|
return dao.SaveCollection(collection)
|
||||||
|
})
|
||||||
|
}
|
||||||
96
db/migrations/1715276881_created_trail_share.go
Normal file
96
db/migrations/1715276881_created_trail_share.go
Normal file
@@ -0,0 +1,96 @@
|
|||||||
|
package migrations
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
|
||||||
|
"github.com/pocketbase/dbx"
|
||||||
|
"github.com/pocketbase/pocketbase/daos"
|
||||||
|
m "github.com/pocketbase/pocketbase/migrations"
|
||||||
|
"github.com/pocketbase/pocketbase/models"
|
||||||
|
)
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
m.Register(func(db dbx.Builder) error {
|
||||||
|
jsonData := `{
|
||||||
|
"id": "1mns8mlal6uf9ku",
|
||||||
|
"created": "2024-05-09 17:48:01.382Z",
|
||||||
|
"updated": "2024-05-09 17:48:01.382Z",
|
||||||
|
"name": "trail_share",
|
||||||
|
"type": "base",
|
||||||
|
"system": false,
|
||||||
|
"schema": [
|
||||||
|
{
|
||||||
|
"system": false,
|
||||||
|
"id": "eskurfx6",
|
||||||
|
"name": "trail",
|
||||||
|
"type": "relation",
|
||||||
|
"required": true,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"collectionId": "e864strfxo14pm4",
|
||||||
|
"cascadeDelete": true,
|
||||||
|
"minSelect": null,
|
||||||
|
"maxSelect": 1,
|
||||||
|
"displayFields": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"system": false,
|
||||||
|
"id": "yyzimwee",
|
||||||
|
"name": "user",
|
||||||
|
"type": "relation",
|
||||||
|
"required": true,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"collectionId": "_pb_users_auth_",
|
||||||
|
"cascadeDelete": true,
|
||||||
|
"minSelect": null,
|
||||||
|
"maxSelect": 1,
|
||||||
|
"displayFields": null
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"system": false,
|
||||||
|
"id": "zr7aaqxl",
|
||||||
|
"name": "permission",
|
||||||
|
"type": "select",
|
||||||
|
"required": true,
|
||||||
|
"presentable": false,
|
||||||
|
"unique": false,
|
||||||
|
"options": {
|
||||||
|
"maxSelect": 1,
|
||||||
|
"values": [
|
||||||
|
"view",
|
||||||
|
"edit"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"indexes": [],
|
||||||
|
"listRule": "trail.author = @request.auth.id",
|
||||||
|
"viewRule": "trail.author = @request.auth.id",
|
||||||
|
"createRule": "trail.author = @request.auth.id",
|
||||||
|
"updateRule": "trail.author = @request.auth.id",
|
||||||
|
"deleteRule": "trail.author = @request.auth.id",
|
||||||
|
"options": {}
|
||||||
|
}`
|
||||||
|
|
||||||
|
collection := &models.Collection{}
|
||||||
|
if err := json.Unmarshal([]byte(jsonData), &collection); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return daos.New(db).SaveCollection(collection)
|
||||||
|
}, func(db dbx.Builder) error {
|
||||||
|
dao := daos.New(db);
|
||||||
|
|
||||||
|
collection, err := dao.FindCollectionByNameOrId("1mns8mlal6uf9ku")
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return dao.DeleteCollection(collection)
|
||||||
|
})
|
||||||
|
}
|
||||||
@@ -54,8 +54,8 @@ services:
|
|||||||
PUBLIC_POCKETBASE_URL: http://db:8090
|
PUBLIC_POCKETBASE_URL: http://db:8090
|
||||||
PUBLIC_DISABLE_SIGNUP: false
|
PUBLIC_DISABLE_SIGNUP: false
|
||||||
UPLOAD_FOLDER: /app/uploads
|
UPLOAD_FOLDER: /app/uploads
|
||||||
UPLOAD_USER:
|
UPLOAD_USER: Flomp
|
||||||
UPLOAD_PASSWORD:
|
UPLOAD_PASSWORD: 12345678
|
||||||
PUBLIC_VALHALLA_URL: https://valhalla1.openstreetmap.de
|
PUBLIC_VALHALLA_URL: https://valhalla1.openstreetmap.de
|
||||||
volumes:
|
volumes:
|
||||||
- ./data/uploads:/app/uploads
|
- ./data/uploads:/app/uploads
|
||||||
|
|||||||
@@ -18,6 +18,7 @@
|
|||||||
import TrailExportModal from "./trail_export_modal.svelte";
|
import TrailExportModal from "./trail_export_modal.svelte";
|
||||||
import JSZip from "jszip";
|
import JSZip from "jszip";
|
||||||
import { getFileURL, saveAs } from "$lib/util/file_util";
|
import { getFileURL, saveAs } from "$lib/util/file_util";
|
||||||
|
import TrailShareModal from "./trail_share_modal.svelte";
|
||||||
|
|
||||||
export let trail: Trail;
|
export let trail: Trail;
|
||||||
export let mode: "overview" | "map";
|
export let mode: "overview" | "map";
|
||||||
@@ -25,6 +26,7 @@
|
|||||||
let openConfirmModal: () => void;
|
let openConfirmModal: () => void;
|
||||||
let openListSelectModal: () => void;
|
let openListSelectModal: () => void;
|
||||||
let openExportModal: () => void;
|
let openExportModal: () => void;
|
||||||
|
let openShareModal: () => void;
|
||||||
|
|
||||||
const dropdownItems: DropdownItem[] = [
|
const dropdownItems: DropdownItem[] = [
|
||||||
mode == "overview"
|
mode == "overview"
|
||||||
@@ -47,6 +49,7 @@
|
|||||||
: []),
|
: []),
|
||||||
{ text: $_("print"), value: "print", icon: "print" },
|
{ text: $_("print"), value: "print", icon: "print" },
|
||||||
{ text: $_("add-to-list"), value: "list", icon: "bookmark" },
|
{ text: $_("add-to-list"), value: "list", icon: "bookmark" },
|
||||||
|
{ text: $_("share"), value: "share", icon: "share" },
|
||||||
{ text: $_("edit"), value: "edit", icon: "pen" },
|
{ text: $_("edit"), value: "edit", icon: "pen" },
|
||||||
{ text: $_("delete"), value: "delete", icon: "trash" },
|
{ text: $_("delete"), value: "delete", icon: "trash" },
|
||||||
];
|
];
|
||||||
@@ -69,6 +72,8 @@
|
|||||||
?.focus();
|
?.focus();
|
||||||
} else if (item.value == "print") {
|
} else if (item.value == "print") {
|
||||||
goto(`/map/trail/${trail.id}/print`);
|
goto(`/map/trail/${trail.id}/print`);
|
||||||
|
} else if (item.value == "share") {
|
||||||
|
openShareModal();
|
||||||
} else if (item.value == "download") {
|
} else if (item.value == "download") {
|
||||||
openExportModal();
|
openExportModal();
|
||||||
} else if (item.value == "edit") {
|
} else if (item.value == "edit") {
|
||||||
@@ -84,9 +89,11 @@
|
|||||||
summitLog: boolean;
|
summitLog: boolean;
|
||||||
}) {
|
}) {
|
||||||
try {
|
try {
|
||||||
let fileData: string = await trail2gpx(trail);
|
let fileData: string = await trail2gpx(trail);
|
||||||
if (exportSettings.fileFormat == "json") {
|
if (exportSettings.fileFormat == "json") {
|
||||||
fileData = JSON.stringify(gpx(new DOMParser().parseFromString(fileData, "text/xml")));
|
fileData = JSON.stringify(
|
||||||
|
gpx(new DOMParser().parseFromString(fileData, "text/xml")),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const zip = new JSZip();
|
const zip = new JSZip();
|
||||||
zip.file(`${trail.name}.${exportSettings.fileFormat}`, fileData);
|
zip.file(`${trail.name}.${exportSettings.fileFormat}`, fileData);
|
||||||
@@ -101,12 +108,15 @@
|
|||||||
photoFolder?.file(photo, photoData, { base64: true });
|
photoFolder?.file(photo, photoData, { base64: true });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(exportSettings.summitLog) {
|
if (exportSettings.summitLog) {
|
||||||
let summitLogString = ""
|
let summitLogString = "";
|
||||||
for (const summitLog of trail.expand.summit_logs) {
|
for (const summitLog of trail.expand.summit_logs) {
|
||||||
summitLogString += `${summitLog.date},${summitLog.text}\n`
|
summitLogString += `${summitLog.date},${summitLog.text}\n`;
|
||||||
}
|
}
|
||||||
zip.file(`${trail.name} - ${$_("summit-book")}.csv`, summitLogString)
|
zip.file(
|
||||||
|
`${trail.name} - ${$_("summit-book")}.csv`,
|
||||||
|
summitLogString,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
const blob = await zip.generateAsync({ type: "blob" });
|
const blob = await zip.generateAsync({ type: "blob" });
|
||||||
saveAs(blob, `${trail.name}.zip`);
|
saveAs(blob, `${trail.name}.zip`);
|
||||||
@@ -179,3 +189,4 @@
|
|||||||
bind:openModal={openExportModal}
|
bind:openModal={openExportModal}
|
||||||
on:export={(e) => exportTrail(e.detail)}
|
on:export={(e) => exportTrail(e.detail)}
|
||||||
></TrailExportModal>
|
></TrailExportModal>
|
||||||
|
<TrailShareModal bind:openModal={openShareModal}></TrailShareModal>
|
||||||
|
|||||||
77
web/src/lib/components/trail/trail_share_modal.svelte
Normal file
77
web/src/lib/components/trail/trail_share_modal.svelte
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Modal from "$lib/components/base/modal.svelte";
|
||||||
|
import { createEventDispatcher } from "svelte";
|
||||||
|
import { _ } from "svelte-i18n";
|
||||||
|
import Button from "../base/button.svelte";
|
||||||
|
import Search, { type SearchItem } from "../base/search.svelte";
|
||||||
|
import { users_search } from "$lib/stores/user_store";
|
||||||
|
import type { User } from "$lib/models/user";
|
||||||
|
import { show_toast } from "$lib/stores/toast_store";
|
||||||
|
|
||||||
|
export let openModal: (() => void) | undefined = undefined;
|
||||||
|
export let closeModal: (() => void) | undefined = undefined;
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
|
let copyButtonText = $_("copy-link");
|
||||||
|
|
||||||
|
let searchItems: SearchItem[] = [];
|
||||||
|
|
||||||
|
async function updateUsers(q: string) {
|
||||||
|
try {
|
||||||
|
const users: User[] = await users_search(q);
|
||||||
|
searchItems = users.map((u) => ({
|
||||||
|
text: u.username!,
|
||||||
|
value: u.id,
|
||||||
|
icon: "user"
|
||||||
|
}))
|
||||||
|
} catch (e) {
|
||||||
|
console.error(e);
|
||||||
|
show_toast({
|
||||||
|
type: "error",
|
||||||
|
icon: "close",
|
||||||
|
text: "Error during search",
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyURLToClipboard() {
|
||||||
|
navigator.clipboard.writeText(window.location.href);
|
||||||
|
|
||||||
|
copyButtonText = $_("link-copied");
|
||||||
|
setTimeout(() => (copyButtonText = $_("copy-link")), 3000);
|
||||||
|
}
|
||||||
|
|
||||||
|
function close() {
|
||||||
|
searchItems = [];
|
||||||
|
dispatch("save");
|
||||||
|
closeModal!();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Modal
|
||||||
|
id="share-modal"
|
||||||
|
title="Share this trail"
|
||||||
|
size="max-w-lg"
|
||||||
|
bind:openModal
|
||||||
|
bind:closeModal
|
||||||
|
>
|
||||||
|
<div slot="content">
|
||||||
|
<Search
|
||||||
|
on:update={(e) => updateUsers(e.detail)}
|
||||||
|
placeholder={`${$_("username")}`}
|
||||||
|
items={searchItems}
|
||||||
|
></Search>
|
||||||
|
</div>
|
||||||
|
<div slot="footer" class="flex justify-between items-center gap-4">
|
||||||
|
<Button
|
||||||
|
secondary={true}
|
||||||
|
disabled={copyButtonText == $_("link-copied")}
|
||||||
|
on:click={copyURLToClipboard}
|
||||||
|
>
|
||||||
|
<i class="fa fa-link mr-2"></i>
|
||||||
|
{copyButtonText}
|
||||||
|
</Button>
|
||||||
|
<button class="btn-primary" on:click={close}>{$_("close")}</button>
|
||||||
|
</div></Modal
|
||||||
|
>
|
||||||
@@ -18,10 +18,12 @@
|
|||||||
"change": "Ändern",
|
"change": "Ändern",
|
||||||
"changelog": "Changelog",
|
"changelog": "Changelog",
|
||||||
"chinese": "Chinesisch (vereinfacht)",
|
"chinese": "Chinesisch (vereinfacht)",
|
||||||
|
"close": "",
|
||||||
"comment": "{n, plural, =1 {Kommentar} other {Kommentare}}",
|
"comment": "{n, plural, =1 {Kommentar} other {Kommentare}}",
|
||||||
"completed": "Abgeschlossen",
|
"completed": "Abgeschlossen",
|
||||||
"completion-status": "Abschlussstatus",
|
"completion-status": "Abschlussstatus",
|
||||||
"contribute": "Mitwirken",
|
"contribute": "Mitwirken",
|
||||||
|
"copy-link": "",
|
||||||
"create-new-list": "Neue Liste erstellen",
|
"create-new-list": "Neue Liste erstellen",
|
||||||
"creation-date": "Erstellungsdatum",
|
"creation-date": "Erstellungsdatum",
|
||||||
"cycling": "Radfahren",
|
"cycling": "Radfahren",
|
||||||
@@ -81,6 +83,7 @@
|
|||||||
"language": "Sprache",
|
"language": "Sprache",
|
||||||
"latitude": "Breitengrad",
|
"latitude": "Breitengrad",
|
||||||
"license": "Lizenz",
|
"license": "Lizenz",
|
||||||
|
"link-copied": "",
|
||||||
"list": "{n, plural, =1 {Liste} other {Listen}}",
|
"list": "{n, plural, =1 {Liste} other {Listen}}",
|
||||||
"location": "Standort",
|
"location": "Standort",
|
||||||
"login": "Login",
|
"login": "Login",
|
||||||
@@ -130,6 +133,7 @@
|
|||||||
"search-trails": "Route suchen",
|
"search-trails": "Route suchen",
|
||||||
"select-list": "Liste auswählen",
|
"select-list": "Liste auswählen",
|
||||||
"settings": "Einstellungen",
|
"settings": "Einstellungen",
|
||||||
|
"share": "",
|
||||||
"show-in-overview": "In der Übersicht anzeigen",
|
"show-in-overview": "In der Übersicht anzeigen",
|
||||||
"show-on-map": "Auf der Karte anzeigen",
|
"show-on-map": "Auf der Karte anzeigen",
|
||||||
"slogan": "Speichere deine Abenteuer!",
|
"slogan": "Speichere deine Abenteuer!",
|
||||||
|
|||||||
@@ -18,10 +18,12 @@
|
|||||||
"change": "Change",
|
"change": "Change",
|
||||||
"changelog": "Changelog",
|
"changelog": "Changelog",
|
||||||
"chinese": "Chinese (simplified)",
|
"chinese": "Chinese (simplified)",
|
||||||
|
"close": "Close",
|
||||||
"comment": "{n, plural, =1 {Comment} other {Comments}}",
|
"comment": "{n, plural, =1 {Comment} other {Comments}}",
|
||||||
"completed": "Completed",
|
"completed": "Completed",
|
||||||
"completion-status": "Completion Status",
|
"completion-status": "Completion Status",
|
||||||
"contribute": "Contribute",
|
"contribute": "Contribute",
|
||||||
|
"copy-link": "Copy Link",
|
||||||
"create-new-list": "Create new list",
|
"create-new-list": "Create new list",
|
||||||
"creation-date": "Creation date",
|
"creation-date": "Creation date",
|
||||||
"cycling": "Cycling",
|
"cycling": "Cycling",
|
||||||
@@ -81,6 +83,7 @@
|
|||||||
"language": "Language",
|
"language": "Language",
|
||||||
"latitude": "Latitude",
|
"latitude": "Latitude",
|
||||||
"license": "License",
|
"license": "License",
|
||||||
|
"link-copied": "Link copied!",
|
||||||
"list": "{n, plural, =1 {List} other {Lists}}",
|
"list": "{n, plural, =1 {List} other {Lists}}",
|
||||||
"location": "Location",
|
"location": "Location",
|
||||||
"login": "Login",
|
"login": "Login",
|
||||||
@@ -130,6 +133,7 @@
|
|||||||
"search-trails": "Search trails",
|
"search-trails": "Search trails",
|
||||||
"select-list": "Select List",
|
"select-list": "Select List",
|
||||||
"settings": "Settings",
|
"settings": "Settings",
|
||||||
|
"share": "Share",
|
||||||
"show-in-overview": "Show in overview",
|
"show-in-overview": "Show in overview",
|
||||||
"show-on-map": "Show on map",
|
"show-on-map": "Show on map",
|
||||||
"slogan": "Save your adventures!",
|
"slogan": "Save your adventures!",
|
||||||
|
|||||||
@@ -18,10 +18,12 @@
|
|||||||
"change": "Changement",
|
"change": "Changement",
|
||||||
"changelog": "Journal des modifications",
|
"changelog": "Journal des modifications",
|
||||||
"chinese": "Chinois (simplifié)",
|
"chinese": "Chinois (simplifié)",
|
||||||
|
"close": "",
|
||||||
"comment": "{n, plural, =1 {Commentaire} other {Commentaires}}",
|
"comment": "{n, plural, =1 {Commentaire} other {Commentaires}}",
|
||||||
"completed": "Compléter",
|
"completed": "Compléter",
|
||||||
"completion-status": "L'état d'achèvement",
|
"completion-status": "L'état d'achèvement",
|
||||||
"contribute": "Contribuer",
|
"contribute": "Contribuer",
|
||||||
|
"copy-link": "",
|
||||||
"create-new-list": "Créer une nouvelle liste",
|
"create-new-list": "Créer une nouvelle liste",
|
||||||
"creation-date": "Date de création",
|
"creation-date": "Date de création",
|
||||||
"cycling": "",
|
"cycling": "",
|
||||||
@@ -81,6 +83,7 @@
|
|||||||
"language": "Langue",
|
"language": "Langue",
|
||||||
"latitude": "Latitude",
|
"latitude": "Latitude",
|
||||||
"license": "Licence",
|
"license": "Licence",
|
||||||
|
"link-copied": "",
|
||||||
"list": "{n, plural, =1 {Liste} other {Listes}}",
|
"list": "{n, plural, =1 {Liste} other {Listes}}",
|
||||||
"location": "Localisation",
|
"location": "Localisation",
|
||||||
"login": "Connexion",
|
"login": "Connexion",
|
||||||
@@ -130,6 +133,7 @@
|
|||||||
"search-trails": "Chercher un itinéraire",
|
"search-trails": "Chercher un itinéraire",
|
||||||
"select-list": "Liste de choix",
|
"select-list": "Liste de choix",
|
||||||
"settings": "Paramètres",
|
"settings": "Paramètres",
|
||||||
|
"share": "",
|
||||||
"show-in-overview": "Voir dans l'aperçu",
|
"show-in-overview": "Voir dans l'aperçu",
|
||||||
"show-on-map": "Voir sur la carte",
|
"show-on-map": "Voir sur la carte",
|
||||||
"slogan": "Sauvegarder vos aventures !",
|
"slogan": "Sauvegarder vos aventures !",
|
||||||
|
|||||||
@@ -18,10 +18,12 @@
|
|||||||
"change": "Változás",
|
"change": "Változás",
|
||||||
"changelog": "Változás napló",
|
"changelog": "Változás napló",
|
||||||
"chinese": "Kínai (egyszerűsítve)",
|
"chinese": "Kínai (egyszerűsítve)",
|
||||||
|
"close": "",
|
||||||
"comment": "{n, plural, =1 {Megjegyzés} other {Megjegyzés}}",
|
"comment": "{n, plural, =1 {Megjegyzés} other {Megjegyzés}}",
|
||||||
"completed": "Teljesítve",
|
"completed": "Teljesítve",
|
||||||
"completion-status": "Befejezés állapota",
|
"completion-status": "Befejezés állapota",
|
||||||
"contribute": "Hozzájárulás",
|
"contribute": "Hozzájárulás",
|
||||||
|
"copy-link": "",
|
||||||
"create-new-list": "Új lista létrehozása",
|
"create-new-list": "Új lista létrehozása",
|
||||||
"creation-date": "létrehozás dátuma",
|
"creation-date": "létrehozás dátuma",
|
||||||
"cycling": "",
|
"cycling": "",
|
||||||
@@ -81,6 +83,7 @@
|
|||||||
"language": "Nyelf",
|
"language": "Nyelf",
|
||||||
"latitude": "Szélesség",
|
"latitude": "Szélesség",
|
||||||
"license": "License",
|
"license": "License",
|
||||||
|
"link-copied": "",
|
||||||
"list": "{n, plural, =1 {Lista} other {Listák}}",
|
"list": "{n, plural, =1 {Lista} other {Listák}}",
|
||||||
"location": "Helyszín",
|
"location": "Helyszín",
|
||||||
"login": "Bejelentkezés",
|
"login": "Bejelentkezés",
|
||||||
@@ -130,6 +133,7 @@
|
|||||||
"search-trails": "Nyomvonalak keresése",
|
"search-trails": "Nyomvonalak keresése",
|
||||||
"select-list": "Lista kiválasztása",
|
"select-list": "Lista kiválasztása",
|
||||||
"settings": "Beállítások",
|
"settings": "Beállítások",
|
||||||
|
"share": "",
|
||||||
"show-in-overview": "Áttekintés",
|
"show-in-overview": "Áttekintés",
|
||||||
"show-on-map": "Mutatás térképen",
|
"show-on-map": "Mutatás térképen",
|
||||||
"slogan": "Mentse el a kalandjait!",
|
"slogan": "Mentse el a kalandjait!",
|
||||||
|
|||||||
@@ -18,10 +18,12 @@
|
|||||||
"change": "Wijzigen",
|
"change": "Wijzigen",
|
||||||
"changelog": "Wijzigingslog",
|
"changelog": "Wijzigingslog",
|
||||||
"chinese": "Versimpeld Chinees",
|
"chinese": "Versimpeld Chinees",
|
||||||
|
"close": "",
|
||||||
"comment": "{n, plural, =1 {Opmerking} other {Opmerkingen}}",
|
"comment": "{n, plural, =1 {Opmerking} other {Opmerkingen}}",
|
||||||
"completed": "Voltooid",
|
"completed": "Voltooid",
|
||||||
"completion-status": "Voltooiingsstatus",
|
"completion-status": "Voltooiingsstatus",
|
||||||
"contribute": "Bijdragen",
|
"contribute": "Bijdragen",
|
||||||
|
"copy-link": "",
|
||||||
"create-new-list": "Nieuwe lijst",
|
"create-new-list": "Nieuwe lijst",
|
||||||
"creation-date": "Aanmaakdatum",
|
"creation-date": "Aanmaakdatum",
|
||||||
"cycling": "",
|
"cycling": "",
|
||||||
@@ -81,6 +83,7 @@
|
|||||||
"language": "Taal",
|
"language": "Taal",
|
||||||
"latitude": "Breedtegraad",
|
"latitude": "Breedtegraad",
|
||||||
"license": "Licentie",
|
"license": "Licentie",
|
||||||
|
"link-copied": "",
|
||||||
"list": "{n, plural, =1 {Lijst} other {Lijsten}}",
|
"list": "{n, plural, =1 {Lijst} other {Lijsten}}",
|
||||||
"location": "Locatie",
|
"location": "Locatie",
|
||||||
"login": "Inloggen",
|
"login": "Inloggen",
|
||||||
@@ -130,6 +133,7 @@
|
|||||||
"search-trails": "Zoeken naar wandelroutes",
|
"search-trails": "Zoeken naar wandelroutes",
|
||||||
"select-list": "Kies een lijst",
|
"select-list": "Kies een lijst",
|
||||||
"settings": "Instellingen",
|
"settings": "Instellingen",
|
||||||
|
"share": "",
|
||||||
"show-in-overview": "Tonen op overzicht",
|
"show-in-overview": "Tonen op overzicht",
|
||||||
"show-on-map": "Tonen op kaart",
|
"show-on-map": "Tonen op kaart",
|
||||||
"slogan": "Bewaar je avonturen!",
|
"slogan": "Bewaar je avonturen!",
|
||||||
|
|||||||
@@ -18,10 +18,12 @@
|
|||||||
"change": "Zmień",
|
"change": "Zmień",
|
||||||
"changelog": "Dziennik zmian",
|
"changelog": "Dziennik zmian",
|
||||||
"chinese": "Uproszczony chiński",
|
"chinese": "Uproszczony chiński",
|
||||||
|
"close": "",
|
||||||
"comment": "{n, plural, =1 {Komentarz} other {Komentarze}}",
|
"comment": "{n, plural, =1 {Komentarz} other {Komentarze}}",
|
||||||
"completed": "Zakończono",
|
"completed": "Zakończono",
|
||||||
"completion-status": "Stan ukończenia",
|
"completion-status": "Stan ukończenia",
|
||||||
"contribute": "Kontrybuuj",
|
"contribute": "Kontrybuuj",
|
||||||
|
"copy-link": "",
|
||||||
"create-new-list": "Stwórz nową listę",
|
"create-new-list": "Stwórz nową listę",
|
||||||
"creation-date": "Data dodania",
|
"creation-date": "Data dodania",
|
||||||
"cycling": "",
|
"cycling": "",
|
||||||
@@ -81,6 +83,7 @@
|
|||||||
"language": "Język",
|
"language": "Język",
|
||||||
"latitude": "Szerokość",
|
"latitude": "Szerokość",
|
||||||
"license": "Licencja",
|
"license": "Licencja",
|
||||||
|
"link-copied": "",
|
||||||
"list": "{n, plural, =1 {Lista} other {Listy}}",
|
"list": "{n, plural, =1 {Lista} other {Listy}}",
|
||||||
"location": "Lokalizacja",
|
"location": "Lokalizacja",
|
||||||
"login": "Zaloguj się",
|
"login": "Zaloguj się",
|
||||||
@@ -130,6 +133,7 @@
|
|||||||
"search-trails": "Szukaj ścieżek",
|
"search-trails": "Szukaj ścieżek",
|
||||||
"select-list": "Wybierz Listę",
|
"select-list": "Wybierz Listę",
|
||||||
"settings": "Ustawienia",
|
"settings": "Ustawienia",
|
||||||
|
"share": "",
|
||||||
"show-in-overview": "Pokaż w przeglądzie",
|
"show-in-overview": "Pokaż w przeglądzie",
|
||||||
"show-on-map": "Pokaż na mapie",
|
"show-on-map": "Pokaż na mapie",
|
||||||
"slogan": "Zapisz swoją wyprawę!",
|
"slogan": "Zapisz swoją wyprawę!",
|
||||||
|
|||||||
@@ -18,10 +18,12 @@
|
|||||||
"change": "Alterar",
|
"change": "Alterar",
|
||||||
"changelog": "Registo de alterações",
|
"changelog": "Registo de alterações",
|
||||||
"chinese": "Chinês (simplificado)",
|
"chinese": "Chinês (simplificado)",
|
||||||
|
"close": "",
|
||||||
"comment": "{n, plural, =1 {Comentário} other {Comentários}}",
|
"comment": "{n, plural, =1 {Comentário} other {Comentários}}",
|
||||||
"completed": "Completada",
|
"completed": "Completada",
|
||||||
"completion-status": "Status de conclusão",
|
"completion-status": "Status de conclusão",
|
||||||
"contribute": "Contribuir",
|
"contribute": "Contribuir",
|
||||||
|
"copy-link": "",
|
||||||
"create-new-list": "Criar nova lista",
|
"create-new-list": "Criar nova lista",
|
||||||
"creation-date": "Data de criação",
|
"creation-date": "Data de criação",
|
||||||
"cycling": "",
|
"cycling": "",
|
||||||
@@ -81,6 +83,7 @@
|
|||||||
"language": "Língua",
|
"language": "Língua",
|
||||||
"latitude": "Latitude",
|
"latitude": "Latitude",
|
||||||
"license": "Licença",
|
"license": "Licença",
|
||||||
|
"link-copied": "",
|
||||||
"list": "{n, plural, =1 {Lista} other {Listas}}",
|
"list": "{n, plural, =1 {Lista} other {Listas}}",
|
||||||
"location": "Localização",
|
"location": "Localização",
|
||||||
"login": "Login",
|
"login": "Login",
|
||||||
@@ -130,6 +133,7 @@
|
|||||||
"search-trails": "Procurar trilhos",
|
"search-trails": "Procurar trilhos",
|
||||||
"select-list": "Selecionar lista",
|
"select-list": "Selecionar lista",
|
||||||
"settings": "Definições",
|
"settings": "Definições",
|
||||||
|
"share": "",
|
||||||
"show-in-overview": "Mostrar na vista geral",
|
"show-in-overview": "Mostrar na vista geral",
|
||||||
"show-on-map": "Mostrar no mapa",
|
"show-on-map": "Mostrar no mapa",
|
||||||
"slogan": "Guarde as suas aventuras!",
|
"slogan": "Guarde as suas aventuras!",
|
||||||
|
|||||||
@@ -18,10 +18,12 @@
|
|||||||
"change": "更换",
|
"change": "更换",
|
||||||
"changelog": "变更日志",
|
"changelog": "变更日志",
|
||||||
"chinese": "华人",
|
"chinese": "华人",
|
||||||
|
"close": "",
|
||||||
"comment": "{n, plural, =1 {评论} other {评论}}",
|
"comment": "{n, plural, =1 {评论} other {评论}}",
|
||||||
"completed": "已完成",
|
"completed": "已完成",
|
||||||
"completion-status": "完成状态",
|
"completion-status": "完成状态",
|
||||||
"contribute": "贡献",
|
"contribute": "贡献",
|
||||||
|
"copy-link": "",
|
||||||
"create-new-list": "创建新列表",
|
"create-new-list": "创建新列表",
|
||||||
"creation-date": "创建日期",
|
"creation-date": "创建日期",
|
||||||
"cycling": "",
|
"cycling": "",
|
||||||
@@ -81,6 +83,7 @@
|
|||||||
"language": "语言",
|
"language": "语言",
|
||||||
"latitude": "维度",
|
"latitude": "维度",
|
||||||
"license": "开源协议",
|
"license": "开源协议",
|
||||||
|
"link-copied": "",
|
||||||
"list": "{n, plural, =1 {列表} other {列表}}",
|
"list": "{n, plural, =1 {列表} other {列表}}",
|
||||||
"location": "地点",
|
"location": "地点",
|
||||||
"login": "登录",
|
"login": "登录",
|
||||||
@@ -130,6 +133,7 @@
|
|||||||
"search-trails": "搜索路线",
|
"search-trails": "搜索路线",
|
||||||
"select-list": "选择列表",
|
"select-list": "选择列表",
|
||||||
"settings": "设置",
|
"settings": "设置",
|
||||||
|
"share": "",
|
||||||
"show-in-overview": "详情中展示",
|
"show-in-overview": "详情中展示",
|
||||||
"show-on-map": "地图中展示",
|
"show-on-map": "地图中展示",
|
||||||
"slogan": "保存你的冒险!",
|
"slogan": "保存你的冒险!",
|
||||||
|
|||||||
@@ -23,6 +23,21 @@ export async function users_create(user: User) {
|
|||||||
await settings_create(settings);
|
await settings_create(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function users_search(q: string) {
|
||||||
|
let r = await fetch('/api/v1/user?' + new URLSearchParams({
|
||||||
|
"filter": `username~"${q}"`,
|
||||||
|
}), {
|
||||||
|
method: 'GET',
|
||||||
|
})
|
||||||
|
const response = await r.json()
|
||||||
|
|
||||||
|
if (r.ok) {
|
||||||
|
return response.items;
|
||||||
|
} else {
|
||||||
|
throw new ClientResponseError(response)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export async function users_auth_methods(f: (url: RequestInfo | URL, config?: RequestInit) => Promise<Response> = fetch): Promise<AuthMethodsList> {
|
export async function users_auth_methods(f: (url: RequestInfo | URL, config?: RequestInit) => Promise<Response> = fetch): Promise<AuthMethodsList> {
|
||||||
const r = await f('/api/v1/auth/oauth', {
|
const r = await f('/api/v1/auth/oauth', {
|
||||||
method: 'GET',
|
method: 'GET',
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ export async function gpx2trail(gpxString: string) {
|
|||||||
|
|
||||||
const trail = new Trail("");
|
const trail = new Trail("");
|
||||||
|
|
||||||
trail.name = gpx.metadata?.name ?? "";
|
trail.name = gpx.metadata?.name ?? `trail-${new Date().toISOString()}`;
|
||||||
|
|
||||||
trail.description = gpx.metadata?.desc;
|
trail.description = gpx.metadata?.desc;
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,25 @@
|
|||||||
import { env } from '$env/dynamic/public';
|
import { env } from '$env/dynamic/public';
|
||||||
|
import type { User } from '$lib/models/user';
|
||||||
import { pb } from '$lib/pocketbase';
|
import { pb } from '$lib/pocketbase';
|
||||||
import type { User } from '$lib/stores/user_store';
|
|
||||||
import { error, json, type RequestEvent } from '@sveltejs/kit'
|
import { error, json, type RequestEvent } from '@sveltejs/kit'
|
||||||
import { ClientResponseError } from 'pocketbase';
|
import { ClientResponseError } from 'pocketbase';
|
||||||
|
|
||||||
|
export async function GET(event: RequestEvent) {
|
||||||
|
const page = event.url.searchParams.get("page") ?? "0";
|
||||||
|
const perPage = event.url.searchParams.get("per-page") ?? "10";
|
||||||
|
const sort = event.url.searchParams.get("sort") ?? ""
|
||||||
|
const filter = event.url.searchParams.get("filter") ?? "";
|
||||||
|
|
||||||
|
try {
|
||||||
|
const r = await pb.collection('users_anonymous')
|
||||||
|
.getList<User>(parseInt(page), parseInt(perPage), { sort: sort ?? "", filter: filter ?? "" })
|
||||||
|
return json(r)
|
||||||
|
} catch (e: any) {
|
||||||
|
throw error(e.status, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function PUT(event: RequestEvent) {
|
export async function PUT(event: RequestEvent) {
|
||||||
const data = await event.request.json()
|
const data = await event.request.json()
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user