Skip to content

Commit 114f9a6

Browse files
committed
Revise startup logic
1 parent fdc0c0a commit 114f9a6

File tree

2 files changed

+23
-14
lines changed

2 files changed

+23
-14
lines changed

iwsy/resources/ecs/iwsy.txt

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
module FileManModule
5050
module HelpModule
5151
variable Mobile
52+
variable Resources
5253
variable CDN
5354
variable LastSavedState
5455
variable Content
@@ -112,13 +113,16 @@
112113
clear IsHome
113114
go to Start
114115
end
115-
116+
116117
if Domain is `iwannashowyou.com` set IsHome else clear IsHome
117-
if IsHome put Protocol cat Domain into CDN
118+
119+
! Not static, so test if the 'dist' folder exists. If so, use it as the CDN
120+
rest get Item from Protocol cat Domain cat `/rest.php/dist` or go to Start
121+
put Protocol cat Domain into CDN
118122

119-
! If the debug flag is set use admin storage but continue with local CDN
123+
! If the debug flag is set use admin storage but local CDN
120124
get Item from storage as `debug`
121-
if Item is `true` clear IsHome
125+
if Item is `true` set Static
122126

123127
Start:
124128
iwsy init CDN
@@ -440,6 +444,7 @@ Start:
440444
if FileManModule is not running
441445
begin
442446
print `Load FileMan module`
447+
print CDN
443448
rest get Script from CDN cat `/resources/ecs/fileman.txt?v=` cat now
444449
run Script with FileManPanel as FileManModule
445450
end
@@ -464,7 +469,6 @@ Start:
464469
put 0 into N
465470
gosub to SelectSection
466471
clear Running
467-
print `Load IWSY`
468472
iwsy load Player Presentation
469473

470474
create UserPanel in Controls
@@ -509,7 +513,7 @@ Start:
509513
put property `home` of UserRecord into UserHome
510514
put UserHome cat `/` cat property `id` of UserRecord into UserHome
511515
put UserHome into storage as `user.home`
512-
iwsy path `/resources/users/` cat UserHome cat `/scripts/`
516+
! iwsy path Resources cat `/users/` cat UserHome cat `/scripts/`
513517
put property `email` of UserRecord into UserEmail
514518
get UserPassword from storage as `user.password`
515519
set attribute `src` of User to CDN cat `/resources/icon/user-loggedin.png`
@@ -532,7 +536,7 @@ Start:
532536
put property `arg` of Args into Arg
533537
if Arg includes `.json`
534538
begin
535-
rest get Presentation from Protocol cat Domain cat `/reaources/users/` cat Arg cat `?v=` cat now
539+
rest get Presentation from Protocol cat Domain cat `/` cat Resources cat `/users/` cat Arg cat `?v=` cat now
536540
gosub to NotifyModules
537541
iwsy script Presentation
538542
set style `display` of Player to `block`
@@ -808,9 +812,8 @@ DoOpen:
808812
! Fill the browser with content from the server
809813
if Static go to OpenFromStorage
810814
if UserRecord go to OpenFromUser
811-
! if IsHome go to OpenFromStorage
815+
if IsHome go to OpenFromStorage
812816

813-
OpenFromAdmin:
814817
gosub to CheckAdminPassword
815818
if AdminPassword is empty stop
816819
rest get Files from `list/` cat AdminPassword cat `/scripts?v=` cat now
@@ -905,9 +908,8 @@ SelectFile:
905908

906909
if Static go to SelectFromStorage
907910
if UserRecord go to SelectFromUser
908-
! if IsHome go to SelectFromStorage
909-
910-
SelectFromAdmin:
911+
if IsHome go to SelectFromStorage
912+
911913
rest get Presentation from Protocol cat Domain cat `/resources/scripts/` cat File cat `?v=` cat now
912914
go to UseFile
913915

@@ -1002,7 +1004,6 @@ DoRunStop:
10021004
set Message to object
10031005
set property `action` of Message to `running`
10041006
send Message to StepsModule
1005-
iwsy init CDN
10061007
iwsy run then
10071008
begin
10081009
gosub to ClearStepsButtons
@@ -1046,4 +1047,4 @@ ClearStepsButtons:
10461047
set Message to object
10471048
set property `action` of Message to `clear`
10481049
send Message to StepsModule
1049-
return
1050+
return

iwsy/rest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@
3232
switch ($action) {
3333

3434
case 'test':
35+
// To check for a static server (if this is not present an error willl be thrown)
36+
exit;
37+
38+
case 'dist':
39+
// To test if the EasyCoder distribution is present
40+
if (!file_exists('dist')) {
41+
http_response_code(404);
42+
}
3543
exit;
3644

3745
case 'list':

0 commit comments

Comments
 (0)