Skip to content

Commit 5a43409

Browse files
committed
RU-T42 PR#214 fixes
1 parent 2492612 commit 5a43409

File tree

4 files changed

+21
-9
lines changed

4 files changed

+21
-9
lines changed

electron/main.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,9 @@ app.whenReady().then(() => {
184184

185185
protocol.handle('app', (request) => {
186186
const url = new URL(request.url);
187-
// Decode the pathname and resolve to a file in dist/
188-
const resolvedPath = path.resolve(distPath, decodeURIComponent(url.pathname));
187+
// Decode the pathname, join with base path, then canonicalize to prevent directory traversal
188+
const joinedPath = path.join(distPath, decodeURIComponent(url.pathname));
189+
const resolvedPath = path.resolve(joinedPath);
189190

190191
// Security check: ensure resolved path is within distPath to prevent directory traversal
191192
let filePath;

src/app/(app)/index.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ function MapContent() {
218218
// which creates continuous requestAnimationFrame overhead. Web uses CSS animation instead.
219219
useEffect(() => {
220220
if (Platform.OS !== 'web') {
221-
Animated.loop(
221+
const loopAnim = Animated.loop(
222222
Animated.sequence([
223223
Animated.timing(pulseAnim, {
224224
toValue: 1.2,
@@ -231,7 +231,12 @@ function MapContent() {
231231
useNativeDriver: true,
232232
}),
233233
])
234-
).start();
234+
);
235+
loopAnim.start();
236+
237+
return () => {
238+
loopAnim.stop();
239+
};
235240
}
236241
}, [pulseAnim]);
237242

src/components/settings/bluetooth-device-selection-bottom-sheet.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@ export function BluetoothDeviceSelectionBottomSheet({ isOpen, onClose }: Bluetoo
277277
<HStack className="items-center">
278278
<BluetoothIcon size={16} className="mr-2 text-primary-600" />
279279
<VStack>
280-
<Text className={`font-medium ${preferredDevice?.id === 'system-audio' ? 'text-primary-700 dark:text-primary-300' : 'text-neutral-900 dark:text-neutral-100'}`}>System Audio</Text>
281-
<Text className="text-xs text-neutral-500">AirPods, Car, Wired Headset</Text>
280+
<Text className={`font-medium ${preferredDevice?.id === 'system-audio' ? 'text-primary-700 dark:text-primary-300' : 'text-neutral-900 dark:text-neutral-100'}`}>{t('bluetooth.systemAudio')}</Text>
281+
<Text className="text-xs text-neutral-500">{t('bluetooth.systemAudioDescription')}</Text>
282282
</VStack>
283283
</HStack>
284284
{preferredDevice?.id === 'system-audio' && (

src/services/location.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
import * as Location from 'expo-location';
22
import * as TaskManager from 'expo-task-manager';
3-
import { AppState, type AppStateStatus, Platform } from 'react-native';
3+
import { AppState, type AppStateStatus } from 'react-native';
44

55
import { setUnitLocation } from '@/api/units/unitLocation';
66
import { registerLocationServiceUpdater } from '@/lib/hooks/use-background-geolocation';
77
import { logger } from '@/lib/logging';
8+
import { isWeb } from '@/lib/platform';
89
import { loadBackgroundGeolocationState } from '@/lib/storage/background-geolocation';
910
import { SaveUnitLocationInput } from '@/models/v4/unitLocation/saveUnitLocationInput';
1011
import { useCoreStore } from '@/stores/app/core-store';
1112
import { useLocationStore } from '@/stores/app/location-store';
1213

13-
const isWeb = Platform.OS === 'web';
1414
const LOCATION_TASK_NAME = 'location-updates';
1515

1616
// Helper function to send location to API
@@ -155,7 +155,12 @@ class LocationService {
155155
async startLocationUpdates(): Promise<void> {
156156
// On web, use a lightweight browser geolocation watcher instead of expo-location/TaskManager
157157
if (isWeb) {
158-
if (!this.locationSubscription && 'geolocation' in navigator) {
158+
if (!('geolocation' in navigator)) {
159+
logger.warn({ message: 'Geolocation API not available in this browser' });
160+
return;
161+
}
162+
163+
if (!this.locationSubscription) {
159164
const watchId = navigator.geolocation.watchPosition(
160165
(pos) => {
161166
const loc: Location.LocationObject = {
@@ -180,6 +185,7 @@ class LocationService {
180185
);
181186
// Store a compatible subscription object
182187
this.locationSubscription = { remove: () => navigator.geolocation.clearWatch(watchId) } as unknown as Location.LocationSubscription;
188+
logger.info({ message: 'Foreground location updates started' });
183189
}
184190
return;
185191
}

0 commit comments

Comments
 (0)