mirror of
https://github.com/Freika/dawarich.git
synced 2026-01-10 14:58:07 -05:00
Fix few issues
This commit is contained in:
@@ -5,7 +5,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
||||
and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
|
||||
|
||||
# 0.26.6 - 2025-05-21
|
||||
# 0.26.6 - 2025-05-22
|
||||
|
||||
## Added
|
||||
|
||||
@@ -14,7 +14,9 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
||||
## Changed
|
||||
|
||||
- Points are now being created in the `points` queue. #1243
|
||||
|
||||
- Route opacity is now being displayed as percentage in the map settings. #462 #1224
|
||||
- Exported GeoJSON file now contains coordinates as floats instead of strings, as per RFC 7946. #762
|
||||
- Fog of war now can be set to 200 meter per point. #630
|
||||
# 0.26.5 - 2025-05-20
|
||||
|
||||
## Fixed
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
class Api::V1::Maps::TileUsageController < ApiController
|
||||
def create
|
||||
Maps::TileUsage::Track.new(current_api_user.id, tile_usage_params[:count].to_i).call
|
||||
Metrics::Maps::TileUsage::Track.new(current_api_user.id, tile_usage_params[:count].to_i).call
|
||||
|
||||
head :ok
|
||||
end
|
||||
|
||||
@@ -46,6 +46,7 @@ export default class extends BaseController {
|
||||
this.userSettings = JSON.parse(this.element.dataset.user_settings);
|
||||
this.clearFogRadius = parseInt(this.userSettings.fog_of_war_meters) || 50;
|
||||
this.fogLinethreshold = parseInt(this.userSettings.fog_of_war_threshold) || 90;
|
||||
// Store route opacity as decimal (0-1) internally
|
||||
this.routeOpacity = parseFloat(this.userSettings.route_opacity) || 0.6;
|
||||
this.distanceUnit = this.userSettings.distance_unit || "km";
|
||||
this.pointsRenderingMode = this.userSettings.points_rendering_mode || "raw";
|
||||
@@ -726,16 +727,16 @@ export default class extends BaseController {
|
||||
// Form HTML
|
||||
div.innerHTML = `
|
||||
<form id="settings-form" style="overflow-y: auto; height: 36rem; width: 12rem;">
|
||||
<label for="route-opacity">Route Opacity</label>
|
||||
<label for="route-opacity">Route Opacity, %</label>
|
||||
<div class="join">
|
||||
<input type="number" class="input input-ghost join-item focus:input-ghost input-xs input-bordered w-full max-w-xs" id="route-opacity" name="route_opacity" min="0" max="1" step="0.1" value="${this.routeOpacity}">
|
||||
<input type="number" class="input input-ghost join-item focus:input-ghost input-xs input-bordered w-full max-w-xs" id="route-opacity" name="route_opacity" min="10" max="100" step="10" value="${Math.round(this.routeOpacity * 100)}">
|
||||
<label for="route_opacity_info" class="btn-xs join-item ">?</label>
|
||||
|
||||
</div>
|
||||
|
||||
<label for="fog_of_war_meters">Fog of War radius</label>
|
||||
<div class="join">
|
||||
<input type="number" class="join-item input input-ghost focus:input-ghost input-xs input-bordered w-full max-w-xs" id="fog_of_war_meters" name="fog_of_war_meters" min="5" max="100" step="1" value="${this.clearFogRadius}">
|
||||
<input type="number" class="join-item input input-ghost focus:input-ghost input-xs input-bordered w-full max-w-xs" id="fog_of_war_meters" name="fog_of_war_meters" min="5" max="200" step="1" value="${this.clearFogRadius}">
|
||||
<label for="fog_of_war_meters_info" class="btn-xs join-item">?</label>
|
||||
</div>
|
||||
|
||||
@@ -863,12 +864,16 @@ export default class extends BaseController {
|
||||
event.preventDefault();
|
||||
console.log('Form submitted');
|
||||
|
||||
// Convert percentage to decimal for route_opacity
|
||||
const opacityValue = event.target.route_opacity.value.replace('%', '');
|
||||
const decimalOpacity = parseFloat(opacityValue) / 100;
|
||||
|
||||
fetch(`/api/v1/settings?api_key=${this.apiKey}`, {
|
||||
method: 'PATCH',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
settings: {
|
||||
route_opacity: event.target.route_opacity.value,
|
||||
route_opacity: decimalOpacity.toString(),
|
||||
fog_of_war_meters: event.target.fog_of_war_meters.value,
|
||||
fog_of_war_threshold: event.target.fog_of_war_threshold.value,
|
||||
meters_between_routes: event.target.meters_between_routes.value,
|
||||
@@ -940,6 +945,7 @@ export default class extends BaseController {
|
||||
|
||||
// Update the local settings
|
||||
this.userSettings = { ...this.userSettings, ...newSettings };
|
||||
// Store the value as decimal internally, but display as percentage in UI
|
||||
this.routeOpacity = parseFloat(newSettings.route_opacity) || 0.6;
|
||||
this.clearFogRadius = parseInt(newSettings.fog_of_war_meters) || 50;
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class Points::GeojsonSerializer
|
||||
type: 'Feature',
|
||||
geometry: {
|
||||
type: 'Point',
|
||||
coordinates: [point.lon.to_s, point.lat.to_s]
|
||||
coordinates: [point.lon, point.lat]
|
||||
},
|
||||
properties: PointSerializer.new(point).call
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class Maps::TileUsage::Track
|
||||
class Metrics::Maps::TileUsage::Track
|
||||
def initialize(user_id, count = 1)
|
||||
@user_id = user_id
|
||||
@count = count
|
||||
@@ -13,7 +13,7 @@ class Users::SafeSettings
|
||||
'time_threshold_minutes' => 30,
|
||||
'merge_threshold_minutes' => 15,
|
||||
'live_map_enabled' => true,
|
||||
'route_opacity' => 0.6,
|
||||
'route_opacity' => 60,
|
||||
'immich_url' => nil,
|
||||
'immich_api_key' => nil,
|
||||
'photoprism_url' => nil,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -5,11 +5,11 @@ require 'rails_helper'
|
||||
RSpec.describe 'Api::V1::Maps::TileUsage', type: :request do
|
||||
describe 'POST /api/v1/maps/tile_usage' do
|
||||
let(:tile_count) { 5 }
|
||||
let(:track_service) { instance_double(Maps::TileUsage::Track) }
|
||||
let(:track_service) { instance_double(Metrics::Maps::TileUsage::Track) }
|
||||
let(:user) { create(:user) }
|
||||
|
||||
before do
|
||||
allow(Maps::TileUsage::Track).to receive(:new).with(user.id, tile_count).and_return(track_service)
|
||||
allow(Metrics::Maps::TileUsage::Track).to receive(:new).with(user.id, tile_count).and_return(track_service)
|
||||
allow(track_service).to receive(:call)
|
||||
end
|
||||
|
||||
@@ -19,7 +19,7 @@ RSpec.describe 'Api::V1::Maps::TileUsage', type: :request do
|
||||
params: { tile_usage: { count: tile_count } },
|
||||
headers: { 'Authorization' => "Bearer #{user.api_key}" }
|
||||
|
||||
expect(Maps::TileUsage::Track).to have_received(:new).with(user.id, tile_count)
|
||||
expect(Metrics::Maps::TileUsage::Track).to have_received(:new).with(user.id, tile_count)
|
||||
expect(track_service).to have_received(:call)
|
||||
expect(response).to have_http_status(:ok)
|
||||
end
|
||||
|
||||
@@ -20,7 +20,7 @@ RSpec.describe Points::GeojsonSerializer do
|
||||
type: 'Feature',
|
||||
geometry: {
|
||||
type: 'Point',
|
||||
coordinates: [point.lon.to_s, point.lat.to_s]
|
||||
coordinates: [point.lon, point.lat]
|
||||
},
|
||||
properties: PointSerializer.new(point).call
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
require 'rails_helper'
|
||||
require 'prometheus_exporter/client'
|
||||
|
||||
RSpec.describe Maps::TileUsage::Track do
|
||||
RSpec.describe Metrics::Maps::TileUsage::Track do
|
||||
describe '#call' do
|
||||
subject(:track) { described_class.new(user_id, tile_count).call }
|
||||
|
||||
@@ -18,7 +18,7 @@ RSpec.describe Users::SafeSettings do
|
||||
time_threshold_minutes: 30,
|
||||
merge_threshold_minutes: 15,
|
||||
live_map_enabled: true,
|
||||
route_opacity: 0.6,
|
||||
route_opacity: 60,
|
||||
immich_url: nil,
|
||||
immich_api_key: nil,
|
||||
photoprism_url: nil,
|
||||
@@ -42,7 +42,7 @@ RSpec.describe Users::SafeSettings do
|
||||
'time_threshold_minutes' => 45,
|
||||
'merge_threshold_minutes' => 20,
|
||||
'live_map_enabled' => false,
|
||||
'route_opacity' => 0.8,
|
||||
'route_opacity' => 80,
|
||||
'immich_url' => 'https://immich.example.com',
|
||||
'immich_api_key' => 'immich-key',
|
||||
'photoprism_url' => 'https://photoprism.example.com',
|
||||
@@ -64,7 +64,7 @@ RSpec.describe Users::SafeSettings do
|
||||
"time_threshold_minutes" => 45,
|
||||
"merge_threshold_minutes" => 20,
|
||||
"live_map_enabled" => false,
|
||||
"route_opacity" => 0.8,
|
||||
"route_opacity" => 80,
|
||||
"immich_url" => "https://immich.example.com",
|
||||
"immich_api_key" => "immich-key",
|
||||
"photoprism_url" => "https://photoprism.example.com",
|
||||
@@ -92,7 +92,7 @@ RSpec.describe Users::SafeSettings do
|
||||
expect(safe_settings.time_threshold_minutes).to eq(30)
|
||||
expect(safe_settings.merge_threshold_minutes).to eq(15)
|
||||
expect(safe_settings.live_map_enabled).to be true
|
||||
expect(safe_settings.route_opacity).to eq(0.6)
|
||||
expect(safe_settings.route_opacity).to eq(60)
|
||||
expect(safe_settings.immich_url).to be_nil
|
||||
expect(safe_settings.immich_api_key).to be_nil
|
||||
expect(safe_settings.photoprism_url).to be_nil
|
||||
@@ -113,7 +113,7 @@ RSpec.describe Users::SafeSettings do
|
||||
'time_threshold_minutes' => 45,
|
||||
'merge_threshold_minutes' => 20,
|
||||
'live_map_enabled' => false,
|
||||
'route_opacity' => 0.8,
|
||||
'route_opacity' => 80,
|
||||
'immich_url' => 'https://immich.example.com',
|
||||
'immich_api_key' => 'immich-key',
|
||||
'photoprism_url' => 'https://photoprism.example.com',
|
||||
@@ -132,7 +132,7 @@ RSpec.describe Users::SafeSettings do
|
||||
expect(safe_settings.time_threshold_minutes).to eq(45)
|
||||
expect(safe_settings.merge_threshold_minutes).to eq(20)
|
||||
expect(safe_settings.live_map_enabled).to be false
|
||||
expect(safe_settings.route_opacity).to eq(0.8)
|
||||
expect(safe_settings.route_opacity).to eq(80)
|
||||
expect(safe_settings.immich_url).to eq('https://immich.example.com')
|
||||
expect(safe_settings.immich_api_key).to eq('immich-key')
|
||||
expect(safe_settings.photoprism_url).to eq('https://photoprism.example.com')
|
||||
|
||||
Reference in New Issue
Block a user