Skip to content

Commit ded1cc0

Browse files
committed
* Fix icon image loading issue, and let the user know when the session key is wrong. Closes #91
1 parent d74b224 commit ded1cc0

File tree

4 files changed

+47
-13
lines changed

4 files changed

+47
-13
lines changed

main.js

Lines changed: 8 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

player.js

Lines changed: 18 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.ls

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,10 @@
200200
| \my.ecell
201201
DB.hset "ecell-#room", user, ecell
202202
| \execute
203-
return if auth is \0 or KEY and hmac(room) isnt auth
203+
return if auth is \0
204+
if KEY and hmac(room) isnt auth
205+
reply { type: \error, message: "Invalid session key. Modifications will not be saved." }
206+
return
204207
<~ DB.multi!
205208
.rpush "log-#room" cmdstr
206209
.rpush "audit-#room" cmdstr

src/player.ls

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@
2222
else if // /node/\d+ //.test window.location.href
2323
SocialCalc._room = window.location.href.match // /node/(\d+) // .1
2424
else if SocialCalc._room
25-
try window.history.pushState {} '' "./#{ SocialCalc._room }#{
26-
switch
27-
| SocialCalc._view => '/view'
28-
| SocialCalc._auth => '/edit'
29-
| otherwise => ''
30-
}" unless SocialCalc.CurrentSpreadsheetControlObject
25+
unless SocialCalc.CurrentSpreadsheetControlObject
26+
<- setTimeout _, 100ms
27+
window.history.pushState {} '' "./#{ SocialCalc._room }#{
28+
switch
29+
| SocialCalc._view => '/view'
30+
| SocialCalc._auth => '/edit'
31+
| otherwise => ''
32+
}"
3133
else
3234
window.location = './_start'
3335
return
@@ -152,6 +154,15 @@ Check the activity stream to see the newly edited page!
152154
window.onunload = null
153155
window.onbeforeunload = null
154156
window.location = '/'
157+
| \error
158+
vex.closeAll!
159+
vex.defaultOptions.className = 'vex-theme-flat-attack'
160+
vex.dialog.open do
161+
message: @data.message
162+
buttons: [
163+
$.extend {}, vex.dialog.buttons.YES, text: 'Return to ready-only mode', click: ->
164+
location.href = "../#{ SocialCalc._room }"
165+
]
155166

156167
window.doresize = !-> window.spreadsheet?DoOnResize!
157168
onReady = ->

0 commit comments

Comments
 (0)