Skip to content

Commit e7d1311

Browse files
authored
Merge pull request #64 from Interlisp/fgh_museum-mode
Fgh museum mode
2 parents 2561e02 + 063c292 commit e7d1311

File tree

22 files changed

+425
-74
lines changed

22 files changed

+425
-74
lines changed

docker_medley/Dockerfile_medley

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,9 @@ COPY scripts/* ${ONLINE_BINDIR}
114114
RUN chmod ugo+x ${ONLINE_BINDIR}/* \
115115
&& ln -s ${ONLINE_BINDIR}/request_new_tab.sh ${ONLINE_BINDIR}/request_new_tab
116116

117+
# copy online-specific files into medley/library
118+
COPY --chown=${USER_NAME}:${USER_NAME} library/ONLINEUTILS ${MEDLEY_INSTALLDIR}/library
119+
COPY --chown=${USER_NAME}:${USER_NAME} library/ONLINEUTILS.LCOM ${MEDLEY_INSTALLDIR}/library
117120

118121
# copy INIT file into home directory
119122
COPY --chown=${USER_NAME}:${USER_NAME} init/INIT ${MEDLEY_USERDIR}

docker_medley/init/ONLINE-INIT

100755100644
Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
11
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
22

3-
(FILECREATED "18-Mar-2025 22:45:51" {DSK}<home>medley>il>ONLINE-INIT.;1 10668
3+
(FILECREATED "18-Nov-2025 23:19:56" {DSK}<home>frank>il>online>docker_medley>init>ONLINE-INIT.;51 10938
44

5-
:EDIT-BY "guest"
5+
:EDIT-BY "FGH"
66

7-
:PREVIOUS-DATE "17-Mar-2025 17:06:18" {DSK}<home>medley>il>ONLINE-INIT.;1)
7+
:CHANGES-TO (VARS ONLINE-INITCOMS)
8+
9+
:PREVIOUS-DATE "29-Oct-2025 23:56:02"
10+
{DSK}<home>frank>il>online>docker_medley>init>ONLINE-INIT.;50)
811

912

1013
(PRETTYCOMPRINT ONLINE-INITCOMS)
@@ -14,6 +17,8 @@
1417
APPS-INIT)
1518
(FILES (SYSLOAD)
1619
VTCHAT)
20+
(FILES (SYSLOAD)
21+
ONLINEUTILS)
1722
(GLOBALVARS Online.LogoutTimeout Online.SftpPort Online.SftpPassword Online.SftpDisplay
1823
IDLE.PROFILE IDLE.BOUNCING.BOX Online.SftpDisplayMenu ONLINEP ShellBrowser ShellOpener
1924
CLHS.OPENER MEDLEYDIR)
@@ -30,6 +35,9 @@
3035

3136
(FILESLOAD (SYSLOAD)
3237
VTCHAT)
38+
39+
(FILESLOAD (SYSLOAD)
40+
ONLINEUTILS)
3341
(DECLARE%: DOEVAL@COMPILE DONTCOPY
3442

3543
(GLOBALVARS Online.LogoutTimeout Online.SftpPort Online.SftpPassword Online.SftpDisplay IDLE.PROFILE
@@ -149,6 +157,8 @@
149157
(Online.DoInit
150158
[LAMBDA NIL
151159

160+
(* ;; "Edited 29-Oct-2025 23:55 by FGH")
161+
152162
(* ;; "Edited 16-Mar-2025 23:26 by guest")
153163

154164
(* ;; "Edited 25-Feb-2024 11:37 by fgh")
@@ -217,14 +227,15 @@
217227
(RPLACA (CAR CHAT.DISPLAYTYPES)
218228
NIL)
219229

220-
(* ;;
221-
 "Setup NOTECARDSDIRECTORIES. Should be done it APPS-INIT. But until thats done, we'll do it here.")
230+
(* ;; "Create File Import/Export Button")
222231

223-
(Online.SetUpNOTECARDSDIRECTORIES)
232+
(Online.FileButton)
224233

225-
(* ;; "Create File Import/Export Button")
234+
(* ;; "If there is a start-script file, load it ")
226235

227-
(Online.FileButton])
236+
(LET [(START-SCRIPT (UNIX-GETENV 'START_SCRIPT]
237+
(IF START-SCRIPT
238+
THEN (LOAD START-SCRIPT])
228239

229240
(ONLINEP
230241
[LAMBDA NIL (* ; "Edited 24-Feb-2024 22:31 by fgh")
@@ -239,7 +250,7 @@
239250
(BKSYSBUF " ")
240251
)
241252
(DECLARE%: DONTCOPY
242-
(FILEMAP (NIL (1640 10532 (Online.SftpInitInfo 1650 . 2523) (Online.SftpUpdateInfo 2525 . 2780) (
243-
Online.SetUpNOTECARDSDIRECTORIES 2782 . 4490) (Online.FileButton 4492 . 7320) (Online.DoInit 7322 .
244-
10393) (ONLINEP 10395 . 10530)))))
253+
(FILEMAP (NIL (1828 10802 (Online.SftpInitInfo 1838 . 2711) (Online.SftpUpdateInfo 2713 . 2968) (
254+
Online.SetUpNOTECARDSDIRECTORIES 2970 . 4678) (Online.FileButton 4680 . 7508) (Online.DoInit 7510 .
255+
10663) (ONLINEP 10665 . 10800)))))
245256
STOP

docker_medley/init/ONLINE-INIT.LCOM

100755100644
215 Bytes
Binary file not shown.

docker_medley/library/ONLINEUTILS

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
2+
3+
(FILECREATED "18-Nov-2025 22:54:33" {DSK}<home>frank>il>medley>library>ONLINEUTILS.;2 2078
4+
5+
:EDIT-BY "FGH"
6+
7+
:CHANGES-TO (FNS ShellHttpGet)
8+
9+
:PREVIOUS-DATE "18-Nov-2025 22:48:48" {DSK}<home>frank>il>medley>library>ONLINEUTILS.;1)
10+
11+
12+
(PRETTYCOMPRINT ONLINEUTILSCOMS)
13+
14+
(RPAQQ ONLINEUTILSCOMS ((FNS ShellHttpGet)))
15+
(DEFINEQ
16+
17+
(ShellHttpGet
18+
[LAMBDA (URL OUTFILENAME) (* ; "Edited 18-Nov-2025 22:54 by FGH")
19+
20+
(* ;; "Download a file specified by URL from the internet and place it in anew file name OUTFILENAME. OUTFILENAME will be versioned if it is on a versioned file device. Protocol of URL must be http: or https:. Uses wget (if it exists) or curl (if it exists) via a ShellCommand. It is an error if the underlying system doesn't have either wget or curl.")
21+
 (* ; "Edited 18-Nov-2025 22:39 by FGH")
22+
(LET ((UURL (U-CASE URL)))
23+
(if (NOT (OR (STRPOS "HTTP:://" UURL NIL NIL T)
24+
(STRPOS "HTTPS://" UURL NIL NIL T)))
25+
then (ERROR "ShellHttpGet URL argument is not a HTTP:// or HTTPS:// Url")))
26+
(LET* ((WGET (ShellWhich "wget"))
27+
(CURL (if (NULL WGET)
28+
then (ShellWhich "curl")
29+
else NIL))
30+
(OUTNAME (OUTFILEP OUTFILENAME))
31+
(TMPFILE (CONCAT "/tmp/wget" (CLOCK)))
32+
(UNIXFILE (CONCAT "{UNIX}" TMPFILE))
33+
(CMD (if WGET
34+
then (CONCAT WGET " " URL " -O " TMPFILE)
35+
elseif CURL
36+
then (CONCAT CURL " " URL " --output " TMPFILE)
37+
else NIL)))
38+
(if (NULL CMD)
39+
then (ERROR "ShellHttpGet - neither wget nor curl are available on this system"))
40+
(ShellCommand CMD)
41+
(COPYFILE UNIXFILE OUTNAME)
42+
(DELFILE UNIXFILE)
43+
OUTNAME])
44+
)
45+
(DECLARE%: DONTCOPY
46+
(FILEMAP (NIL (414 2055 (ShellHttpGet 424 . 2053)))))
47+
STOP
1.31 KB
Binary file not shown.

docker_medley/scripts/run-online-medley

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,20 @@ if [ $# -gt 1 ] && [ "$2" = "custom" ]; then
6767
fi
6868
fi
6969
#
70+
unset START_SCRIPT
71+
if [ -n "${START_SCRIPT_URL}" ]
72+
then
73+
export START_SCRIPT="${MEDLEY_USERDIR}/initdir/START-SCRIPT"
74+
mkdir -p "$(dirname "${START_SCRIPT}")"
75+
wget "${START_SCRIPT_URL}" -O "${START_SCRIPT}"
76+
if [ $? -ne 0 ]
77+
then
78+
rm -f "${START_SCRIPT}"
79+
unset START_SCRIPT
80+
fi
81+
fi
82+
unset START_SCRIPT_URL
83+
#
7084
if [ $# -gt 2 ]; then
7185
width=$3
7286
else

docs/Demo_mode.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
2+
# Online.Interlisp.Org: Demo mode (aka Museum Mode)
3+
## Overview
4+
5+
When accessing online.interlisp.org (OIO) using Demo Mode, Online Medley will LOAD a Lisp file called a *start script*. The start script is specified by a query parameter in the URL through which OIO was accessed. Before the Online Medley run starts, the start script file is downloaded using ```wget```into a known file in the Medley file system. It is then LOADed as the last step in the ONLINE-INIT initialization. The intent is that upon LOAD the start script will run a demo by defining and/or LOADing additional Lisp code and then starting up that demo, e.g., via a P file package command.
6+
7+
An addition aspect of Demo Mode is that login processing can (optionally) be skipped, the user automatically logged in as guest, and the Online Medley session started with no user interaction required. Alternatively, the login process can remain but the standard "Run Medley" page will be skipped and the user will go directly from login to the running Medley without having to set all the run parameters in the Run Medley page. Automatic guest login is sufficient for most demos. But requiring login allows demos to save files and context between runs of Online Medley, which is not possible with guest login.
8+
9+
## Demo mode URLs
10+
To access Demo mode, use the following URLs:
11+
12+
```https://online.interlisp.og/demo?start=\<START-SCRIPT>``` for automatic guest login.
13+
14+
```https://online.interlisp.og/demo/login?start=\<START-SCRIPT>``` to require logins
15+
16+
```<START-SCRIPT>``` is a URL pointing to a start-script lisp file that can be wget'd by the OIO server. **This URL must be encoded using the equivalent of Javascript's *encodeURIComponent*.** The easiest way to do this is via one of the many websites that offer this service such as https://meyerweb.com/eric/tools/dencoder/.
17+
18+
In addition to the *start* query parameter, Demo mode supports the *notecards=1* and *rooms=1* query parameters. If these query parameters are included in the Demo mode URL, then NoteCards and/or Rooms will be automatically started when Online Medley runs, in addition to the start-script.
19+
20+
Any of the query parameters (start, notecards, rooms) can be left off, with the expected change of function. For example, https://online.interlisp.org/demo?notecards=1 will automatically login as guest and start notecards - but not run any start script.
21+
22+
Example Demo mode URL: https://online.interlisp.org/demo?start=https%3A%2F%2Fgithub.com%2FInterlisp%2Fonline%2Fraw%2Frefs%2Fheads%2Ffgh_museum-mode%2Fstart-scripts%2FSTART-INSPHEX.LCOM&notecards=1. This URL will automatically login as guest, wget and LOAD the file START-INSPHEX.LCOM from the Interlisp/Online repo on github and start Notecards.
23+
24+
## Start scripts
25+
26+
Any LOADable Lisp file (source or compiled, Interlisp or Medley CommonLisp) can serve as a start script.
27+
28+
Sample start scripts can be found in the Interlisp/Online Github repo in the start-scripts directory.
29+
30+
Most demos will require Lisp (or other) files that are not included in the standard Online Medley image. One very handy function to be used in start scripts for these demos is ```(ShellHttpGet URL OUTFILE)```. This function will download (using wget or curl) the file specified by URL and store it in the versioned Online Medley file system under the name OUTFILE. OUTFILE can then be LOADed by the start script.
31+
32+
Below is the start script for a demo of Pamoroso's INSPHEX utility. The start script defines and then runs a function called START-INSPHEX. The START-INPHEX function in turn uses ShellHttpGet to download the source code to INSPHEX from Github, compiles it, loads the compiled file and then uses ADD.PROCESS to run the main HEXDUMP function. There is some additional complication in the call to ADD.PROCESS to ensure that packages are handled correctly. But most existing Interlisp demos will not need this complexity since they don't use packages.
33+
34+
```
35+
(DEFINE-FILE-INFO ^^PACKAGE "INTERLISP" ^^READTABLE "INTERLISP" ^^BASE 10)
36+
37+
(FILECREATED "16-Nov-2025 21:15:14" {DSK}<home>frank>il>START-INSPHEX.;1 1641)
38+
39+
(PRETTYCOMPRINT START-INSPHEXCOMS)
40+
41+
(RPAQQ START-INSPHEXCOMS ((FNS START-INSPHEX)
42+
(P (START-INSPHEX))))
43+
(DEFINEQ
44+
45+
(START-INSPHEX
46+
[LAMBDA NIL
47+
(LET* ((INSPHEX.FILE (OUTFILEP "{CORE}INSPHEX"))
48+
INSPHEX.DFASL)
49+
(ShellHttpGet "https://raw.githubusercontent.com/pamoroso/insphex/refs/heads/main/INSPHEX"
50+
INSPHEX.FILE)
51+
(SETQ INSPHEX.DFASL (CL:COMPILE-FILE INSPHEX.FILE))
52+
(LOAD INSPHEX.DFASL)
53+
(ADD.PROCESS (LIST (CL:FIND-SYMBOL "HEXDUMP" "INSPHEX")
54+
(KWOTE INSPHEX.DFASL)
55+
'(CREATEW (CREATEREGION (FIX (TIMES 0.35 SCREENWIDTH))
56+
(FIX (TIMES 0.25 SCREENHEIGHT))
57+
(FIX (TIMES 0.5 SCREENWIDTH))
58+
(FIX (TIMES 0.5 SCREENHEIGHT])
59+
)
60+
(START-INSPHEX)
61+
STOP
62+
63+
```
64+
65+
## Start scripts outside of Demo mode
66+
67+
Start scripts can also be used outside of Demo mode. In the normal OIO workflow, the user will be taken to the "Run Medley" page. On the Run Medley page, if you enable *Show advanced options* there will be a field into which you can enter the URL for a start-script (in either original or URI encoded forms). When Online Medley starts up, the specified start script will be wget'd and LOADed as in Demo mode.
68+
69+
Additionally, if a ```start=<encoded start-script URL>``` query parameter is included in the URL used to access OIO (outside of Demo mode), then the specified URL (decoded) will be prepopulated into the Advanced Options/Start URL field on the Run Medley page.
70+
71+
## Synonyms for *https::online.interlisp.org/demo*
72+
73+
For legacy reasons, ```https://online.interlisp.org/demo/guest``` and ```https://online.interlisp.org/guest``` are synonyms for ```https://online.interlisp.org/demo```.
74+

start-scripts/START-INSPHEX

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
(DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
2+
3+
(FILECREATED "18-Nov-2025 23:40:40" {DSK}<home>frank>il>online>start-scripts>START-INSPHEX.;25 1665
4+
5+
:EDIT-BY "FGH"
6+
7+
:CHANGES-TO (FNS START-INSPHEX)
8+
(VARS START-INSPHEXCOMS)
9+
10+
:PREVIOUS-DATE "11-Nov-2025 23:54:22" {DSK}<home>frank>il>online>start-scripts>START-INSPHEX.;18
11+
)
12+
13+
14+
(PRETTYCOMPRINT START-INSPHEXCOMS)
15+
16+
(RPAQQ START-INSPHEXCOMS ((FNS START-INSPHEX)
17+
(P (START-INSPHEX))))
18+
(DEFINEQ
19+
20+
(START-INSPHEX
21+
[LAMBDA NIL (* ; "Edited 18-Nov-2025 23:40 by FGH")
22+
(* ; "Edited 11-Nov-2025 23:54 by FGH")
23+
(* ; "Edited 7-Nov-2025 10:43 by FGH")
24+
(LET* ((INSPHEX.FILE (OUTFILEP "{CORE}INSPHEX"))
25+
INSPHEX.DFASL)
26+
(ShellHttpGet "https://raw.githubusercontent.com/pamoroso/insphex/refs/heads/main/INSPHEX"
27+
INSPHEX.FILE)
28+
(SETQ INSPHEX.DFASL (CL:COMPILE-FILE INSPHEX.FILE))
29+
(LOAD INSPHEX.DFASL)
30+
(ADD.PROCESS (LIST (CL:FIND-SYMBOL "HEXDUMP" "INSPHEX")
31+
(KWOTE INSPHEX.DFASL)
32+
'(CREATEW (CREATEREGION (FIX (TIMES 0.35 SCREENWIDTH))
33+
(FIX (TIMES 0.25 SCREENHEIGHT))
34+
(FIX (TIMES 0.5 SCREENWIDTH))
35+
(FIX (TIMES 0.5 SCREENHEIGHT])
36+
)
37+
38+
(START-INSPHEX)
39+
(DECLARE%: DONTCOPY
40+
(FILEMAP (NIL (528 1621 (START-INSPHEX 538 . 1619)))))
41+
STOP

start-scripts/START-INSPHEX.LCOM

1.17 KB
Binary file not shown.

start-scripts/START-INSPHEX.URL

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
https://online.interlisp.org:8081/demo?start=https%3A%2F%2Fgithub.com%2FInterlisp%2Fonline%2Fraw%2Frefs%2Fheads%2Ffgh_museum-mode%2Fstart-scripts%2FSTART-INSPHEX.LCOM
2+

0 commit comments

Comments
 (0)