Kaynağa Gözat

Validate build

customisations
alemart 7 ay önce
ebeveyn
işleme
3cd515b092
1 değiştirilmiş dosya ile 15 ekleme ve 1 silme
  1. 15
    1
      src/core/session.ts

+ 15
- 1
src/core/session.ts Dosyayı Görüntüle

@@ -24,9 +24,10 @@ import Speedy from 'speedy-vision';
24 24
 import { SpeedyMedia } from 'speedy-vision/types/core/speedy-media';
25 25
 import { SpeedyMediaSourceNativeElement } from 'speedy-vision/types/core/speedy-media-source';
26 26
 import { SpeedyPromise } from 'speedy-vision/types/core/speedy-promise';
27
+import { AR } from '../main';
27 28
 import { Nullable, Utils } from '../utils/utils';
28 29
 import { AREvent, AREventTarget } from '../utils/ar-events';
29
-import { IllegalArgumentError, IllegalOperationError, NotSupportedError } from '../utils/errors';
30
+import { IllegalArgumentError, IllegalOperationError, NotSupportedError, AccessDeniedError } from '../utils/errors';
30 31
 import { Viewport } from './viewport';
31 32
 import { Settings } from './settings';
32 33
 import { Stats } from './stats';
@@ -289,6 +290,19 @@ export class Session extends AREventTarget<SessionEventType>
289 290
             if(mode !== 'inline' && Session.count > 0)
290 291
                 throw new IllegalOperationError(`Can't start more than one immersive session`);
291 292
 
293
+            // dev build? work-in-progress
294
+            const isStableBuild = /^\d+\.\d+(\.\d+)*$/.test(AR.version);
295
+            if(!isStableBuild) {
296
+                if(!(['localhost', '127.0.0.1', '[::1]', '', 'encantar.dev', 'alemart.github.io'].includes(location.hostname))) {
297
+                    if(!(location.hostname.startsWith('192.168.') || location.hostname.startsWith('10.') || /^172\.(1[6-9]|2[0-9]|3[01])\./.test(location.hostname))) {
298
+                        const message = 'This is a development build (unstable). Do not use it in production.';
299
+                        Utils.warning(message);
300
+                        if(!confirm(message + '\n\nAre you sure you want to continue?'))
301
+                            throw new AccessDeniedError('Aborted');
302
+                    }
303
+                }
304
+            }
305
+
292 306
             // initialize matrix routines
293 307
             return Speedy.Matrix.ready();
294 308
 

Loading…
İptal
Kaydet