From 22ecd5eff5dd2454be8f1aab968ef76588a3b4e1 Mon Sep 17 00:00:00 2001 From: venus Date: Wed, 4 Mar 2026 15:47:53 -0600 Subject: [PATCH 1/9] refactoring into single directory and fixing docker --- app/Dockerfile | 10 +++++----- app/{app.py => ___init___.py} | 0 app/build.py | 26 ++++++++++++++++++++++++++ build.sh | 12 +++++++----- compose.yml | 11 +++++------ public_vault_builder/Dockerfile | 3 +++ public_vault_builder/build.py | 5 ++++- public_vault_builder/requirements.txt | 1 + 8 files changed, 51 insertions(+), 17 deletions(-) rename app/{app.py => ___init___.py} (100%) create mode 100644 app/build.py diff --git a/app/Dockerfile b/app/Dockerfile index ee0ca7a..821361c 100755 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -2,20 +2,20 @@ FROM python:3.10-slim AS builder ARG DEBUG_MODE=0 ENV FLASK_DEBUG=$DEBUG_MODE +ENV FLASK_APP=app -ENV FLASK_APP=app.py -WORKDIR /app -COPY requirements.txt . +COPY requirements.txt RUN pip3 install -r requirements.txt COPY . . + EXPOSE 443 ENTRYPOINT ["flask"] -CMD ["run", "--host=0.0.0.0", "--port=80"] -# CMD ["--app", ".", "run", "--host=0.0.0.0", "--port=443"] +# CMD [ "run", "--host=0.0.0.0", "--port=80"] +CMD ["--app", "app", "run", "--host=0.0.0.0", "--port=443"] diff --git a/app/app.py b/app/___init___.py similarity index 100% rename from app/app.py rename to app/___init___.py diff --git a/app/build.py b/app/build.py new file mode 100644 index 0000000..fb829c5 --- /dev/null +++ b/app/build.py @@ -0,0 +1,26 @@ +from obsidian_parser import Vault +import shutil +from git import Repo + + + +def clone_secure_repo(url: str, token: str = "", dest: str): # clone a gittea repo using optional security token into dest dirand return a path to the directory + return dest + +def public_notes(src: str): # return a list of notes tagged with public from an obsidian directory + # build vault from source + vault = Vault(src) + if vault: + print ("found vault") + else: + print("could not find vault") + return [] + + # return a list ofnotes + return vault.get_notes_with_tag("public") + + +def buld_public_vault(src: str, dest: str): # build the public vault in dest from an obsidian repo in src + for note in public_notes(src): + print(note.title) + shutil.copy2(f"{note.path}", dest) diff --git a/build.sh b/build.sh index b01a858..09af6bc 100755 --- a/build.sh +++ b/build.sh @@ -6,10 +6,12 @@ if [ -z "$1" ]; then elif [ "$1" = "-b" ]; then build="--build" echo building -elif [ "$1" = "-d" ]; then - up="-d" - echo daemon +elif [ "$1" = "-i" ]; then + vaultPath="/home/venus/Documents/Personal-Wiki" + echo building fi -docker compose down -docker compose up $up $build +#update the .env + +#build public vault +docker compose up -d public_vault_builder diff --git a/compose.yml b/compose.yml index 52820a0..6841c41 100755 --- a/compose.yml +++ b/compose.yml @@ -8,9 +8,8 @@ services: - '80:80' volumes: - ./content:/content - public_vault_builder: - build: - context: public_vault_builder - volumes: - - ${obsidian_vault}:/vault - - ./public_vault:/content + # public_vault_builder: + # build: + # context: public_vault_builder + # volumes: + # - ./public_vault:/content diff --git a/public_vault_builder/Dockerfile b/public_vault_builder/Dockerfile index dddb043..329e7bd 100644 --- a/public_vault_builder/Dockerfile +++ b/public_vault_builder/Dockerfile @@ -1,5 +1,8 @@ FROM python:3.12-slim + +run mkdir /public-vault + WORKDIR /build COPY requirements.txt . diff --git a/public_vault_builder/build.py b/public_vault_builder/build.py index 8c7a83a..e1be12b 100644 --- a/public_vault_builder/build.py +++ b/public_vault_builder/build.py @@ -1,8 +1,11 @@ from obsidian_parser import Vault import shutil +from git import Repo + +# repo_url = "https://gitlab.com/username/my-vault.git" dest = "/content" -src = "/vault" +src = "Personal-Wiki" # Load a vault vault = Vault(src) diff --git a/public_vault_builder/requirements.txt b/public_vault_builder/requirements.txt index 2e7a966..b37b36e 100644 --- a/public_vault_builder/requirements.txt +++ b/public_vault_builder/requirements.txt @@ -1 +1,2 @@ obsidianmd-parser +GitPython From d3c8d6e5441f3a5c2811b068ca5affb4d701ce89 Mon Sep 17 00:00:00 2001 From: venus Date: Wed, 4 Mar 2026 16:22:41 -0600 Subject: [PATCH 2/9] docker works --- app/Dockerfile | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/app/Dockerfile b/app/Dockerfile index 821361c..b9d17e6 100755 --- a/app/Dockerfile +++ b/app/Dockerfile @@ -1,21 +1,15 @@ -FROM python:3.10-slim AS builder +FROM python:3.14-slim ARG DEBUG_MODE=0 ENV FLASK_DEBUG=$DEBUG_MODE ENV FLASK_APP=app +RUN mkdir /app +COPY app/requirements.txt /app +RUN pip3 install -r /app/requirements.txt +COPY app /app - -COPY requirements.txt - -RUN pip3 install -r requirements.txt - -COPY . . - - -EXPOSE 443 ENTRYPOINT ["flask"] -# CMD [ "run", "--host=0.0.0.0", "--port=80"] -CMD ["--app", "app", "run", "--host=0.0.0.0", "--port=443"] +CMD ["--app", "app", "run", "--host=0.0.0.0", "--port=80"] From 1b177e3d8611926b72103ba4624a6b39d6b4a0f2 Mon Sep 17 00:00:00 2001 From: venus Date: Wed, 4 Mar 2026 16:27:30 -0600 Subject: [PATCH 3/9] removed some folders --- public_vault/Cyber-Crime.md | 75 ------------------------ public_vault/Website Tutorial.md | 82 --------------------------- public_vault/test.md | 7 --- public_vault_builder/Dockerfile | 14 ----- public_vault_builder/build.py | 25 -------- public_vault_builder/requirements.txt | 2 - 6 files changed, 205 deletions(-) delete mode 100644 public_vault/Cyber-Crime.md delete mode 100644 public_vault/Website Tutorial.md delete mode 100644 public_vault/test.md delete mode 100644 public_vault_builder/Dockerfile delete mode 100644 public_vault_builder/build.py delete mode 100644 public_vault_builder/requirements.txt diff --git a/public_vault/Cyber-Crime.md b/public_vault/Cyber-Crime.md deleted file mode 100644 index 787d479..0000000 --- a/public_vault/Cyber-Crime.md +++ /dev/null @@ -1,75 +0,0 @@ -#public -- **Cyber Crime**: Use computer/digital device to further illegal ends -> "nothings black and white in what we do, everything's got some gray" -## Types of crime - - **Crimes Against People**: A digital crime where the victim is a person - - **Crimes Against Property**: A digital crime that damages, or illegally interacts with property - - **Crimes Against Government**: A digital crime to undermine the efficacy of a government -> Life is not Black and White, Consider what the greatest impact is - -| Crime | category | -| --- | --- | -| Harrassement | People | -| Stalking | People | -| Credit Card fraud | People | -| Id theft | People | -| DOS attack | Property | -| Hacking | Property | -| Vandalism | Property | -| Cyber Warfare | Government| -| Cyber Terrorism | Government| - - > Online Harassment is a growing field, stalking, bullying, doxing, etc. - -> Modern wars be started with infrastructure hacks, Power grid hacks of Ukraine, Iran, Etc. - -### Cyber-stalking and bullying - - **Cyber Bulling**: People attacking reputation and self esteem of other people trough online means like social media campaigns. - - **Cyber Stalking**: Stalking someone through their online footprint. Often to find information with which to exploit the victim. -> Typically older person stalking a younger person. As opposed to bullying, which is usually across the same age -### Cyber Terrorism - - **Cyber Terrorism**: Politically motivated attacks on major infrastructure Money can be a factor, but usually the political is the primary motivation - - Instill fear in a society to elicit some reaction - - financial/reputation gain - - revenge - - etc. - -## Examples -Stux-Net -Nation-state attacks on power grids before Wars - -- **Sneaker Net**: Moving information across barriers physicality -> proving an attack is one of the hardest questions to answer -# U.S. National cyber strategy - - **U.S. National cyber strategy**: anually updated policy document from the white house detailing the national cyber objectives - -> it has been similar last few years - - - promote American people - - promoting American prosperity - - preserve peace through strength - - deterrent - - advanced American cyber influence - - strong alliances - - promote international policies - - Shaping adversary behavior - - regulatory environment - - Federal government security - - criticial infrastructure security - - cyber skills workforce gap - - - - - - - - - - - - - - - - diff --git a/public_vault/Website Tutorial.md b/public_vault/Website Tutorial.md deleted file mode 100644 index e607044..0000000 --- a/public_vault/Website Tutorial.md +++ /dev/null @@ -1,82 +0,0 @@ ---- -tags: - - public - - notes - - tutorial - - code - - project - - blog ---- -# So you need a website -## Overview -1. How do websites work -2. 3 things that you need -3. What are your options - 1. Premium - 2. Custom - 3. DIY - 1. Registering a domain - 1. What is DNS - 2. Picking a domain - 3. setting up a registrar - 2. Building a frontend - 1. Chat GPT - 2. DeepSite - 3. DIY options - 4. UX and frontend resources - 3. Setting up GH pages - 1. GH account - 2. Set up New Repo - 3. Importing Code - 4. Setting the DNS -## how do websites work -There are 3 main elements of the internet: your computer, the website's code, and the path between the two. -You can download [this page]() and open it in your computer. Notice how your browser's address doesn't say "Https://%url%" but instead shows a file location on your own machine. -The internet is the same phenomenon, but between multiple computers. URL, (the technical name for a link, or website address) simply stands for Universal Resource Locator and is just a way of telling your computer how to access a file on someone else's computer.* -There are lots of complicated standards for how computers actually talk to each other. The most relevant here is DNS, which stands for Domain Name System. It is how we assign internet-connected computers (called servers) with human readable names. There are special DNS servers which are responsible for telling your computer where in the world a specific website is stored. -A URL, a frontend, and server to host it are all that you need to create a website. I will explain how to simply and affordably (or even for free) set up each of these elements. - - *url's can end in [.pdf](example), [.jpg](example), or other file extensions. Just like files on your computer.* -## What do you need -### A URL -Simply a link that is going to point to your website. You can buy one from a domain registrar and configure it in just a few minutes. -### A Website file to display -This is what people will see when they visit your website. -### A computer to display it on -There are myriad ways to accomplish this from renting a server from someone, to putting on in your house, to taking advantage of already free web hosting tools. I'm going to show you how to use GitHub's* free hosting service - -*GitHub is owned by Microsoft and is the largest code distribution and hosting service. Most companies and developers rely on it's services daily.* - -## Getting A Domain -The process of registering a domain takes only a few minutes, and a couple of steps. - -There are a number of websites that control who has access to websites, and which servers they point to. They are all basically the same. I've picked out [namecheap](https://namecheap.com) for this tutorial. - -To register a domain just head over to their site, find a domain that you want, and purchase it. Watch out for these: -1. First year prices are often discounted. Watch for a renewal rate. -2. Save your password somewhere. You will hopefully have this website for a long time, and you may have someone else manage it for you eventually. -3. Marketable domains are often short and easy to spell. Imagine verbally telling someone how to visit the website. - -Make sure to verify your email and save your login information, as we will be needing to log back in shortly. - -### Building a frontend - - - - - - - - - - - - - - - - - - - - diff --git a/public_vault/test.md b/public_vault/test.md deleted file mode 100644 index 1621b48..0000000 --- a/public_vault/test.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -public: "true" -tags: - - public ---- -# This is a test -and this is p diff --git a/public_vault_builder/Dockerfile b/public_vault_builder/Dockerfile deleted file mode 100644 index 329e7bd..0000000 --- a/public_vault_builder/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM python:3.12-slim - - -run mkdir /public-vault - -WORKDIR /build - -COPY requirements.txt . - -RUN pip3 install -r requirements.txt - -COPY . . - -CMD ["python", "build.py"] diff --git a/public_vault_builder/build.py b/public_vault_builder/build.py deleted file mode 100644 index e1be12b..0000000 --- a/public_vault_builder/build.py +++ /dev/null @@ -1,25 +0,0 @@ -from obsidian_parser import Vault -import shutil -from git import Repo - - -# repo_url = "https://gitlab.com/username/my-vault.git" -dest = "/content" -src = "Personal-Wiki" -# Load a vault -vault = Vault(src) - -if vault: - print ("found vault") -else: - print("could not find vault") - -# Find notes by exact name -note = vault.get_note("test") - -# Findd all public notes -publicNotes = vault.get_notes_with_tag("public") - -for note in publicNotes: - print(note.title) - shutil.copy2(f"{note.path}", dest) diff --git a/public_vault_builder/requirements.txt b/public_vault_builder/requirements.txt deleted file mode 100644 index b37b36e..0000000 --- a/public_vault_builder/requirements.txt +++ /dev/null @@ -1,2 +0,0 @@ -obsidianmd-parser -GitPython From 99a0df522ed54bca2513deff2b24caae4b38a363 Mon Sep 17 00:00:00 2001 From: venus Date: Wed, 4 Mar 2026 16:27:53 -0600 Subject: [PATCH 4/9] moved dockerfile --- Dockerfile | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100755 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100755 index 0000000..b9d17e6 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +FROM python:3.14-slim + +ARG DEBUG_MODE=0 +ENV FLASK_DEBUG=$DEBUG_MODE +ENV FLASK_APP=app + +RUN mkdir /app +COPY app/requirements.txt /app +RUN pip3 install -r /app/requirements.txt +COPY app /app + +ENTRYPOINT ["flask"] +CMD ["--app", "app", "run", "--host=0.0.0.0", "--port=80"] + + From fdbced919259dcbc8a37ca67b904df4924959d4d Mon Sep 17 00:00:00 2001 From: venus Date: Wed, 4 Mar 2026 16:29:41 -0600 Subject: [PATCH 5/9] updated dockerfile and flask app name --- Dockerfile | 2 +- app/Dockerfile | 15 --------------- app/{___init___.py => __init__.py} | 0 compose.yml | 1 - 4 files changed, 1 insertion(+), 17 deletions(-) delete mode 100755 app/Dockerfile rename app/{___init___.py => __init__.py} (100%) diff --git a/Dockerfile b/Dockerfile index b9d17e6..574fa44 100755 --- a/Dockerfile +++ b/Dockerfile @@ -10,6 +10,6 @@ RUN pip3 install -r /app/requirements.txt COPY app /app ENTRYPOINT ["flask"] -CMD ["--app", "app", "run", "--host=0.0.0.0", "--port=80"] +CMD ["run", "--host=0.0.0.0", "--port=80"] diff --git a/app/Dockerfile b/app/Dockerfile deleted file mode 100755 index b9d17e6..0000000 --- a/app/Dockerfile +++ /dev/null @@ -1,15 +0,0 @@ -FROM python:3.14-slim - -ARG DEBUG_MODE=0 -ENV FLASK_DEBUG=$DEBUG_MODE -ENV FLASK_APP=app - -RUN mkdir /app -COPY app/requirements.txt /app -RUN pip3 install -r /app/requirements.txt -COPY app /app - -ENTRYPOINT ["flask"] -CMD ["--app", "app", "run", "--host=0.0.0.0", "--port=80"] - - diff --git a/app/___init___.py b/app/__init__.py similarity index 100% rename from app/___init___.py rename to app/__init__.py diff --git a/compose.yml b/compose.yml index 6841c41..00a8d1b 100755 --- a/compose.yml +++ b/compose.yml @@ -1,7 +1,6 @@ services: app: build: - context: app args: - DEBUG_MODE=1 ports: From 7612837e82d1f0757891fb88d2ed9fd39f847691 Mon Sep 17 00:00:00 2001 From: venus Date: Wed, 4 Mar 2026 16:32:39 -0600 Subject: [PATCH 6/9] updated .env --- .env | 1 + 1 file changed, 1 insertion(+) diff --git a/.env b/.env index af3a159..0a5da82 100644 --- a/.env +++ b/.env @@ -1,2 +1,3 @@ obsidian_vault=/home/venus/Documents/Personal-Wiki +obsidian_vault_url=https://git.riverrooks.dev/Personal-Wiki From 6c6cccae49f4cdc85ddd285bd9f783b97dfdbbb8 Mon Sep 17 00:00:00 2001 From: venus Date: Wed, 4 Mar 2026 16:37:17 -0600 Subject: [PATCH 7/9] added repo key --- .env | 1 + 1 file changed, 1 insertion(+) diff --git a/.env b/.env index 0a5da82..bbd444d 100644 --- a/.env +++ b/.env @@ -1,3 +1,4 @@ obsidian_vault=/home/venus/Documents/Personal-Wiki obsidian_vault_url=https://git.riverrooks.dev/Personal-Wiki +obsidian_vault_token=bd8cd9301ae2c1c5bacfb3340492acb5e862686a From 62dcfab91254dc915b2f9d21c419da54c0dec19c Mon Sep 17 00:00:00 2001 From: venus Date: Wed, 4 Mar 2026 18:00:42 -0600 Subject: [PATCH 8/9] updated to render md from content dir --- Dockerfile | 1 + app/__init__.py | 32 ++++++++++-------------------- app/build.py | 47 ++++++++++++++++++++++++++++---------------- app/requirements.txt | 3 +++ 4 files changed, 44 insertions(+), 39 deletions(-) diff --git a/Dockerfile b/Dockerfile index 574fa44..68174db 100755 --- a/Dockerfile +++ b/Dockerfile @@ -7,6 +7,7 @@ ENV FLASK_APP=app RUN mkdir /app COPY app/requirements.txt /app RUN pip3 install -r /app/requirements.txt + COPY app /app ENTRYPOINT ["flask"] diff --git a/app/__init__.py b/app/__init__.py index 321d5b5..b579650 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -1,35 +1,23 @@ from flask import Flask -import markdown +from app import build from pathlib import Path +import markdown app = Flask(__name__) -CONTENT_DIR = Path(__file__).parent.parent / "content" - -@app.route("/hello") -def hello_world(): - return "

Hello, World!

" +CONTENT_DIR = Path("/content") @app.route("/") def index(): # Write your markdown content - md_content = "# Welcome to my blog!\nThis is rendered from **Markdown**." + md_content = "# Welcome to my blog!\nThis is rendered from **Markdown**.\n##[test](http://localhost/test)" # Convert it to HTML html_content = markdown.markdown(md_content) return html_content -@app.route ("/post/") -def render_markdown_file(filename): - filePath = CONTENT_DIR / f"{filename}.md" - # 3. Protect against missing files - if not filePath.is_file(): - return f"

404

Could not find {filename}.md in {filePath}

", 404 - # else: - # return f"

found

found {filename} in {filePath}

" - # 4. Open, read, and convert the file - with open(filePath, "r", encoding="utf-8") as f: - textContent = f.read() - - htmlContent = markdown.markdown(textContent) - - return htmlContent +@app.route ("/") +def render_post(filename): + return build.render_file(filename, CONTENT_DIR) + # return "test" + + # return rm(filename) diff --git a/app/build.py b/app/build.py index fb829c5..8d04fc0 100644 --- a/app/build.py +++ b/app/build.py @@ -1,26 +1,39 @@ from obsidian_parser import Vault import shutil -from git import Repo +import markdown +from pathlib import Path +def render_file(filename: str, contentPath: Path): #renders markwown from filename + filePath = contentPath / f"{filename}.md" + # 3. Protect against missing files + if not filePath.is_file(): + return f"

404

Could not find {filename}.md in {filePath}

", 404 + # open the file for reading + with open(filePath, "r", encoding="utf-8") as f: + textContent = f.read() + # convert it to markdown + htmlContent = markdown.markdown(textContent) + return htmlContent -def clone_secure_repo(url: str, token: str = "", dest: str): # clone a gittea repo using optional security token into dest dirand return a path to the directory - return dest +print("build imported") +# def clone_gittea_repo(url: str, token: str = "", dest: str): # clone a gittea repo using optional security token into dest dirand return a path to the directory + # return dest -def public_notes(src: str): # return a list of notes tagged with public from an obsidian directory - # build vault from source - vault = Vault(src) - if vault: - print ("found vault") - else: - print("could not find vault") - return [] +# def public_notes(src: str): # return a list of notes tagged with public from an obsidian directory +# # build vault from source +# vault = Vault(src) +# if vault: +# print ("found vault") +# else: +# print("could not find vault") +# return [] - # return a list ofnotes - return vault.get_notes_with_tag("public") +# # return a list ofnotes +# return vault.get_notes_with_tag("public") -def buld_public_vault(src: str, dest: str): # build the public vault in dest from an obsidian repo in src - for note in public_notes(src): - print(note.title) - shutil.copy2(f"{note.path}", dest) +# def buld_public_vault(src: str, dest: str): # build the public vault in dest from an obsidian repo in src +# for note in public_notes(src): +# print(note.title) +# shutil.copy2(f"{note.path}", dest) diff --git a/app/requirements.txt b/app/requirements.txt index ad45c3c..6522df1 100755 --- a/app/requirements.txt +++ b/app/requirements.txt @@ -1,2 +1,5 @@ flask markdown +obsidianmd-parser +GitPython +py-gitea From bacbd48d30b6016e5c3371be57f41774a4245e9e Mon Sep 17 00:00:00 2001 From: venus Date: Wed, 4 Mar 2026 18:03:05 -0600 Subject: [PATCH 9/9] added gitignore again --- .gitignore | 1 + 1 file changed, 1 insertion(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7de00e0 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +app/__pychache__