update ...
This commit is contained in:
parent
fbbdda8ca0
commit
66e4acd56b
87
Dockerfile
Normal file
87
Dockerfile
Normal file
@ -0,0 +1,87 @@
|
||||
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
# Base image
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
FROM kalilinux/kali-rolling:latest
|
||||
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
# Environnement
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
WORKDIR /www
|
||||
ENV PATH="/root/.nimble/bin:$PATH"
|
||||
RUN echo "export PATH=/root/.nimble/bin:$PATH" >> /root/.bashrc
|
||||
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
# update and install os requirements
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
RUN apt-get update
|
||||
RUN apt-get install -y bash
|
||||
# RUN curl -sL https://deb.nodesource.com/setup_16.x | bash -
|
||||
RUN apt-get install -y curl wget gcc xz-utils git libsqlite3-dev
|
||||
RUN apt-get install -y npm nodejs
|
||||
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
# install pkgs for DEV and debug
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
RUN apt-get install -y htop net-tools
|
||||
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
# install Joplin terminal
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
RUN node -v
|
||||
RUN npm -v
|
||||
RUN NPM_CONFIG_PREFIX=~/.joplin-bin npm install -g joplin
|
||||
RUN ln -s /root/.joplin-bin/bin/joplin /usr/bin/joplin
|
||||
|
||||
# --==--==--==--==--==--==--==--==--==--==-- #
|
||||
# Joplin DEV Configuration
|
||||
# --==--==--==--==--==--==--==--==--==--==-- #
|
||||
RUN joplin config sync.target 9
|
||||
RUN joplin config sync.9.path https://joplinlab.bcmaison.cf
|
||||
RUN joplin config sync.9.username joplinlab@zohomail.com
|
||||
RUN joplin config sync.9.password Chab30017405
|
||||
RUN joplin config locale en_US
|
||||
COPY config/settings.json /root/.config/joplin
|
||||
RUN joplin sync
|
||||
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
# install nim language
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
RUN wget https://nim-lang.org/choosenim/init.sh
|
||||
RUN sh init.sh -y
|
||||
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
# install nim requirments
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
RUN nimble install -y jester bcrypt templates xlsx zip
|
||||
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
# copy reverse proxy
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
COPY mitmproxy/mitmweb /www/mitmproxy/mitmweb
|
||||
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
# copy project
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
COPY config /www/config
|
||||
ADD data /www/data
|
||||
ADD nim-lib /www/nim-lib
|
||||
ADD public /www/public
|
||||
ADD tmpl /www/tmpl
|
||||
COPY config.nims /www
|
||||
COPY main.nim /www
|
||||
COPY start_main.sh /www
|
||||
|
||||
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
# Project nim compilation
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
RUN nimble list -i
|
||||
RUN nim c -f ./main.nim
|
||||
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
# Start Joplin-TheNewWeb
|
||||
# --==--==--==--==--==--==--==--==--==--==--==--==--==--==-- #
|
||||
|
||||
CMD ["/www/start_main.sh"]
|
||||
|
@ -1,6 +1,9 @@
|
||||
#!/bin/bash
|
||||
# --==--==--==--==--==--==--==--==--==--==-- #
|
||||
# All configuration are inside the file:
|
||||
# ==> config.nims
|
||||
#
|
||||
nim c -r main.nim
|
||||
# --==--==--==--==--==--==--==--==--==--==-- #
|
||||
|
||||
nim c -r ./main.nim
|
||||
|
||||
|
@ -1,39 +0,0 @@
|
||||
# For more information, please refer to https://aka.ms/vscode-docker-python
|
||||
FROM python:3.9-alpine as compile-image
|
||||
# Install pip requirements
|
||||
COPY requirements.txt .
|
||||
RUN apk add --virtual .build-deps gcc libffi-dev musl-dev
|
||||
RUN pip install --user -r requirements.txt
|
||||
|
||||
|
||||
|
||||
FROM python:3.9-alpine
|
||||
|
||||
# add nginx
|
||||
EXPOSE 80
|
||||
RUN apk add --no-cache nginx
|
||||
RUN adduser -D -g 'www' www
|
||||
RUN mkdir /www
|
||||
RUN chown -R www:www /var/lib/nginx
|
||||
RUN chown -R www:www /www
|
||||
RUN mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.orig
|
||||
COPY settings/nginx.conf /etc/nginx/nginx.conf
|
||||
|
||||
# Keeps Python from generating .pyc files in the container
|
||||
ENV PYTHONDONTWRITEBYTECODE=1
|
||||
# Turns off buffering for easier container logging
|
||||
ENV PYTHONUNBUFFERED=1
|
||||
|
||||
COPY --from=compile-image /root/.local /root/.local
|
||||
ENV PATH=/root/.local/bin:$PATH
|
||||
WORKDIR /app
|
||||
COPY . /app
|
||||
|
||||
# Creates a non-root user with an explicit UID and adds permission to access the /app folder
|
||||
# For more info, please refer to https://aka.ms/vscode-docker-python-configure-containers
|
||||
#RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app
|
||||
#USER appuser
|
||||
|
||||
# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug
|
||||
RUN chmod +x /app/runserver.sh
|
||||
CMD ["/bin/sh", "/app/runserver.sh"]
|
@ -13,7 +13,7 @@ pass = ""
|
||||
# Server : informations related to server side
|
||||
# --==--==--==--==--==--==--==--==--==--==-- #
|
||||
[Server]
|
||||
website = "https://127.0.0.1:7000"
|
||||
website = "http://127.0.0.1:7000"
|
||||
title = "Joplin The New Web"
|
||||
url = "127.0.0.1"
|
||||
port = "7000"
|
||||
@ -26,7 +26,7 @@ port = "7000"
|
||||
#Joplin DESKTOP token
|
||||
#token = "e5f6644fbf6a97ddc55648dae72b11caecda6c6642d8ce0d3b20129b89b196385737eb908923542c3343649ebbf865b55bda031ab4c3a16edc7723ef2ad77d8f"
|
||||
# Joplin CLI token
|
||||
token = "76d06ec328466c872f3a944f8237fd96f18d2b953ff013c8689304b7384f2f2232b3aedff079902217760e8fa180d1b89d2650ee1819dd628678fccdc0a140a6"
|
||||
token = "20e85386579acca0040dcb5da3b4996dc142aef4500ff50b907f701cdc50bb11694f715e567d8d4a4b35f95172cba8fd3b5c5eb98ff889b1118e94a9cbd296db"
|
||||
joplin_server = "https://joplinlab.bcmaison.cf"
|
||||
joplin_server_user = "joplinlab@zohomail.com"
|
||||
joplin_server_pwd = "Chab30017405"
|
10
config/settings.json
Normal file
10
config/settings.json
Normal file
@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "https://joplinapp.org/schema/settings.json",
|
||||
"locale": "en_US",
|
||||
"api.token": "20e85386579acca0040dcb5da3b4996dc142aef4500ff50b907f701cdc50bb11694f715e567d8d4a4b35f95172cba8fd3b5c5eb98ff889b1118e94a9cbd296db",
|
||||
"markdown.plugin.softbreaks": false,
|
||||
"markdown.plugin.typographer": false,
|
||||
"sync.target": 9,
|
||||
"sync.9.path": "https://joplinlab.bcmaison.cf",
|
||||
"sync.9.username": "joplinlab@zohomail.com"
|
||||
}
|
@ -1 +0,0 @@
|
||||
SQLiteDatabase
|
BIN
data/~$dashbord.xlsx
Normal file
BIN
data/~$dashbord.xlsx
Normal file
Binary file not shown.
1
docker_build.sh
Normal file
1
docker_build.sh
Normal file
@ -0,0 +1 @@
|
||||
docker build -t joplin-thenewweb:latest .
|
1
docker_run.sh
Normal file
1
docker_run.sh
Normal file
@ -0,0 +1 @@
|
||||
docker run --rm -d -p 7000:7000 -p 8081:8081 -p 7777:7777 --name joplin-thenewweb joplin-thenewweb
|
12
main.nim
12
main.nim
@ -50,7 +50,7 @@ let db_host = dict.getSectionValue("Database", "host")
|
||||
# Website
|
||||
let mainURL = dict.getSectionValue("Server", "url")
|
||||
let mainPort = parseInt dict.getSectionValue("Server", "port")
|
||||
#let mainWebsite = dict.getSectionValue("Server", "website")
|
||||
let mainWebsite = dict.getSectionValue("Server", "website")
|
||||
|
||||
# Joplin
|
||||
let joplin_token = dict.getSectionValue("Joplin", "token")
|
||||
@ -359,16 +359,18 @@ routes:
|
||||
elif @"msg" == "sendFeedBack":
|
||||
echo "Todo"
|
||||
|
||||
resp Http200, {"Access-Control-Allow-Origin": "http://127.0.0.1:7000"},
|
||||
genSecret(c, cld, crd)
|
||||
#resp Http200, {"Access-Control-Allow-Origin": "http://127.0.0.1:7000"},
|
||||
#resp Http200,
|
||||
resp genSecret(c, cld, crd)
|
||||
|
||||
|
||||
# Login route
|
||||
# --==--==--==--==--==--==--==--==--==--==-- #
|
||||
get "/login":
|
||||
createTFD()
|
||||
resp Http200, {"Access-Control-Allow-Origin": "http://127.0.0.1:7000"},
|
||||
genLogin(c, @"msg")
|
||||
#resp Http200, {"Access-Control-Allow-Origin": "http://127.0.0.1:7000"},
|
||||
#resp Http200,
|
||||
resp genLogin(c, @"msg")
|
||||
|
||||
# action route during login
|
||||
# --==--==--==--==--==--==--==--==--==--==-- #
|
||||
|
16
mitmproxy/cors.py
Normal file
16
mitmproxy/cors.py
Normal file
@ -0,0 +1,16 @@
|
||||
from mitmproxy import http
|
||||
|
||||
def response(flow):
|
||||
flow.response.headers["Access-Control-Allow-Origin"] = "*"
|
||||
|
||||
# Use this if the application sends auth info via header
|
||||
flow.response.headers["Access-Control-Expose-Headers"] = "Authorization"
|
||||
|
||||
def request(flow):
|
||||
# Hijack CORS OPTIONS request
|
||||
if flow.request.method == "OPTIONS":
|
||||
flow.response = http.HTTPResponse.make(200, b"",
|
||||
{"Access-Control-Allow-Origin": "*",
|
||||
"Access-Control-Allow-Methods": "GET,POST",
|
||||
"Access-Control-Allow-Headers": "Authorization",
|
||||
"Access-Control-Max-Age": "1728000"})
|
BIN
mitmproxy/mitmdump
Normal file
BIN
mitmproxy/mitmdump
Normal file
Binary file not shown.
BIN
mitmproxy/mitmproxy
Normal file
BIN
mitmproxy/mitmproxy
Normal file
Binary file not shown.
BIN
mitmproxy/mitmweb
Normal file
BIN
mitmproxy/mitmweb
Normal file
Binary file not shown.
9
start_main.sh
Normal file
9
start_main.sh
Normal file
@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Start Proxy
|
||||
# /www/mitmproxy/mitmweb -s cors.py -p 7777 --mode reverse:http://127.0.0.1:7000/ &
|
||||
|
||||
#/www/mitmproxy/mitmweb -s cors.py -R http://192.168.0.163:7777 -b localhost -p 7000
|
||||
|
||||
# Start main Program
|
||||
/www/main
|
@ -24,7 +24,6 @@
|
||||
<link rel="stylesheet" href="css/notif-bell.css">
|
||||
<link rel="stylesheet" href="css/dashboard.css">
|
||||
<script src="js/script.js" defer></script>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
Loading…
Reference in New Issue
Block a user