8 Commits

Author SHA1 Message Date
venus
f8725658a5 docker works 2026-03-04 16:22:41 -06:00
venus
e07c75d857 updated compose and moved dockerfile 2026-03-04 16:09:55 -06:00
venus
f8a791a4fe changed to __init__.py 2026-03-04 16:08:22 -06:00
venus
58ba0b1444 added gitignore 2026-03-04 16:07:56 -06:00
venus
994a96a0be updated requirements from deleted build.py 2026-03-04 16:07:05 -06:00
venus
8acb06764a removed public vault dir 2026-03-04 16:05:00 -06:00
venus
24b6b700be removed dir 2026-03-04 16:02:28 -06:00
venus
0d06f1c085 unsure 2026-03-04 16:01:53 -06:00
12 changed files with 69 additions and 258 deletions

3
.env
View File

@@ -1,5 +1,2 @@
obsidian_vault=/home/venus/Documents/Personal-Wiki obsidian_vault=/home/venus/Documents/Personal-Wiki
obsidian_vault_url=git.riverrooks.dev/Personal-Wiki
OBSIDIAN_VAULT_URL=git.riverrooks.dev/Personal-Wiki
obsidian_vault_token=bd8cd9301ae2c1c5bacfb3340492acb5e862686a

1
.gitignore vendored
View File

@@ -1,2 +1 @@
app/__pychache__ app/__pychache__
public-vault

View File

@@ -1,29 +1,15 @@
FROM python:3.14-slim FROM python:3.14-slim
#install git ARG DEBUG_MODE=0
RUN apt-get update && apt-get install -y \ ENV FLASK_DEBUG=$DEBUG_MODE
git \ ENV FLASK_APP=app
&& rm -rf /var/lib/apt/lists/*
#install dependencies
RUN mkdir /app RUN mkdir /app
COPY app/requirements.txt /app COPY app/requirements.txt /app
RUN pip3 install -r /app/requirements.txt RUN pip3 install -r /app/requirements.txt
#parse from .env file
ARG DEBUG_MODE=0
ARG obsidian_vault=/home/venus/Documents/Personal-Wiki
ARG OBSIDIAN_VAULT_URL=git.riverrooks.dev/venus/Personal-Wiki
ARG obsidian_vault_token=bd8cd9301ae2c1c5bacfb3340492acb5e862686a
ENV FLASK_DEBUG=$DEBUG_MODE
ENV FLASK_APP=app
# ENV OBSIDIAN_VAULT=$obsidian_vault
ENV OBSIDIAN_VAULT_URL=$OBSIDIAN_VAULT_URL
ENV OBSIDIAN_VAULT_TOKEN=$obsidian_vault_token
COPY app /app COPY app /app
ENTRYPOINT ["flask"] ENTRYPOINT ["flask"]
CMD ["run", "--host=0.0.0.0", "--port=80"] CMD ["--app", "app", "run", "--host=0.0.0.0", "--port=80"]

View File

@@ -1,26 +1,35 @@
from flask import Flask from flask import Flask
from app import build
from pathlib import Path
import markdown import markdown
import os from pathlib import Path
from dotenv import load_dotenv
app = Flask(__name__) app = Flask(__name__)
PRIVATE_VAULT_DIR = Path("/vault") CONTENT_DIR = Path(__file__).parent.parent / "content"
PUBLIC_VAULT_DIR = "/content"
build.obsidian_vault(PRIVATE_VAULT_DIR) # initialize the private obsidian repo @app.route("/hello")
build.public_vault(PRIVATE_VAULT_DIR, PUBLIC_VAULT_DIR) # initialize the public notes from the private repo def hello_world():
return "<h1>Hello, World!</h1>"
@app.route("/") @app.route("/")
def index(): def index():
md_content = "# Welcome to my blog!\nThis is rendered from **Markdown**.\n##[test](http://localhost/test)" # Write your markdown content
md_content = "# Welcome to my blog!\nThis is rendered from **Markdown**."
# Convert it to HTML
html_content = markdown.markdown(md_content) html_content = markdown.markdown(md_content)
return html_content return html_content
@app.route("/api/push") #webhook for vault updated
def
@app.route ("/<filename>") # renders a filename if not otherwise specified @app.route ("/post/<filename>")
def render_post(filename): def render_markdown_file(filename):
return build.html_file(filename, PUBLIC_VAULT_DIR) filePath = CONTENT_DIR / f"{filename}.md"
# 3. Protect against missing files
if not filePath.is_file():
return f"<h1>404</h1><p>Could not find {filename}.md in {filePath}</p>", 404
# else:
# return f"<h1> found</h1> <p> found {filename} in {filePath}</p>"
# 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

View File

@@ -1,61 +1,26 @@
from obsidian_parser import Vault from obsidian_parser import Vault
import shutil import shutil
import markdown from git import Repo
from pathlib import Path
import os
def html_file(filename, contentPath): #renders markwown from filename
filePath = Path(f"{contentPath}/{filename}.md")
# 3. Protect against missing files
if not filePath.is_file():
return f"<h1>404</h1><p>Could not find {filename}.md in {filePath}</p>", 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
def obsidian_vault(dest = "/vault"): # makes sure there is a vault in dest def public_notes(src: str): # return a list of notes tagged with public from an obsidian directory
from git import Repo # build vault from source
url = os.getenv("OBSIDIAN_VAULT_URL") vault = Vault(src)
token = os.getenv("OBSIDIAN_VAULT_TOKEN") if vault:
if not(token): print ("found vault")
print ("token not found, cant build vault") else:
raise NameError("tokenNotFound")
return 0
url = f"https://{token}@{url}"
if os.path.exists(os.path.join(dest, '.git')):
#TODO handle merge conflictsjjj
print (f"pulling vault from {url} in {dest}")
repo = Repo(dest)
origin = repo.remotes.origin
origin.fetch()
origin.pull(strategy_option='theirs')
print ("vault updated")
return 1
print (f"building vault from {url} in {dest}")
Repo.clone_from(url, dest)
print("cloned vault!")
return 1
def public_vault(privateVault = "/vault", dest = "/content"): # build the public vault in dest from an obsidian repo in src
vault = Vault(privateVault)
if not(vault):
print("could not find vault") print("could not find vault")
raise NameError("vaultNotFound") return []
return 0
print(f"valid vault{vault}") # return a list ofnotes
return vault.get_notes_with_tag("public")
publicNotes = vault.get_notes_with_tag("public")
print(f"publicNotes: {publicNotes}") def buld_public_vault(src: str, dest: str): # build the public vault in dest from an obsidian repo in src
for note in publicNotes: for note in public_notes(src):
print(note.title) print(note.title)
shutil.copy2(f"{note.path}", dest) shutil.copy2(f"{note.path}", dest)

View File

@@ -2,4 +2,3 @@ flask
markdown markdown
obsidianmd-parser obsidianmd-parser
GitPython GitPython
python-dotenv

View File

@@ -3,11 +3,7 @@ services:
build: build:
args: args:
- DEBUG_MODE=1 - DEBUG_MODE=1
- obsidian_vault_url=https://git.riverrooks.dev/Personal-Wiki
- obsidian_vault_token=bd8cd9301ae2c1c5bacfb3340492acb5e862686a
ports: ports:
- '80:80' - '80:80'
volumes: volumes:
- ./content:/content #public - ./content:/content
- ./public-vault:/vault #private

View File

@@ -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

View File

@@ -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

3
content/index.md Executable file
View File

@@ -0,0 +1,3 @@
# This is a test
and this is p
*italics*

10
content/test.md Normal file → Executable file
View File

@@ -1,11 +1,3 @@
---
public: "true"
tags:
- public
---
# This is a test # This is a test
and this is p and this is p
[https://localhost/test]() *italics*
[asd](https://localhost/test)

22
readme.md Normal file
View File

@@ -0,0 +1,22 @@
# Architecture
/app
> containts all of the files to build and run the docker container.Docker containter runs the application
/content
> contains all of the publicly accessible files
templates
notes
index
...
compose # compose file to mount content to app
build.sh #optional file to build the app
.env # enviroment var files for location of existing public directory. will depricate
# Dockerfile
> builds the flask application and sets it to run.
- runs the site
# app
- clones the public repo (from env var url)
- finds public notes and moves to content vault
- exposes webhook to update vault and public notes