Compare commits
2 Commits
4e35dabde7
...
e8a0831809
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e8a0831809 | ||
|
|
5ed4acf7bf |
28
'
Normal file
28
'
Normal file
@@ -0,0 +1,28 @@
|
||||
from flask import Flask
|
||||
from app import build
|
||||
from pathlib import Path
|
||||
import markdown
|
||||
import os
|
||||
from dotenv import load_dotenv
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
PRIVATE_VAULT_DIR = Path("/vault")
|
||||
PUBLIC_VAULT_DIR = "/content"
|
||||
|
||||
build.obsidian_vault(PRIVATE_VAULT_DIR) # initialize the private obsidian repo
|
||||
build.public_vault(PRIVATE_VAULT_DIR, PUBLIC_VAULT_DIR) # initialize the public notes from the private repo
|
||||
|
||||
@app.route("/")
|
||||
def index():
|
||||
md_content = "# Welcome to my blog!\nThis is rendered from **Markdown**.\n##[test](http://localhost/test)"
|
||||
html_content = markdown.markdown(md_content)
|
||||
return html_content
|
||||
@app.route("/api/vault-update") #webhook for vault updated
|
||||
def update_vault():
|
||||
# TODO SECURE THIS WITH SECRETTTTT or auth header
|
||||
print(build.public_vault(PRIVATE_VAULT_DIR, PUBLIC_VAULT_DIR))# initialize the public notes from the private repo
|
||||
return "vault-rebuilt"
|
||||
@app.route ("/<filename>") # renders a filename if not otherwise specified
|
||||
def render_post(filename):
|
||||
return build.html_file(filename, PUBLIC_VAULT_DIR)
|
||||
@@ -23,10 +23,6 @@ def update_vault():
|
||||
# TODO SECURE THIS WITH SECRETTTTT or auth header
|
||||
print(build.public_vault(PRIVATE_VAULT_DIR, PUBLIC_VAULT_DIR))# initialize the public notes from the private repo
|
||||
return "vault-rebuilt"
|
||||
|
||||
|
||||
|
||||
|
||||
@app.route ("/<filename>") # renders a filename if not otherwise specified
|
||||
def render_post(filename):
|
||||
return build.html_file(filename, PUBLIC_VAULT_DIR)
|
||||
|
||||
@@ -7,7 +7,7 @@ services:
|
||||
- obsidian_vault_token=bd8cd9301ae2c1c5bacfb3340492acb5e862686a
|
||||
|
||||
ports:
|
||||
- '80:80'
|
||||
- '8188:80'
|
||||
volumes:
|
||||
- ./content:/content #public
|
||||
- ./public-vault:/vault #private
|
||||
|
||||
Reference in New Issue
Block a user