updated index
This commit is contained in:
28
'
28
'
@@ -1,28 +0,0 @@
|
|||||||
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)
|
|
||||||
@@ -17,7 +17,7 @@ build.public_vault(PRIVATE_VAULT_DIR, PUBLIC_VAULT_DIR) # initialize the public
|
|||||||
def index():
|
def index():
|
||||||
md_content = "# Welcome to my blog!\nThis is rendered from **Markdown**.\n##[test](http://localhost/test)"
|
md_content = "# Welcome to my blog!\nThis is rendered from **Markdown**.\n##[test](http://localhost/test)"
|
||||||
html_content = markdown.markdown(md_content)
|
html_content = markdown.markdown(md_content)
|
||||||
return html_content
|
return build.html_file("index.md", PUBLIC_VAULT_DIR)
|
||||||
@app.route("/api/vault-update", methods=['POST', 'GET']) #webhook for vault updated
|
@app.route("/api/vault-update", methods=['POST', 'GET']) #webhook for vault updated
|
||||||
def update_vault():
|
def update_vault():
|
||||||
# TODO SECURE THIS WITH SECRETTTTT or auth header
|
# TODO SECURE THIS WITH SECRETTTTT or auth header
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ def obsidian_vault(dest = "/vault"): # makes sure there is a vault in dest
|
|||||||
return 1
|
return 1
|
||||||
|
|
||||||
def public_vault(privateVault = "/vault", dest = "/content"): # build the public vault in dest from an obsidian repo in src
|
def public_vault(privateVault = "/vault", dest = "/content"): # build the public vault in dest from an obsidian repo in src
|
||||||
|
#TODO delete old documents
|
||||||
vault = Vault(privateVault)
|
vault = Vault(privateVault)
|
||||||
if not(vault):
|
if not(vault):
|
||||||
print("could not find vault")
|
print("could not find vault")
|
||||||
|
|||||||
Reference in New Issue
Block a user