Skip to content

Instantly share code, notes, and snippets.

@sago35
Last active June 29, 2024 09:31
Show Gist options
  • Save sago35/79c8ea1f1b55202aa6c95d76f26325aa to your computer and use it in GitHub Desktop.
Save sago35/79c8ea1f1b55202aa6c95d76f26325aa to your computer and use it in GitHub Desktop.
Dockerfile for vial-web
FROM ubuntu:22.04
RUN apt-get update && apt-get install -y tzdata
# timezone setting
ENV TZ=Asia/Tokyo
RUN apt-get update && apt-get install -y \
git \
bash \
xz-utils \
bzip2 \
wget \
python3-openssl \
build-essential libssl-dev zlib1g-dev \
libbz2-dev libreadline-dev libsqlite3-dev curl \
libncursesw5-dev xz-utils tk-dev libxml2-dev libxmlsec1-dev libffi-dev liblzma-dev
RUN ln -s /usr/bin/python3 /usr/bin/python
WORKDIR /app
RUN git clone https://github.com/vial-kb/vial-web.git
WORKDIR /app/vial-web
RUN git clone https://github.com/vial-kb/vial-gui.git
#RUN git clone https://github.com/sago35/vial-gui.git && cd vial-gui && git checkout debug
RUN git clone https://github.com/vial-kb/via-keymap-precompiled.git
RUN chmod +x fetch-emsdk.sh fetch-deps.sh build-deps.sh
RUN ./fetch-emsdk.sh
RUN ./fetch-deps.sh
RUN ./build-deps.sh
WORKDIR /app/vial-web/src
RUN chmod +x build.sh
RUN ./build.sh
WORKDIR /app/vial-web/src/build
COPY server.py /app/vial-web/src/server.py
EXPOSE 8000
CMD ["python", "../server.py"]
#!/usr/bin/env python3
from http.server import HTTPServer, SimpleHTTPRequestHandler, test
import sys
class CORSRequestHandler (SimpleHTTPRequestHandler):
def end_headers (self):
self.send_header('Access-Control-Allow-Origin', '*')
self.send_header('Cross-Origin-Embedder-Policy', 'require-corp')
self.send_header('Cross-Origin-Opener-Policy', 'same-origin')
SimpleHTTPRequestHandler.end_headers(self)
if __name__ == '__main__':
test(CORSRequestHandler, HTTPServer, port=int(sys.argv[1]) if len(sys.argv) > 1 else 8000)
@sago35
Copy link
Author

sago35 commented Apr 7, 2024

以下を実行すると USB のやり取りを Chrome 等の dev console から見ることができる。

$ git revert 5c198e1ec60f3dfe3376503f35291b7ee7b4ced8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment