Skip to content

Commit 2961be8

Browse files
committed
Allow control over CDN mode
1 parent 293353f commit 2961be8

File tree

8 files changed

+187
-174
lines changed

8 files changed

+187
-174
lines changed

iwsy/resources/ecs/blocks.txt

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -39,25 +39,21 @@
3939
variable Args
4040
variable Protocol
4141
variable Domain
42-
variable Resources
43-
variable Properties
42+
variable IsHome
4443
variable CDN
4544

4645
json parse url the location as Args
4746
put property `protocol` of Args into Protocol
4847
put property `domain` of Args into Domain
49-
50-
rest get Properties from Protocol cat Domain cat `/easycoder-properties.json`
51-
if Properties is not empty
52-
begin
53-
put property `resources` of Properties into Resources
54-
end
55-
if Resources is empty
48+
if Domain is `iwannashowyou.com`
5649
begin
57-
put `resources` into Resources
5850
put `https://easycoder.github.io/iwsy/resources` into CDN
51+
set IsHome
52+
end
53+
else
54+
put Protocol cat Domain cat `/resources` into CDN
55+
clear IsHome
5956
end
60-
else put Protocol cat Domain cat `/` cat Resources into CDN
6157

6258
put -1 into SelectedBlock
6359

@@ -297,4 +293,4 @@ SaveSelectedBlock:
297293
set property `action` of Message to `refresh`
298294
set property `source` of Message to `blocks`
299295
send Message to parent
300-
return
296+
return

iwsy/resources/ecs/fileman.txt

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -42,21 +42,19 @@
4242
variable N
4343
variable Even
4444
variable Args
45-
variable Protocol
4645
variable Domain
47-
variable Properties
48-
variable UserPath
49-
variable Resources
50-
variable Message
46+
variable IsHome
47+
variable Item
5148
variable Post
5249

5350
json parse url the location as Args
54-
put property `protocol` of Args into Protocol
5551
put property `domain` of Args into Domain
56-
rest get Properties from Protocol cat Domain cat `/easycoder-properties.json`
57-
put property `path` of Properties into UserPath
58-
put property `resources` of Properties into Resources
59-
if Resources is empty put `resources` into Resources
52+
if Domain is `iwannashowyou.com` set IsHome
53+
else clear IsHome
54+
! If the debug flag is set use admin storage
55+
get Item from storage as `debug`
56+
if Item is `true` clear IsHome
57+
get AdminPassword from storage as `.password`
6058

6159
if portrait
6260
begin
@@ -139,36 +137,25 @@
139137
Show:
140138
set style `display` of Container to `block`
141139

142-
if UserPath
143-
begin
144-
put UserPath cat `/images` into Home
145-
end
146-
else
140+
if IsHome
147141
begin
148142
get UserRecord from storage as `.user`
149143
put property `email` of UserRecord into Email
150144
get Password from storage as `user.password`
151145
put property `home` of UserRecord into Home
152-
put Home cat `/` cat property `id` of UserRecord cat `/images` into Home
153-
put `users/` cat Home into Home
146+
put `users/` cat Home cat `/` cat property `id` of UserRecord into Home
147+
put Home cat `/images` into Home
154148
end
149+
else put `images` into Home
155150
get CurrentPath from storage as `.filepath`
156151
if CurrentPath is empty put Home into CurrentPath
157-
get AdminPassword from storage as `.password`
158152

159153
! Build the list
160154
Browser:
161155
put CurrentPath into storage as `.filepath`
162-
if UserPath
156+
if IsHome
163157
begin
164-
if AdminPassword is empty
165-
begin
166-
set Message to object
167-
set property `Action` of Message to `password`
168-
send Message to parent
169-
stop
170-
end
171-
rest get Content from `list/` cat AdminPassword cat `/` cat CurrentPath cat `?v=` cat now
158+
rest get Content from `ulist/` cat Email cat `/` cat Password cat `/` cat CurrentPath cat `?v=` cat now
172159
or begin
173160
alert `Failed to list files.`
174161
put empty into storage as `.filepath`
@@ -177,7 +164,7 @@ Browser:
177164
end
178165
else
179166
begin
180-
rest get Content from `ulist/` cat Email cat `/` cat Password cat `/` cat CurrentPath cat `?v=` cat now
167+
rest get Content from `list/` cat AdminPassword cat `/` cat CurrentPath cat `?v=` cat now
181168
or begin
182169
alert `Failed to list files.`
183170
put empty into storage as `.filepath`
@@ -243,8 +230,8 @@ Browser:
243230
if FileCount is 0
244231
begin
245232
put Path into CurrentPath
246-
if UserPath put `delete/` cat AdminPassword cat `/` cat CurrentPath into Post
247-
else put `udelete/` cat Email cat `/` cat Password cat `/` cat CurrentPath into Post
233+
if IsHome put `udelete/` cat Email cat `/` cat Password cat `/` cat CurrentPath into Post
234+
else put `delete/` cat AdminPassword cat `/` cat CurrentPath into Post
248235
rest post to Post or
249236
begin
250237
alert `Failed to delete a file.`
@@ -286,8 +273,8 @@ SelectFile:
286273
set the text of URL to `resources/` cat FilePath
287274
on click DeleteButton
288275
begin
289-
if UserPath put `delete/` cat AdminPassword cat `/` cat FilePath into Post
290-
else put `udelete/` cat Email cat `/` cat Password cat `/` cat FilePath into Post
276+
if IsHome put `udelete/` cat Email cat `/` cat Password cat `/` cat FilePath into Post
277+
else put `delete/` cat AdminPassword cat `/` cat FilePath into Post
291278
rest post to Post or
292279
begin
293280
alert `Failed to delete the image.`
@@ -315,13 +302,13 @@ Upload:
315302
else
316303
begin
317304
put CurrentPath into Path
318-
if UserPath put `upload/` cat AdminPassword cat `/` cat Path into Path
319-
else put `uupload/` cat Password cat `/` cat Email cat `/` cat Password cat `/` cat Path into Path
305+
if IsHome put `uupload/` cat Password cat `/` cat Email cat `/` cat Password cat `/` cat Path into Path
306+
else put `upload/` cat AdminPassword cat `/` cat Path into Path
320307
upload UploadFile to Path with UploadProgress and UploadStatus
321308
goto Browser
322309
end
323310
stop
324311

325312
Exit:
326313
set style `display` of Container to `none`
327-
stop
314+
stop

iwsy/resources/ecs/help.txt

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,24 @@
2525
variable Args
2626
variable Protocol
2727
variable Domain
28-
variable Resources
29-
variable Properties
28+
variable IsHome
3029
variable CDN
3130

3231
json parse url the location as Args
3332
put property `protocol` of Args into Protocol
3433
put property `domain` of Args into Domain
35-
36-
rest get Properties from Protocol cat Domain cat `/easycoder-properties.json`
37-
if Properties is not empty
38-
begin
39-
put property `resources` of Properties into Resources
40-
end
41-
if Resources is empty
34+
if Domain is `iwannashowyou.com`
4235
begin
43-
put `resources` into Resources
4436
put `https://easycoder.github.io/iwsy/resources` into CDN
37+
set IsHome
4538
end
46-
else put Protocol cat Domain cat `/` cat Resources into CDN
39+
else
40+
put Protocol cat Domain cat `/resources` into CDN
41+
clear IsHome
42+
end
43+
! If the debug flag is set use admin storage
44+
get Item from storage as `debug`
45+
if Item clear IsHome
4746

4847
if portrait
4948
begin
@@ -207,4 +206,4 @@ ProcessEmbed:
207206

208207
Exit:
209208
set style `display` of Container to `none`
210-
stop
209+
stop

0 commit comments

Comments
 (0)