From: Adam Dullage Date: Tue, 12 Dec 2023 18:28:20 +0000 (+0000) Subject: Separate server and client code X-Git-Url: http://git.99rst.org/?a=commitdiff_plain;h=1641a095cc9cc39591f491487a361e8684a2fec7;p=flatnotes.git Separate server and client code --- diff --git a/.dockerignore b/.dockerignore index 0f76a24..f0ad064 100644 --- a/.dockerignore +++ b/.dockerignore @@ -7,6 +7,7 @@ !Pipfile.lock !package.json !package-lock.json -!flatnotes/** +!client/** +!server/** !entrypoint.sh !.htmlnanorc diff --git a/.gitignore b/.gitignore index fb14dd3..b1e8c8b 100644 --- a/.gitignore +++ b/.gitignore @@ -244,7 +244,6 @@ dist .yarn/install-state.gz .pnp.* - # Custom .vscode/ data/ diff --git a/Dockerfile b/Dockerfile index 5c1e040..0ef0d20 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ RUN apt update && apt install -y npm COPY package.json package-lock.json .htmlnanorc ./ RUN npm ci -COPY flatnotes/src ./flatnotes/src +COPY client ./client RUN npm run build # Runtime Container @@ -40,8 +40,8 @@ WORKDIR ${APP_PATH} COPY LICENSE Pipfile Pipfile.lock ./ RUN pipenv install --deploy --ignore-pipfile --system -COPY flatnotes ./flatnotes -COPY --from=build ${BUILD_DIR}/flatnotes/dist ./flatnotes/dist +COPY server ./server +COPY --from=build ${BUILD_DIR}/client/dist ./client/dist VOLUME /data EXPOSE 8080/tcp diff --git a/README.md b/README.md index 506f1f6..366535b 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ services: restart: unless-stopped ``` -See the [Environment Variables](https://github.com/Dullage/flatnotes/wiki/Environment-Variables) article in the wiki for a full list of configuration options. +See the [Environment Variables](https://github.com/dullage/flatnotes/wiki/Environment-Variables) article in the wiki for a full list of configuration options. ## Roadmap diff --git a/flatnotes/src/api.js b/client/api.js similarity index 100% rename from flatnotes/src/api.js rename to client/api.js diff --git a/flatnotes/src/assets/android-chrome-192x192.png b/client/assets/android-chrome-192x192.png similarity index 100% rename from flatnotes/src/assets/android-chrome-192x192.png rename to client/assets/android-chrome-192x192.png diff --git a/flatnotes/src/assets/android-chrome-512x512.png b/client/assets/android-chrome-512x512.png similarity index 100% rename from flatnotes/src/assets/android-chrome-512x512.png rename to client/assets/android-chrome-512x512.png diff --git a/flatnotes/src/assets/apple-touch-icon.png b/client/assets/apple-touch-icon.png similarity index 100% rename from flatnotes/src/assets/apple-touch-icon.png rename to client/assets/apple-touch-icon.png diff --git a/flatnotes/src/assets/browserconfig.xml b/client/assets/browserconfig.xml similarity index 100% rename from flatnotes/src/assets/browserconfig.xml rename to client/assets/browserconfig.xml diff --git a/flatnotes/src/assets/favicon-16x16.png b/client/assets/favicon-16x16.png similarity index 100% rename from flatnotes/src/assets/favicon-16x16.png rename to client/assets/favicon-16x16.png diff --git a/flatnotes/src/assets/favicon-32x32.png b/client/assets/favicon-32x32.png similarity index 100% rename from flatnotes/src/assets/favicon-32x32.png rename to client/assets/favicon-32x32.png diff --git a/flatnotes/src/assets/favicon.ico b/client/assets/favicon.ico similarity index 100% rename from flatnotes/src/assets/favicon.ico rename to client/assets/favicon.ico diff --git a/flatnotes/src/assets/mstile-144x144.png b/client/assets/mstile-144x144.png similarity index 100% rename from flatnotes/src/assets/mstile-144x144.png rename to client/assets/mstile-144x144.png diff --git a/flatnotes/src/assets/mstile-150x150.png b/client/assets/mstile-150x150.png similarity index 100% rename from flatnotes/src/assets/mstile-150x150.png rename to client/assets/mstile-150x150.png diff --git a/flatnotes/src/assets/mstile-310x150.png b/client/assets/mstile-310x150.png similarity index 100% rename from flatnotes/src/assets/mstile-310x150.png rename to client/assets/mstile-310x150.png diff --git a/flatnotes/src/assets/mstile-310x310.png b/client/assets/mstile-310x310.png similarity index 100% rename from flatnotes/src/assets/mstile-310x310.png rename to client/assets/mstile-310x310.png diff --git a/flatnotes/src/assets/mstile-70x70.png b/client/assets/mstile-70x70.png similarity index 100% rename from flatnotes/src/assets/mstile-70x70.png rename to client/assets/mstile-70x70.png diff --git a/flatnotes/src/assets/safari-pinned-tab.svg b/client/assets/safari-pinned-tab.svg similarity index 100% rename from flatnotes/src/assets/safari-pinned-tab.svg rename to client/assets/safari-pinned-tab.svg diff --git a/flatnotes/src/autolinkParsers.js b/client/autolinkParsers.js similarity index 100% rename from flatnotes/src/autolinkParsers.js rename to client/autolinkParsers.js diff --git a/flatnotes/src/classes.js b/client/classes.js similarity index 100% rename from flatnotes/src/classes.js rename to client/classes.js diff --git a/flatnotes/src/colours.scss b/client/colours.scss similarity index 100% rename from flatnotes/src/colours.scss rename to client/colours.scss diff --git a/flatnotes/src/components/App.js b/client/components/App.js similarity index 100% rename from flatnotes/src/components/App.js rename to client/components/App.js diff --git a/flatnotes/src/components/App.vue b/client/components/App.vue similarity index 100% rename from flatnotes/src/components/App.vue rename to client/components/App.vue diff --git a/flatnotes/src/components/LoadingIndicator.vue b/client/components/LoadingIndicator.vue similarity index 100% rename from flatnotes/src/components/LoadingIndicator.vue rename to client/components/LoadingIndicator.vue diff --git a/flatnotes/src/components/Login.vue b/client/components/Login.vue similarity index 100% rename from flatnotes/src/components/Login.vue rename to client/components/Login.vue diff --git a/flatnotes/src/components/Logo.vue b/client/components/Logo.vue similarity index 100% rename from flatnotes/src/components/Logo.vue rename to client/components/Logo.vue diff --git a/flatnotes/src/components/NavBar.vue b/client/components/NavBar.vue similarity index 100% rename from flatnotes/src/components/NavBar.vue rename to client/components/NavBar.vue diff --git a/flatnotes/src/components/NoteViewerEditor.vue b/client/components/NoteViewerEditor.vue similarity index 100% rename from flatnotes/src/components/NoteViewerEditor.vue rename to client/components/NoteViewerEditor.vue diff --git a/flatnotes/src/components/RecentlyModified.vue b/client/components/RecentlyModified.vue similarity index 100% rename from flatnotes/src/components/RecentlyModified.vue rename to client/components/RecentlyModified.vue diff --git a/flatnotes/src/components/SearchInput.vue b/client/components/SearchInput.vue similarity index 100% rename from flatnotes/src/components/SearchInput.vue rename to client/components/SearchInput.vue diff --git a/flatnotes/src/components/SearchResults.vue b/client/components/SearchResults.vue similarity index 100% rename from flatnotes/src/components/SearchResults.vue rename to client/components/SearchResults.vue diff --git a/flatnotes/src/constants.js b/client/constants.js similarity index 100% rename from flatnotes/src/constants.js rename to client/constants.js diff --git a/flatnotes/src/eventBus.js b/client/eventBus.js similarity index 100% rename from flatnotes/src/eventBus.js rename to client/eventBus.js diff --git a/flatnotes/src/global.scss b/client/global.scss similarity index 100% rename from flatnotes/src/global.scss rename to client/global.scss diff --git a/flatnotes/src/helpers.js b/client/helpers.js similarity index 100% rename from flatnotes/src/helpers.js rename to client/helpers.js diff --git a/flatnotes/src/index.html b/client/index.html similarity index 100% rename from flatnotes/src/index.html rename to client/index.html diff --git a/flatnotes/src/index.js b/client/index.js similarity index 100% rename from flatnotes/src/index.js rename to client/index.js diff --git a/flatnotes/src/site.webmanifest b/client/site.webmanifest similarity index 100% rename from flatnotes/src/site.webmanifest rename to client/site.webmanifest diff --git a/flatnotes/src/toastui-editor-overrides.scss b/client/toastui-editor-overrides.scss similarity index 100% rename from flatnotes/src/toastui-editor-overrides.scss rename to client/toastui-editor-overrides.scss diff --git a/flatnotes/src/tokenStorage.js b/client/tokenStorage.js similarity index 100% rename from flatnotes/src/tokenStorage.js rename to client/tokenStorage.js diff --git a/entrypoint.sh b/entrypoint.sh index b317c95..0fe7a8e 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -10,7 +10,7 @@ echo " - The note directory inside the Docker container has moved from /app/dat flatnotes_command="python -m \ uvicorn \ main:app \ - --app-dir flatnotes \ + --app-dir server \ --host 0.0.0.0 \ --port 8080 \ --proxy-headers \ diff --git a/package.json b/package.json index e954a57..5304944 100644 --- a/package.json +++ b/package.json @@ -2,11 +2,11 @@ "name": "flatnotes", "version": "3.6.1", "description": "A database-less note taking web app that utilises a flat folder of markdown files for storage.", - "main": "flatnotes/src/index.html", + "main": "client/index.html", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", - "build": "parcel build flatnotes/src/index.html --out-dir flatnotes/dist", - "watch": "parcel flatnotes/src/index.html --out-dir flatnotes/dist" + "build": "parcel build client/index.html --out-dir client/dist", + "watch": "parcel client/index.html --out-dir client/dist" }, "author": "Adam Dullage", "license": "MIT", diff --git a/pyproject.toml b/pyproject.toml index 3988ba4..0600eef 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,4 +1,4 @@ [tool.isort] profile = "black" line_length = 79 -src_paths = ["flatnotes"] +src_paths = ["server"] diff --git a/flatnotes/auth.py b/server/auth.py similarity index 100% rename from flatnotes/auth.py rename to server/auth.py diff --git a/flatnotes/config.py b/server/config.py similarity index 100% rename from flatnotes/config.py rename to server/config.py diff --git a/flatnotes/error_responses.py b/server/error_responses.py similarity index 100% rename from flatnotes/error_responses.py rename to server/error_responses.py diff --git a/flatnotes/flatnotes.py b/server/flatnotes.py similarity index 100% rename from flatnotes/flatnotes.py rename to server/flatnotes.py diff --git a/flatnotes/helpers.py b/server/helpers.py similarity index 100% rename from flatnotes/helpers.py rename to server/helpers.py diff --git a/flatnotes/logger.py b/server/logger.py similarity index 100% rename from flatnotes/logger.py rename to server/logger.py diff --git a/flatnotes/main.py b/server/main.py similarity index 98% rename from flatnotes/main.py rename to server/main.py index 8c569f0..7e93c3e 100644 --- a/flatnotes/main.py +++ b/server/main.py @@ -100,7 +100,7 @@ if config.auth_type not in [AuthType.NONE, AuthType.READ_ONLY]: @app.get("/new", include_in_schema=False) @app.get("/note/{title}", include_in_schema=False) def root(title: str = ""): - with open("flatnotes/dist/index.html", "r", encoding="utf-8") as f: + with open("client/dist/index.html", "r", encoding="utf-8") as f: html = f.read() return HTMLResponse(content=html) @@ -257,4 +257,4 @@ def get_attachment(filename: str): return FileResponse(filepath) -app.mount("/", StaticFiles(directory="flatnotes/dist"), name="dist") +app.mount("/", StaticFiles(directory="client/dist"), name="dist") diff --git a/flatnotes/models.py b/server/models.py similarity index 100% rename from flatnotes/models.py rename to server/models.py