| __pycache__ | __pycache__ | ||||
| venv/ | venv/ | ||||
| libs/ |
| card.ts = +new Date() | card.ts = +new Date() | ||||
| Hanabi.sync() | Hanabi.sync() | ||||
| }, | }, | ||||
| ondragenter: (ev) => { | |||||
| /* needed for drag-drop shim */ | |||||
| ev.preventDefault() | |||||
| }, | |||||
| ondragover: (ev) => { | ondragover: (ev) => { | ||||
| ev.preventDefault() | ev.preventDefault() | ||||
| ev.dataTransfer.dropEffect = 'move' | ev.dataTransfer.dropEffect = 'move' |
| default: deploy | default: deploy | ||||
| test: venv/ | |||||
| test: venv/ libs/ | |||||
| venv/bin/python -u test.py | venv/bin/python -u test.py | ||||
| run: venv/ | |||||
| run: venv/ libs/ | |||||
| pkill Python || true | pkill Python || true | ||||
| make test | make test | ||||
| venv/bin/python -u pico.py | venv/bin/python -u pico.py | ||||
| deploy: | |||||
| rsync --archive --exclude-from=.gitignore . root@roderic.ca:/home/pico.chat/ | |||||
| deploy: libs/ | |||||
| rsync --archive --exclude=.git --exclude-from=.gitignore . root@roderic.ca:/home/pico.chat/ | |||||
| ssh root@roderic.ca "cd /home/pico.chat/ && service pico.chat restart" | ssh root@roderic.ca "cd /home/pico.chat/ && service pico.chat restart" | ||||
| venv/: requirements.txt | venv/: requirements.txt | ||||
| python3 -m venv venv | python3 -m venv venv | ||||
| venv/bin/pip install websockets | venv/bin/pip install websockets | ||||
| touch requirements.txt venv | touch requirements.txt venv | ||||
| libs/: requirements.txt | |||||
| rm -rf libs | |||||
| mkdir libs | |||||
| curl -o libs/mithril.min.js https://unpkg.com/mithril@2.0.4/mithril.min.js | |||||
| curl -o libs/marked.min.js https://unpkg.com/marked@0.8.0/marked.min.js | |||||
| curl -o libs/purify.min.js https://cdnjs.cloudflare.com/ajax/libs/dompurify/2.0.2/purify.min.js | |||||
| curl -o libs/mobile-drag-drop.min.js https://unpkg.com/mobile-drag-drop@2.3.0-rc.2/index.min.js |
| <!DOCTYPE html> | <!DOCTYPE html> | ||||
| <html> | <html> | ||||
| <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> | ||||
| <script src="https://unpkg.com/mithril/mithril.min.js"></script> | |||||
| <script src="https://unpkg.com/marked/marked.min.js"></script> | |||||
| <script src="https://cdnjs.cloudflare.com/ajax/libs/dompurify/2.0.2/purify.min.js"></script> | |||||
| <link rel="stylesheet" href="/hanabi.css" /> | |||||
| <script src="/hanabi.js" defer></script> | |||||
| <script src="/pico.js" defer></script> | |||||
| <link rel="stylesheet" href="/pico.css" /> | |||||
| <link rel="icon" href="/pico.svg" /> | <link rel="icon" href="/pico.svg" /> | ||||
| <script src="/libs/mithril.min.js"></script> | |||||
| <script src="/libs/marked.min.js"></script> | |||||
| <script src="/libs/purify.min.js"></script> | |||||
| <script src="/libs/mobile-drag-drop.min.js"></script> | |||||
| <link rel="stylesheet" href="/apps/hanabi.css" /> | |||||
| <script src="/apps/hanabi.js" defer></script> | |||||
| <link rel="stylesheet" href="/pico.css" /> | |||||
| <script src="/pico.js" defer></script> | |||||
| <script> | |||||
| MobileDragDrop.polyfill({}) | |||||
| addEventListener('touchmove', () => {}) | |||||
| </script> | |||||
| <body>PicoChat requires JS</body> | <body>PicoChat requires JS</body> | ||||
| </html> | </html> |
| )), | )), | ||||
| ), | ), | ||||
| /* we could make these into like tabs .... */ | /* we could make these into like tabs .... */ | ||||
| m(Media), | |||||
| // m(Media), | |||||
| m(Hanabi), | m(Hanabi), | ||||
| ) | ) | ||||
| }, | }, |
| class PicoProtocol(websockets.WebSocketServerProtocol): | class PicoProtocol(websockets.WebSocketServerProtocol): | ||||
| def serve_file(self, path): | def serve_file(self, path): | ||||
| document = Path(__file__, '..', Path(path).name).resolve() | |||||
| home = Path(__file__).parent | |||||
| document = home.joinpath(path.lstrip('/')) | |||||
| if not document.is_file(): | if not document.is_file(): | ||||
| document = Path(__file__, '..', 'pico.html').resolve() | |||||
| document = home.joinpath('pico.html').resolve() | |||||
| if document.suffix == '.html': | if document.suffix == '.html': | ||||
| content_type = 'text/html; charset=utf-8' | content_type = 'text/html; charset=utf-8' |