mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 01:01:39 -05:00
* fix: move foreman to global gems to fix startup crash (#1971) * Update exporting code to stream points data to file in batches to red… (#1980) * Update exporting code to stream points data to file in batches to reduce memory usage * Update changelog * Update changelog * Feature/maplibre frontend (#1953) * Add a plan to use MapLibre GL JS for the frontend map rendering, replacing Leaflet * Implement phase 1 * Phases 1-3 + part of 4 * Fix e2e tests * Phase 6 * Implement fog of war * Phase 7 * Next step: fix specs, phase 7 done * Use our own map tiles * Extract v2 map logic to separate manager classes * Update settings panel on v2 map * Update v2 e2e tests structure * Reimplement location search in maps v2 * Update speed routes * Implement visits and places creation in v2 * Fix last failing test * Implement visits merging * Fix a routes e2e test and simplify the routes layer styling. * Extract js to modules from maps_v2_controller.js * Implement area creation * Fix spec problem * Fix some e2e tests * Implement live mode in v2 map * Update icons and panel * Extract some styles * Remove unused file * Start adding dark theme to popups on MapLibre maps * Make popups respect dark theme * Move v2 maps to maplibre namespace * Update v2 references to maplibre * Put place, area and visit info into side panel * Update API to use safe settings config method * Fix specs * Fix method name to config in SafeSettings and update usages accordingly * Add missing public files * Add handling for real time points * Fix remembering enabled/disabled layers of the v2 map * Fix lots of e2e tests * Add settings to select map version * Use maps/v2 as main path for MapLibre maps * Update routing * Update live mode * Update maplibre controller * Update changelog * Remove some console.log statements --------- Co-authored-by: Robin Tuszik <mail@robin.gg>
260 lines
9.4 KiB
Ruby
260 lines
9.4 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'swagger_helper'
|
|
|
|
describe 'Settings API', type: :request do
|
|
path '/api/v1/settings' do
|
|
patch 'Updates user settings' do
|
|
request_body_example value: {
|
|
'settings': {
|
|
'route_opacity': 60,
|
|
'meters_between_routes': 500,
|
|
'minutes_between_routes': 30,
|
|
'fog_of_war_meters': 50,
|
|
'time_threshold_minutes': 30,
|
|
'merge_threshold_minutes': 15,
|
|
'preferred_map_layer': 'OpenStreetMap',
|
|
'speed_colored_routes': false,
|
|
'points_rendering_mode': 'raw',
|
|
'live_map_enabled': true,
|
|
'immich_url': 'https://immich.example.com',
|
|
'immich_api_key': 'your-immich-api-key',
|
|
'photoprism_url': 'https://photoprism.example.com',
|
|
'photoprism_api_key': 'your-photoprism-api-key',
|
|
'speed_color_scale': 'viridis',
|
|
'fog_of_war_threshold': 100
|
|
}
|
|
}
|
|
tags 'Settings'
|
|
consumes 'application/json'
|
|
parameter name: :settings, in: :body, schema: {
|
|
type: :object,
|
|
properties: {
|
|
route_opacity: {
|
|
type: :number,
|
|
example: 60,
|
|
description: 'Route opacity percentage (0-100)'
|
|
},
|
|
meters_between_routes: {
|
|
type: :number,
|
|
example: 500,
|
|
description: 'Minimum distance between routes in meters'
|
|
},
|
|
minutes_between_routes: {
|
|
type: :number,
|
|
example: 30,
|
|
description: 'Minimum time between routes in minutes'
|
|
},
|
|
fog_of_war_meters: {
|
|
type: :number,
|
|
example: 50,
|
|
description: 'Fog of war radius in meters'
|
|
},
|
|
time_threshold_minutes: {
|
|
type: :number,
|
|
example: 30,
|
|
description: 'Time threshold for grouping points in minutes'
|
|
},
|
|
merge_threshold_minutes: {
|
|
type: :number,
|
|
example: 15,
|
|
description: 'Threshold for merging nearby points in minutes'
|
|
},
|
|
preferred_map_layer: {
|
|
type: :string,
|
|
example: 'OpenStreetMap',
|
|
description: 'Preferred map layer/tile provider'
|
|
},
|
|
speed_colored_routes: {
|
|
type: :boolean,
|
|
example: false,
|
|
description: 'Whether to color routes based on speed'
|
|
},
|
|
points_rendering_mode: {
|
|
type: :string,
|
|
example: 'raw',
|
|
description: 'How to render points on the map (raw, heatmap, etc.)'
|
|
},
|
|
live_map_enabled: {
|
|
type: :boolean,
|
|
example: true,
|
|
description: 'Whether live map updates are enabled'
|
|
},
|
|
immich_url: {
|
|
type: :string,
|
|
example: 'https://immich.example.com',
|
|
description: 'Immich server URL for photo integration'
|
|
},
|
|
immich_api_key: {
|
|
type: :string,
|
|
example: 'your-immich-api-key',
|
|
description: 'API key for Immich photo service'
|
|
},
|
|
photoprism_url: {
|
|
type: :string,
|
|
example: 'https://photoprism.example.com',
|
|
description: 'PhotoPrism server URL for photo integration'
|
|
},
|
|
photoprism_api_key: {
|
|
type: :string,
|
|
example: 'your-photoprism-api-key',
|
|
description: 'API key for PhotoPrism photo service'
|
|
},
|
|
speed_color_scale: {
|
|
type: :string,
|
|
example: 'viridis',
|
|
description: 'Color scale for speed-colored routes'
|
|
},
|
|
fog_of_war_threshold: {
|
|
type: :number,
|
|
example: 100,
|
|
description: 'Fog of war threshold value'
|
|
}
|
|
}
|
|
}
|
|
parameter name: :api_key, in: :query, type: :string, required: true, description: 'API Key'
|
|
response '200', 'settings updated' do
|
|
let(:settings) { { settings: { route_opacity: 60 } } }
|
|
let(:api_key) { create(:user).api_key }
|
|
|
|
run_test!
|
|
end
|
|
end
|
|
|
|
get 'Retrieves user settings' do
|
|
tags 'Settings'
|
|
produces 'application/json'
|
|
parameter name: :api_key, in: :query, type: :string, required: true, description: 'API Key'
|
|
response '200', 'settings found' do
|
|
schema type: :object,
|
|
properties: {
|
|
settings: {
|
|
type: :object,
|
|
properties: {
|
|
route_opacity: {
|
|
type: :number,
|
|
example: 60,
|
|
description: 'Route opacity percentage (0-100)'
|
|
},
|
|
meters_between_routes: {
|
|
oneOf: [
|
|
{ type: :number },
|
|
{ type: :string }
|
|
],
|
|
example: 500,
|
|
description: 'Minimum distance between routes in meters'
|
|
},
|
|
minutes_between_routes: {
|
|
oneOf: [
|
|
{ type: :number },
|
|
{ type: :string }
|
|
],
|
|
example: 30,
|
|
description: 'Minimum time between routes in minutes'
|
|
},
|
|
fog_of_war_meters: {
|
|
oneOf: [
|
|
{ type: :number },
|
|
{ type: :string }
|
|
],
|
|
example: 50,
|
|
description: 'Fog of war radius in meters'
|
|
},
|
|
time_threshold_minutes: {
|
|
oneOf: [
|
|
{ type: :number },
|
|
{ type: :string }
|
|
],
|
|
example: 30,
|
|
description: 'Time threshold for grouping points in minutes'
|
|
},
|
|
merge_threshold_minutes: {
|
|
oneOf: [
|
|
{ type: :number },
|
|
{ type: :string }
|
|
],
|
|
example: 15,
|
|
description: 'Threshold for merging nearby points in minutes'
|
|
},
|
|
preferred_map_layer: {
|
|
type: :string,
|
|
example: 'OpenStreetMap',
|
|
description: 'Preferred map layer/tile provider'
|
|
},
|
|
speed_colored_routes: {
|
|
type: :boolean,
|
|
example: false,
|
|
description: 'Whether to color routes based on speed'
|
|
},
|
|
points_rendering_mode: {
|
|
type: :string,
|
|
example: 'raw',
|
|
description: 'How to render points on the map (raw, heatmap, etc.)'
|
|
},
|
|
live_map_enabled: {
|
|
type: :boolean,
|
|
example: true,
|
|
description: 'Whether live map updates are enabled'
|
|
},
|
|
immich_url: {
|
|
oneOf: [
|
|
{ type: :string },
|
|
{ type: :null }
|
|
],
|
|
example: 'https://immich.example.com',
|
|
description: 'Immich server URL for photo integration'
|
|
},
|
|
immich_api_key: {
|
|
oneOf: [
|
|
{ type: :string },
|
|
{ type: :null }
|
|
],
|
|
example: 'your-immich-api-key',
|
|
description: 'API key for Immich photo service'
|
|
},
|
|
photoprism_url: {
|
|
oneOf: [
|
|
{ type: :string },
|
|
{ type: :null }
|
|
],
|
|
example: 'https://photoprism.example.com',
|
|
description: 'PhotoPrism server URL for photo integration'
|
|
},
|
|
photoprism_api_key: {
|
|
oneOf: [
|
|
{ type: :string },
|
|
{ type: :null }
|
|
],
|
|
example: 'your-photoprism-api-key',
|
|
description: 'API key for PhotoPrism photo service'
|
|
},
|
|
speed_color_scale: {
|
|
oneOf: [
|
|
{ type: :string },
|
|
{ type: :null }
|
|
],
|
|
example: 'viridis',
|
|
description: 'Color scale for speed-colored routes'
|
|
},
|
|
fog_of_war_threshold: {
|
|
oneOf: [
|
|
{ type: :number },
|
|
{ type: :string },
|
|
{ type: :null }
|
|
],
|
|
example: 100,
|
|
description: 'Fog of war threshold value'
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
let(:user) { create(:user) }
|
|
let(:settings) { { settings: user.settings } }
|
|
let(:api_key) { user.api_key }
|
|
|
|
run_test!
|
|
end
|
|
end
|
|
end
|
|
end
|