quasar-ui-danx 0.3.28 → 0.3.30

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,51 +3,64 @@ import { useCompatibility } from "./compatibility";
3
3
  import { FlashMessages } from "./FlashMessages";
4
4
 
5
5
  export async function resolveFileLocation(file, waitMessage = null) {
6
- if (file.location) {
7
- return file.location;
8
- }
6
+ if (file.location) {
7
+ return file.location;
8
+ }
9
9
 
10
- try {
11
- const tags = await ExifReader.load(file.blobUrl || file.url, {
12
- expanded: true
13
- });
14
- if (tags.gps) {
15
- return {
16
- latitude: tags.gps.Latitude,
17
- longitude: tags.gps.Longitude
18
- };
19
- }
10
+ try {
11
+ const tags = await ExifReader.load(file.blobUrl || file.url, {
12
+ expanded: true
13
+ });
14
+ if (tags.gps) {
15
+ return {
16
+ latitude: tags.gps.Latitude,
17
+ longitude: tags.gps.Longitude
18
+ };
19
+ }
20
+ } catch (error) {
21
+ console.error("Failed to load EXIF data from file:", error);
22
+ }
20
23
 
21
- const { waitForLocation, location } = useCompatibility();
24
+ try {
25
+ const { waitForLocation, location } = useCompatibility();
22
26
 
23
- // Show a waiting for location message if we have not returned within 1 second
24
- if (waitMessage) {
25
- setTimeout(() => {
26
- if (!location.value && waitMessage) {
27
- FlashMessages.warning(waitMessage);
28
- }
29
- }, 1000);
30
- }
27
+ // Show a waiting for location message if we have not returned within 1 second
28
+ if (waitMessage) {
29
+ setTimeout(() => {
30
+ if (!location.value && waitMessage) {
31
+ FlashMessages.warning(waitMessage);
32
+ }
33
+ }, 1000);
34
+ }
31
35
 
32
- // Wait for the browser to return the location (https only as http will not return a location)
33
- if (window.location.protocol === "https:") {
34
- await waitForLocation();
35
- }
36
- // Ignore the wait message if we already returned
37
- waitMessage = false;
38
- if (!location.value) {
39
- return null;
40
- }
36
+ // Wait for the browser to return the location (https only as http will not return a location)
37
+ if (window.location.protocol === "https:") {
38
+ await waitForLocation();
39
+ } else if (window.location.href.match("localhost")) {
40
+ // XXX: Special case for local development so we can test without https
41
+ return {
42
+ latitude: 37.7749,
43
+ longitude: -122.4194,
44
+ accuracy: 1,
45
+ altitude: 0,
46
+ altitudeAccuracy: 0
47
+ };
48
+ }
49
+ // Ignore the wait message if we already returned
50
+ waitMessage = false;
51
+ if (!location.value) {
52
+ return null;
53
+ }
41
54
 
42
- return {
43
- latitude: location.value.latitude,
44
- longitude: location.value.longitude,
45
- accuracy: location.value.accuracy,
46
- altitude: location.value.altitude,
47
- altitudeAccuracy: location.value.altitudeAccuracy
48
- };
49
- } catch (error) {
50
- console.error(error);
51
- return null;
52
- }
55
+ return {
56
+ latitude: location.value.latitude,
57
+ longitude: location.value.longitude,
58
+ accuracy: location.value.accuracy,
59
+ altitude: location.value.altitude,
60
+ altitudeAccuracy: location.value.altitudeAccuracy
61
+ };
62
+ } catch (error) {
63
+ console.error(error);
64
+ return null;
65
+ }
53
66
  }