forked from TejasAnimate/Wrapper-Offline-Beta
-
Notifications
You must be signed in to change notification settings - Fork 0
/
start_wrapper.bat
1017 lines (936 loc) · 34.6 KB
/
start_wrapper.bat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
:: Wrapper: Offline Launcher
:: Author: benson#0411
:: License: MIT
::::::::::::::::::::
:: Initialization ::
::::::::::::::::::::
:: Stop commands from spamming stuff, cleans up the screen
@echo off && cls
:: Lets variables work or something idk im not a nerd
SETLOCAL ENABLEDELAYEDEXPANSION
:: Load metadata
if not exist utilities\metadata.bat ( set NOMETA=y & goto metamissing )
set SUBSCRIPT=y
call utilities\metadata.bat
goto metaavailable
:metamissing
if %NOMETA%==y (
title Wrapper: Offline [Metadata Missing]
echo The metadata's missing for some reason?
echo Restoring...
goto metacopy
)
:returnfrommetacopy
if not exist utilities\metadata.bat ( echo Something is horribly wrong. You may be in a read-only system/admin folder. & pause & exit )
if %NOMETA%==n ( set SUBSCRIPT=y & call utilities\metadata.bat )
:rebootasadmin
if %ADMIN%==n (
:: echo Set UAC = CreateObject^("Shell.Application"^)>> %tmp%\requestAdmin.vbs
:: set params= %*
:: echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1>> %tmp%\requestAdmin.vbs
:: start "" %tmp%\requestAdmin.vbs
exit
)
:metaavailable
:: Set title
title Wrapper: Offline v!WRAPPER_VER! [Initializing...]
:: Make sure we're starting in the correct folder, and that it worked (otherwise things would go horribly wrong)
pushd "%~dp0"
if !errorlevel! NEQ 0 goto error_location
if not exist utilities ( goto error_location )
if not exist wrapper ( goto error_location )
if not exist server ( goto error_location )
goto noerror_location
:error_location
echo Doesn't seem like this script is in a Wrapper: Offline folder.
pause && exit
:noerror_location
:: patch detection
if exist "patch.jpg" goto patched
:: Prevents CTRL+C cancelling (please close with 0) and keeps window open when crashing
if "%~1" equ "point_insertion" goto point_insertion
start "" /wait /B "%~F0" point_insertion
exit
:point_insertion
:: Check *again* because it seems like sometimes it doesn't go into dp0 the first time???
pushd "%~dp0"
if !errorlevel! NEQ 0 goto error_location
if not exist utilities ( goto error_location )
if not exist wrapper ( goto error_location )
if not exist server ( goto error_location )
:: Create checks folder if nonexistent
if not exist "utilities\checks" md utilities\checks
:: Welcome, Director Ford!
echo Wrapper: Offline
echo A project from VisualPlugin adapted by GoTest334 and the Wrapper: Offline team
echo Version !WRAPPER_VER!
echo:
:: Confirm measurements to proceed.
set SUBSCRIPT=y
echo Loading settings...
if not exist utilities\config.bat ( goto configmissing )
call utilities\config.bat
echo:
if !VERBOSEWRAPPER!==y ( echo Verbose mode activated. && echo:)
goto configavailable
:: Restore config
:configmissing
echo Settings are missing for some reason?
echo Restoring...
goto configcopy
:returnfromconfigcopy
if not exist utilities\config.bat ( echo Something is horribly wrong. You may be in a read-only system/admin folder. & pause & exit )
call utilities\config.bat
:configavailable
::::::::::::::::::::::
:: Dependency Check ::
::::::::::::::::::::::
if !SKIPCHECKDEPENDS!==y (
echo Checking dependencies has been skipped.
echo:
goto skip_dependency_install
)
if !VERBOSEWRAPPER!==n (
echo Checking for dependencies...
echo:
)
title Wrapper: Offline v!WRAPPER_VER! [Checking dependencies...]
:: Preload variables
set NEEDTHEDEPENDERS=n
set ADMINREQUIRED=n
set FLASH_DETECTED=n
set FLASH_CHROMIUM_DETECTED=n
set NODEJS_DETECTED=n
set HTTPSERVER_DETECTED=n
set HTTPSCERT_DETECTED=n
if !INCLUDEDCHROMIUM!==y set BROWSER_TYPE=chrome
:: Flash Player
if !VERBOSEWRAPPER!==y ( echo Checking for Flash installation... )
if exist "!windir!\SysWOW64\Macromed\Flash\*pepper.exe" set FLASH_CHROMIUM_DETECTED=y
if exist "!windir!\System32\Macromed\Flash\*pepper.exe" set FLASH_CHROMIUM_DETECTED=y
if !FLASH_CHROMIUM_DETECTED!==n (
echo Flash for Chrome could not be found.
echo:
set NEEDTHEDEPENDERS=y
set ADMINREQUIRED=y
goto flash_checked
) else (
echo Flash is installed.
echo:
set FLASH_DETECTED=y
goto flash_checked
)
:flash_checked
:: Node.js
if !VERBOSEWRAPPER!==y ( echo Checking for Node.js installation... )
for /f "delims=" %%i in ('npm -v 2^>nul') do set output=%%i
IF "!output!" EQU "" (
echo Node.js could not be found.
echo:
set NEEDTHEDEPENDERS=y
set ADMINREQUIRED=y
goto httpserver_checked
) else (
echo Node.js is installed.
echo:
set NODEJS_DETECTED=y
)
:nodejs_checked
:: http-server
if !VERBOSEWRAPPER!==y ( echo Checking for http-server installation... )
npm list -g | findstr "http-server" >nul
if !errorlevel! == 0 (
echo http-server is installed.
echo:
set HTTPSERVER_DETECTED=y
) else (
echo http-server could not be found.
echo:
set NEEDTHEDEPENDERS=y
)
:httpserver_checked
:: HTTPS cert
if !VERBOSEWRAPPER!==y ( echo Checking for HTTPS certificate... )
call certutil -store -enterprise root | findstr "WOCRTV3" >nul
if !errorlevel! == 0 (
echo HTTPS cert installed.
echo:
set HTTPSCERT_DETECTED=y
) else (
:: backup check in case non-admin method used
if exist "utilities\checks\httpscert.txt" (
echo HTTPS cert probably installed.
echo:
set HTTPSCERT_DETECTED=y
) else (
echo HTTPS cert could not be found.
echo:
set NEEDTHEDEPENDERS=y
)
)
popd
:: Assumes nothing is installed during a dry run
if !DRYRUN!==y (
echo Let's just ignore anything we just saw above.
echo Nothing was found. Nothing exists. It's all fake.
set NEEDTHEDEPENDERS=y
set ADMINREQUIRED=y
set FLASH_DETECTED=n
set FLASH_CHROMIUM_DETECTED=n
set FLASH_FIREFOX_DETECTED=n
set NODEJS_DETECTED=n
set HTTPSERVER_DETECTED=n
set HTTPSCERT_DETECTED=n
set BROWSER_TYPE=n
)
::::::::::::::::::::::::
:: Dependency Install ::
::::::::::::::::::::::::
if !NEEDTHEDEPENDERS!==y (
if !SKIPDEPENDINSTALL!==n (
echo:
echo Installing missing dependencies...
echo:
) else (
echo Skipping dependency install.
goto skip_dependency_install
)
) else (
echo All dependencies are available.
echo Turning off checking dependencies...
echo:
:: Initialize vars
set CFG=utilities\config.bat
set TMPCFG=utilities\tempconfig.bat
:: Loop through every line until one to edit
if exist !tmpcfg! del !tmpcfg!
set /a count=1
for /f "tokens=1,* delims=0123456789" %%a in ('find /n /v "" ^< !cfg!') do (
set "line=%%b"
>>!tmpcfg! echo(!line:~1!
set /a count+=1
if !count! GEQ 7 goto linereached
)
:linereached
:: Overwrite the original setting
echo set SKIPCHECKDEPENDS=y>> !tmpcfg!
echo:>> !tmpcfg!
:: Print the last of the config to our temp file
more +8 !cfg!>> !tmpcfg!
:: Make our temp file the normal file
copy /y !tmpcfg! !cfg! >nul
del !tmpcfg!
:: Set in this script
set SKIPCHECKDEPENDS=y
goto skip_dependency_install
)
title Wrapper: Offline v!WRAPPER_VER! [Installing dependencies...]
:: Preload variables
set INSTALL_FLAGS=ALLUSERS=1 /norestart
set SAFE_MODE=n
if /i "!SAFEBOOT_OPTION!"=="MINIMAL" set SAFE_MODE=y
if /i "!SAFEBOOT_OPTION!"=="NETWORK" set SAFE_MODE=y
set CPU_ARCHITECTURE=what
if /i "!processor_architecture!"=="x86" set CPU_ARCHITECTURE=32
if /i "!processor_architecture!"=="AMD64" set CPU_ARCHITECTURE=64
if /i "!PROCESSOR_ARCHITEW6432!"=="AMD64" set CPU_ARCHITECTURE=64
:: Check for admin if installing Flash or Node.js
:: Skipped in Safe Mode, just in case anyone is running Wrapper in safe mode... for some reason
:: and also because that was just there in the code i used for this and i was like "eh screw it why remove it"
if !ADMINREQUIRED!==y (
if !VERBOSEWRAPPER!==y ( echo Checking for Administrator rights... && echo:)
if /i not "!SAFE_MODE!"=="y" (
fsutil dirty query !systemdrive! >NUL 2>&1
if /i not !ERRORLEVEL!==0 (
color cf
if !VERBOSEWRAPPER!==n ( cls )
echo:
echo ERROR
echo:
if !FLASH_DETECTED!==n (
if !NODEJS_DETECTED!==n (
echo Wrapper: Offline needs to install Flash and Node.js.
) else (
echo Wrapper: Offline needs to install Flash.
)
) else (
echo Wrapper: Offline needs to install Node.js.
)
echo To do this, it must be started with Admin rights.
echo:
echo Close this window and re-open Wrapper: Offline as an Admin.
echo ^(right-click start_wrapper.bat and click "Run as Administrator"^)
echo:
if !DRYRUN!==y (
echo ...yep, dry run is going great so far, let's skip the exit
pause
goto postadmincheck
)
pause
set ADMIN=n
goto rebootasadmin
)
)
if !VERBOSEWRAPPER!==y ( echo Admin rights detected. && echo:)
)
:postadmincheck
if exist "%tmp%\requestAdmin.vbs" ( del "%tmp%\requestAdmin.vbs">nul )
:: Flash Player
if !FLASH_DETECTED!==n (
:start_flash_install
echo Installing Flash Player...
set BROWSER_TYPE=chrome && if !VERBOSEWRAPPER!==y ( echo Chromium-based browser picked. && echo:) && goto escape_browser_ask
:escape_browser_ask
echo To install Flash Player, Wrapper: Offline must kill any currently running web browsers.
echo Please make sure any work in your browser is saved before proceeding.
echo Wrapper: Offline will not continue installation until you press a key.
echo:
pause
echo:
:: Summon the Browser Slayer
if !DRYRUN!==y (
echo The users brought down the batch script upon the Browser Slayer, and in his defeat entombed him in the unactivated code.
goto lurebrowserslayer
)
echo Rip and tear, until it is done.
for %%i in (firefox,palemoon,tor,iexplore,maxthon,microsoftedge,chrome,chrome64,chromium,opera,brave,torch,waterfox,basilisk,Basilisk-Portable) do (
if !VERBOSEWRAPPER!==y (
taskkill /f /im %%i.exe /t >nul
wmic process where name="%%i.exe" call terminate
) else (
taskkill /f /im %%i.exe /t >nul
wmic process where name="%%i.exe" call terminate >nul
)
)
:lurebrowserslayer
echo:
echo Starting the Flash Player installer...
echo:
if not exist "utilities\installers\flash_windows_chromium.msi" (
echo ...erm. Bit of an issue there actually. The installer doesn't exist.
echo A normal copy of Wrapper: Offline should come with one.
echo You may be able to get the installer here:
echo:
echo Although Flash is needed, Offline will continue launching.
pause
goto after_flash_install
)
if !DRYRUN!==n ( msiexec /i "utilities\installers\flash_windows_chromium.msi" !INSTALL_FLAGS! /quiet )
echo Flash has been installed.
echo:
)
:after_flash_install
:: Node.js
if !NODEJS_DETECTED!==n (
echo Installing Node.js...
echo:
:: Install Node.js
if !CPU_ARCHITECTURE!==64 (
if !VERBOSEWRAPPER!==y ( echo 64-bit system detected, installing 64-bit Node.js. )
if not exist "utilities\installers\node_windows_x64.msi" (
echo We have a problem. The 64-bit Node.js installer doesn't exist.
echo A normal copy of Wrapper: Offline should come with one.
echo You should be able to find a copy on this website:
echo https://nodejs.org/en/download/
echo Although Node.js is needed, Offline will try to install anything else it can.
pause
goto after_nodejs_install
)
echo Proper Node.js installation doesn't seem possible to do automatically.
echo You can just keep clicking next until it finishes, and Wrapper: Offline will continue once it closes.
if !DRYRUN!==n ( msiexec /i "utilities\installers\node_windows_x64.msi" !INSTALL_FLAGS! )
goto nodejs_installed
)
if !CPU_ARCHITECTURE!==32 (
if !VERBOSEWRAPPER!==y ( echo 32-bit system detected, installing 32-bit Node.js. )
if not exist "utilities\installers\node_windows_x32.msi" (
echo We have a problem. The 32-bit Node.js installer doesn't exist.
echo A normal copy of Wrapper: Offline should come with one.
echo You should be able to find a copy on this website:
echo https://nodejs.org/en/download/
echo Although Node.js is needed, Offline will try to install anything else it can.
pause
goto after_nodejs_install
)
echo Proper Node.js installation doesn't seem possible to do automatically.
echo You can just keep clicking next until it finishes, and Wrapper: Offline will continue once it closes.
if !DRYRUN!==n ( msiexec /i "utilities\installers\node_windows_x32.msi" !INSTALL_FLAGS! )
goto nodejs_installed
)
if !CPU_ARCHITECTURE!==what (
echo:
echo Well, this is a little embarassing.
echo:
echo Wrapper: Offline can't tell if you're on a 32-bit or 64-bit system.
echo Which means it doesn't know which version of Node.js to install...
echo:
echo If you have no idea what that means, press 1 to just try anyway.
echo:
echo If you know what kind of architecture you're running, but Offline
echo didn't detect it, press 2.
echo:
echo If you're in the future with newer architectures or something
echo and you know what you're doing, then press 3 to keep going.
echo:
:architecture_ask
set /p CPUCHOICE= Response:
echo:
if "!cpuchoice!"=="1" if !DRYRUN!==n ( msiexec /i "utilities\installers\node_windows_x32.msi" !INSTALL_FLAGS! ) && if !VERBOSEWRAPPER!==y ( echo Attempting 32-bit Node.js installation. ) && goto nodejs_installed
if "!cpuchoice!"=="2" (
echo:
echo Press 1 if you're running Wrapper: Offline on a 32-bit system.
echo Press 2 if you're running Wrapper: Offline on a 64-bit system.
echo:
:whatsystemreask
set /p WHATSYSTEM= Response:
echo:
if "!whatsystem!"=="1" set CPU_ARCHITECTURE=32
if "!whatsystem!"=="2" set CPU_ARCHITECTURE=64
if "!whatsystem!"=="32" echo Why couldn't you just type 1? & echo: & pause & set CPU_ARCHITECTURE=32
if "!whatsystem!"=="64" echo Why couldn't you just type 2? & echo: & pause & set CPU_ARCHITECTURE=64
if "!whatsystem!"=="" echo That's an invalid option. Please try again. && goto whatsystemreask
)
if "!cpuchoice!"=="3" echo Node.js will not be installed. && goto after_nodejs_install
echo You must pick one or the other.&& goto architecture_ask
)
:nodejs_installed
echo Node.js has been installed.
set NODEJS_DETECTED=y
echo:
goto install_cert
)
:after_nodejs_install
:: http-server
if !HTTPSERVER_DETECTED!==n (
if !NODEJS_DETECTED!==y (
echo Installing http-server...
echo:
:: Skip in dry run, not much use to run it
if !DRYRUN!==y (
echo ...actually, nah, let's skip this part.
goto httpserverinstalled
)
:: Attempt to install through NPM normally
call npm install http-server -g
:: Double check for installation
echo Checking for http-server installation again...
call npm list -g | find "http-server" > nul
if !errorlevel! == 0 (
goto httpserverinstalled
) else (
echo:
echo Online installation attempt failed. Trying again from local files...
echo:
if not exist "utilities\installers\http-server-master" (
echo Well, we'd try that if the files existed.
echo A normal copy of Wrapper: Offline should come with them.
echo You should be able to find a copy on this website:
echo https://www.npmjs.com/package/http-server
echo Although http-server is needed, Offline will try to install anything else it can.
pause
goto after_nodejs_install
)
call npm install utilities\installers\http-server-master -g
goto triplecheckhttpserver
)
:: Triple check for installation
echo Checking for http-server installation AGAIN...
:triplecheckhttpserver
npm list -g | find "http-server" > nul
if !errorlevel! == 0 (
goto httpserverinstalled
) else (
echo:
echo Local file installation failed. Something's not right.
echo Unless this was intentional, ask for support or install http-server manually.
echo Enter "npm install http-server -g" into a separate Command Prompt window.
echo:
pause
exit
)
) else (
color cf
echo:
echo http-server is missing, but somehow Node.js has not been installed yet.
echo Seems either the install failed, or Wrapper: Offline managed to skip it.
echo If installing directly from nodejs.org does not work, something is horribly wrong.
echo Please ask for help in the #support channel on Discord, or email me.
pause
exit
)
:httpserverinstalled
echo http-server has been installed.
echo:
goto install_cert
)
:: Install HTTPS certificate
:install_cert
if !HTTPSCERT_DETECTED!==n (
echo Installing HTTPS certificate...
echo:
if not exist "server\the.crt" (
echo ...except it doesn't exist for some reason.
echo Wrapper: Offline requires this to run.
echo You should get a "the.crt" file from someone else, or redownload Wrapper: Offline.
echo Offline has nothing left to do since it can't launch without the.crt, so it will close.
pause
exit
)
:: Check for admin
if /i not "!SAFE_MODE!"=="y" (
fsutil dirty query !systemdrive! >NUL 2>&1
if /i not !ERRORLEVEL!==0 (
if !VERBOSEWRAPPER!==n ( cls )
echo For Wrapper: Offline to work, it needs an HTTPS certificate to be installed.
echo If you have administrator privileges, you should reopen start_wrapper.bat as Admin.
echo ^(it will do this automatically if you say you have admin rights^)
echo:
echo If you can't do that, there's another method, but it's less reliable and is done per-browser.
echo:
echo Press Y if you have admin access, and press N if you don't.
:certaskretry
set /p CERTCHOICE= Response:
echo:
if not '!certchoice!'=='' set certchoice=%certchoice:~0,1%
if /i "!certchoice!"=="y" echo This window will now close so you can restart it with admin. & set ADMIN=n & goto rebootasadmin
if /i "!certchoice!"=="n" goto certnonadmin
echo You must answer Yes or No. && goto certaskretry
:: Non-admin cert install
pushd utilities
start SilentCMD open_http-server.bat
popd
echo:
echo A web browser window will open.
echo When you see a security notice, go past it.
echo This is completely harmless in a local setting like this.
echo If you see a message like this on the real internet, you should stay away.
:: Pause to allow startup
PING -n 8 127.0.0.1>nul
if !INCLUDEDCHROMIUM!==n (
if !CUSTOMBROWSER!==n (
start https://localhost:4664/certbypass.html
) else (
start !CUSTOMBROWSER! https://localhost:4664/certbypass.html >nul
)
) else (
pushd utilities\ungoogled-chromium
start chromium.exe --user-data-dir=the_profile https://localhost:4664/certbypass.html --allow-outdated-plugins >nul
popd
)
pause
echo:
echo If you intend on using another browser, you'll have to do this again by going to the server page and passing the security message.
echo You've used a non-admin method of installing the HTTPS certificate. To redo the process, delete this file. > utilities\checks\httpscert.txt
goto after_cert_install
)
)
pushd server
if !VERBOSEWRAPPER!==y (
if !DRYRUN!==n ( certutil -addstore -f -enterprise -user root the.crt )
) else (
if !DRYRUN!==n ( certutil -addstore -f -enterprise -user root the.crt >nul )
)
set ADMINREQUIRED=y
popd
)
:after_cert_install
:: Alert user to restart Wrapper without running as Admin
if !ADMINREQUIRED!==y (
color 20
if !VERBOSEWRAPPER!==n ( cls )
echo:
echo Dependencies needing Admin now installed^^!
echo:
echo Wrapper: Offline no longer needs Admin rights,
echo please restart normally by double-clicking.
echo:
echo If you saw this from running normally,
echo Wrapper: Offline should continue normally after a restart.
echo:
if !DRYRUN!==y (
echo ...you enjoying the dry run experience? Skipping closing.
pause
color 0f
goto skip_dependency_install
)
pause
exit
)
color 0f
echo Restarting explorer.exe...
echo:
TASKKILL /F /IM explorer.exe >nul
PING -n 2 127.0.0.1>nul
start explorer.exe
cls
echo All dependencies now installed^^!
echo:
echo It is recommended that you restart the computer
echo to make sure that everything is fully working.
echo:
echo Would you like to restart your system before
echo using Wrapper: Offline? [Y/n]
echo:
set /p RESTARTPC= Response:
if not '!restartpc!'=='' set restartpc=%restartpc:~0,1%
if /i "!restartpc!"=="y" (
echo Press any key to start the rebooting process.
echo:
pause
echo Your PC will reboot in 10 seconds.
PING -n 11 127.0.0.1>nul
echo Rebooting your PC...
call shutdown /r /t 00
exit
)
if /i "!restartpc!"=="n" goto continuing
:continuing
echo Continuing with Wrapper: Offline boot.
echo:
:skip_dependency_install
::::::::::::::::::::::
:: Starting Wrapper ::
::::::::::::::::::::::
title Wrapper: Offline v!WRAPPER_VER! [Loading...]
:: Close existing node apps
:: Hopefully fixes EADDRINUSE errors??
if !VERBOSEWRAPPER!==y (
echo Closing any existing node and/or PHP apps and batch processes...
for %%i in (npm start,npm,http-server,HTTP-SERVER HASN'T STARTED,NODE.JS HASN'T STARTED YET,VFProxy PHP Launcher for Wrapper: Offline) do (
if !DRYRUN!==n ( TASKKILL /FI "WINDOWTITLE eq %%i" >nul 2>&1 )
)
if !DRYRUN!==n ( TASKKILL /IM node.exe /F >nul 2>&1 )
if !DRYRUN!==n ( TASKKILL /IM php.exe /F >nul 2>&1 )
echo:
) else (
if !DRYRUN!==n ( TASKKILL /IM node.exe /F >nul 2>&1 )
if !DRYRUN!==n ( TASKKILL /IM php.exe /F >nul 2>&1 )
)
:: Start Node.js, http-server and PHP webserver for VFProxy
if !CEPSTRAL!==n (
echo Loading Node.js, http-server and PHP webserver ^(for VFProxy only^)...
) else (
echo Loading Node.js and http-server...
)
pushd utilities
if !VERBOSEWRAPPER!==y (
if !DRYRUN!==n ( start /MIN open_http-server.bat )
if !DRYRUN!==n ( start /MIN open_nodejs.bat )
if !DRYRUN!==n ( start /MIN open_vfproxy_php.bat )
) else (
if !DRYRUN!==n ( start SilentCMD open_http-server.bat )
if !DRYRUN!==n ( start SilentCMD open_nodejs.bat )
if !DRYRUN!==n ( start SilentCMD open_vfproxy_php.bat )
)
)
popd
:: Pause to allow startup
:: Prevents the video list opening too fast
PING -n 6 127.0.0.1>nul
echo Opening Wrapper: Offline...
pushd utilities\ungoogled-chromium
set ARGS=--app=http://localhost:!port! --allow-outdated-plugins
if !DRYRUN!==n ( start chromium.exe --user-data-dir=the_profile !ARGS! )
echo Wrapper: Offline has been started^^! The video list should now be open.
::::::::::::::::
:: Post-Start ::
::::::::::::::::
title Wrapper: Offline v!WRAPPER_VER!
if !VERBOSEWRAPPER!==y ( goto wrapperstarted )
:wrapperstartedcls
cls
:wrapperstarted
echo:
echo Wrapper: Offline v!WRAPPER_VER! running
echo A project from VisualPlugin adapted by GoTest334 and the Wrapper: Offline team
echo:
if !VERBOSEWRAPPER!==n ( echo DON'T CLOSE THIS WINDOW^^! Use the quit option ^(0^) when you're done. )
if !VERBOSEWRAPPER!==y ( echo Verbose mode is on, see the extra CMD windows for extra output. )
if !DRYRUN!==y ( echo Don't forget, nothing actually happened, this was a dry run. )
:: Hello, code wanderer. Enjoy seeing all the secret options easily instead of finding them yourself.
if !DEVMODE!==y (
echo:
echo Standard options:
echo --------------------------------------
)
:: Spacing when dev mode is off
if !DEVMODE!==n ( echo: )
echo Enter 1 to reopen the video list
echo Enter 2 to open the settings
echo Enter 3 to import a file
echo Enter clr to clean up the screen
echo Enter 0 to close Wrapper: Offline
set /a _rand=(!RANDOM!*67/32768)+1
if !_rand!==25 echo Enter things you think'll show a secret if you're feeling adventurous
if !DEVMODE!==y (
echo:
echo Developer options:
echo --------------------------------------
echo Type "server" to open the server page.
echo Type "amnesia" to wipe your save.
echo Type "restart" to restart Wrapper: Offline.
echo Type "reload" to reload your settings and metadata.
echo Type "folder" to open the files.
)
echo:
:wrapperidle
popd
echo:
:::::::::::::
:: Choices ::
:::::::::::::
set /p CHOICE=Choice:
if "!choice!"=="0" goto exitwrapperconfirm
set FUCKOFF=n
if "!choice!"=="1" goto reopen_webpage
if "!choice!"=="2" goto settings
if "!choice!"=="3" goto start_importer
if /i "!choice!"=="clr" goto wrapperstartedcls
if /i "!choice!"=="cls" goto wrapperstartedcls
if /i "!choice!"=="clear" goto wrapperstartedcls
:: dev options
if !DEVMODE!==y (
if /i "!choice!"=="server" goto open_server
if /i "!choice!"=="amnesia" goto wipe_save
if /i "!choice!"=="restart" goto restart
if /i "!choice!"=="reload" goto reload_settings
if /i "!choice!"=="folder" goto open_files
)
if !DEVMODE!==n (
if /i "!choice!"=="server" goto open_server
if /i "!choice!"=="amnesia" goto devmodeerror
if /i "!choice!"=="restart" goto devmodeerror
if /i "!choice!"=="reload" goto devmodeerror
if /i "!choice!"=="folder" goto devmodeerror
)
echo Time to choose. && goto wrapperidle
:reopen_webpage
echo Opening Wrapper: Offline...
pushd utilities\ungoogled-chromium
if !DRYRUN!==n ( start chromium.exe --user-data-dir=the_profile !ARGS! )
goto wrapperidle
:start_importer
echo Opening the importer...
start "" "utilities\import.bat"
goto wrapperidle
:open_server
echo Opening the server page...
pushd utilities\ungoogled-chromium
if !DRYRUN!==n ( start chromium.exe --user-data-dir=the_profile https://localhost:4664 --allow-outdated-plugins )
goto wrapperidle
:open_files
pushd
echo Opening the wrapper-offline folder...
start explorer.exe "%CD%"
popd
goto wrapperidle
:settings
echo Launching settings..
call settings.bat
cls
title Wrapper: Offline v!WRAPPER_VER!
goto wrapperstartedcls
:youfuckoff
echo You fuck off.
set FUCKOFF=y
goto wrapperidle
:reload_settings
call utilities\config.bat
call utilities\metadata.bat
goto wrapperstartedcls
:wipe_save
call utilities\reset_install.bat
if !errorlevel! equ 1 goto wrapperidle
goto wrapperidle
:: flows straight to restart below
:restart
TASKKILL /IM node.exe /F >nul 2>&1
if !CEPSTRAL!==n ( TASKKILL /IM php.exe /F >nul 2>&1 )
if !VERBOSEWRAPPER!==y (
for %%i in (npm start,npm,http-server,HTTP-SERVER HASN'T STARTED,NODE.JS HASN'T STARTED YET,VFProxy PHP Launcher for Wrapper: Offline,Server for imported voice clips TTS voice) do (
TASKKILL /FI "WINDOWTITLE eq %%i" >nul 2>&1
)
)
start "" /wait /B "%~F0" point_insertion
exit
:devmodeerror
echo You have to have developer mode on
echo in order to access these features.
echo:
echo Please turn developer mode on in the settings, then try again.
goto wrapperidle
::::::::::::::
:: Shutdown ::
::::::::::::::
:: Confirmation before shutting down
:exitwrapperconfirm
echo:
echo Are you sure you want to quit Wrapper: Offline?
echo Be sure to save all your work.
echo Type Y to quit, and N to go back.
:exitwrapperretry
set /p EXITCHOICE= Response:
echo:
if /i "!exitchoice!"=="y" goto point_extraction
if /i "!exitchoice!"=="yes" goto point_extraction
if /i "!exitchoice!"=="n" goto wrapperstartedcls
if /i "!exitchoice!"=="no" goto wrapperstartedcls
if /i "!exitchoice!"=="with style" goto exitwithstyle
echo You must answer Yes or No. && goto exitwrapperretry
:point_extraction
title Wrapper: Offline v!WRAPPER_VER! [Shutting down...]
:: Shut down Node.js, PHP and http-server
:: Copies config.bat first in case for whatever reason this messes it up (it's happened before trust me)
pushd utilities
copy config.bat tmpcfg.bat>nul
popd
:: Deletes a temporary batch file again just in case
if exist %tmp%\importserver.bat ( del %tmp%\importserver.bat )
if !VERBOSEWRAPPER!==y (
if !DRYRUN!==n (
TASKKILL /IM SilentCMD.exe /F >nul 2>&1
TASKKILL /IM node.exe /F >nul 2>&1
for %%i in (npm start,npm,http-server,HTTP-SERVER HASN'T STARTED,NODE.JS HASN'T STARTED YET,VFProxy PHP Launcher for Wrapper: Offline,Server for imported voice clips TTS voice) do (
TASKKILL /FI "WINDOWTITLE eq %%i" >nul 2>&1 )
)
if !DRYRUN!==n (
if !CEPSTRAL!==n (
TASKKILL /IM php.exe /F >nul 2>&1
)
)
if !DRYRUN!==n (
if !INCLUDEDCHROMIUM!==y (
TASKKILL /IM chromium.exe /F >nul 2>&1
)
if !INCLUDEDBASILISK!==y (
TASKKILL /IM "utilities\basilisk\Basilisk-Portable\Basilisk-Portable.exe" /F >nul 2>&1
)
)
echo:
) else (
if !DRYRUN!==n ( TASKKILL /IM node.exe /F >nul 2>&1 )
if !DRYRUN!==n (
TASKKILL /IM SilentCMD.exe /F >nul 2>&1
if !CEPSTRAL!==n (
TASKKILL /IM php.exe /F >nul 2>&1
)
)
if !DRYRUN!==n (
if !INCLUDEDCHROMIUM!==y (
TASKKILL /IM chromium.exe /F >nul 2>&1
)
if !INCLUDEDBASILISK!==y (
TASKKILL /IM utilities\basilisk\Basilisk-Portable\Basilisk-Portable.exe /F 2>nul
)
)
)
:: Puts config.bat back to normal
pushd utilities
del config.bat
ren tmpcfg.bat config.bat
popd
:: This is where I get off.
echo Wrapper: Offline has been shut down.
if !FUCKOFF!==y ( echo You're a good listener. )
echo This window will now close.
echo Open start_wrapper.bat again to start W:O again.
if !DRYRUN!==y ( echo Go wet your run next time. )
pause & exit
:exitwithstyle
title Wrapper: Offline v!WRAPPER_VER! [Shutting down... WITH STYLE]
echo SHUTTING DOWN THE WRAPPER OFFLINE
PING -n 3 127.0.0.1>nul
color 9b
echo BEWEWEWEWWW PSSHHHH KSHHHHHHHHHHHHHH
PING -n 3 127.0.0.1>nul
for %%i in (npm start,npm,http-server,HTTP-SERVER HASN'T STARTED,NODE.JS HASN'T STARTED YET,VFProxy PHP Launcher for Wrapper: Offline,Server for imported voice clips TTS voice) do (
if !DRYRUN!==n ( TASKKILL /FI "WINDOWTITLE eq %%i" >nul 2>&1 )
)
TASKKILL /IM node.exe /F >nul 2>&1
echo NODE DOT JS ANNIHILATED....I THINK
PING -n 3 127.0.0.1>nul
if !CEPSTRAL!==n (
TASKKILL /IM php.exe /F >nul 2>&1
echo PHP DESTROYED....MAYBE...THE BATCH WINDOW WAS ALREADY DESTROYED
PING -n 3 127.0.0.1>nul
)
if !INCLUDEDCHROMIUM!==y (
TASKKILL /IM chromium.exe /F >nul 2>&1
echo UNGOOGLED CHROMIUM COMPLETELY OBLITERATED
PING -n 3 127.0.0.1>nul
)
if !INCLUDEDBASILISK!==y (
TASKKILL /IM %CD%\utilities\basilisk\Basilisk-Portable\Basilisk-Portable.exe /F >nul 2>&1
echo BASILISK COMPLETELY OBLITERATED
PING -n 3 127.0.0.1>nul
)
echo TIME TO ELIMINATE WRAPPER OFFLINE
PING -n 3 127.0.0.1>nul
echo BOBOOBOBMWBOMBOM SOUND EFFECTSSSSS
PING -n 3 127.0.0.1>nul
echo WRAPPER OFFLINE ALSO ANNIHILA
PING -n 2 127.0.0.1>nul
exit
:patched
title candypaper nointernet PATCHED edition
color 43
echo OH MY GODDDDD
PING -n 3 127.0.0.1>nul
echo SWEETSSHEET LACKOFINTERNS PATCHED DETECTED^^!^^!^^!^^!^^!^^!^^!^^!^^!^^!^^!^^!
PING -n 3 127.0.0.1>nul
echo can never be use again...
PING -n 4 127.0.0.1>nul
echo whoever put patch.jpeg back, you are grounded grounded gorrudjnmed for 6000
PING -n 3 127.0.0.1>nul
:grr
echo g r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r r
PING -n 0.55 127.0.0.1>nul
goto grr
:configcopy
if not exist utilities ( md utilities )
echo :: Wrapper: Offline Config>> utilities\config.bat
echo :: This file is modified by settings.bat. It is not organized, but comments for each setting have been added.>> utilities\config.bat
echo :: You should be using settings.bat, and not touching this. Offline relies on this file remaining consistent, and it's easy to mess that up.>> utilities\config.bat
echo:>> utilities\config.bat
echo :: Opens this file in Notepad when run>> utilities\config.bat
echo setlocal>> utilities\config.bat
echo if "%%SUBSCRIPT%%"=="" ( start notepad.exe "%%CD%%\%%~nx0" ^& exit )>> utilities\config.bat
echo endlocal>> utilities\config.bat
echo:>> utilities\config.bat
echo :: Shows exactly Offline is doing, and never clears the screen. Useful for development and troubleshooting. Default: n>> utilities\config.bat
echo set VERBOSEWRAPPER=n>> utilities\config.bat
echo:>> utilities\config.bat
echo :: Won't check for dependencies (flash, node, etc) and goes straight to launching. Useful for speedy launching post-install. Default: n>> utilities\config.bat
echo set SKIPCHECKDEPENDS=n>> utilities\config.bat
echo:>> utilities\config.bat
echo :: Won't install dependencies, regardless of check results. Overridden by SKIPCHECKDEPENDS. Mostly useless, why did I add this again? Default: n>> utilities\config.bat
echo set SKIPDEPENDINSTALL=n>> utilities\config.bat
echo:>> utilities\config.bat
echo :: Runs through all of the scripts code, while never launching or installing anything. Useful for development. Default: n>> utilities\config.bat
echo set DRYRUN=n>> utilities\config.bat
echo:>> utilities\config.bat
echo :: Makes it so both the settings and the Wrapper launcher shows developer options. Default: n>> utilities\config.bat
echo set DEVMODE=n>> utilities\config.bat
echo:>> utilities\config.bat
echo :: Tells settings.bat which port the frontend is hosted on. ^(If changed manually, you MUST also change the value of "SERVER_PORT" to the same value in wrapper\env.json^) Default: 4343>> utilities\config.bat
echo set PORT=4343>> utilities\config.bat
echo:>> utilities\config.bat
echo :: Automatically restarts the NPM whenever it crashes. Default: y>> utilities\config.bat
echo set AUTONODE=y>> utilities\config.bat
echo:>> utilities\config.bat