Compare commits
2 Commits
8d832372cd
...
7b2b3659bb
| Author | SHA1 | Date | |
|---|---|---|---|
|
7b2b3659bb
|
|||
|
872373dffd
|
@@ -30,7 +30,7 @@ if 'time-zone' not in NC_CONFIG:
|
|||||||
NC_CONFIG['time-zone'] = 10
|
NC_CONFIG['time-zone'] = 10
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/", strict_slashes=False)
|
||||||
@app.route("/help")
|
@app.route("/help")
|
||||||
def help():
|
def help():
|
||||||
"""Provide API documentation and help."""
|
"""Provide API documentation and help."""
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ def render_home(handshake_scripts: str | None = None):
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/", strict_slashes=False)
|
||||||
def index():
|
def index():
|
||||||
if not isCLI(request):
|
if not isCLI(request):
|
||||||
return render_home(handshake_scripts=getHandshakeScript(request.host))
|
return render_home(handshake_scripts=getHandshakeScript(request.host))
|
||||||
|
|||||||
@@ -77,15 +77,17 @@ def render_curl(date=None):
|
|||||||
|
|
||||||
# Find divs matching your pattern
|
# Find divs matching your pattern
|
||||||
divs = soup.find_all("div", style=re.compile(r"max-width:\s*700px", re.IGNORECASE))
|
divs = soup.find_all("div", style=re.compile(r"max-width:\s*700px", re.IGNORECASE))
|
||||||
|
if not divs:
|
||||||
|
return error_response(request, message="No content found for CLI rendering.")
|
||||||
|
|
||||||
for div in divs:
|
for div in divs:
|
||||||
# header could be h1/h2/h3 inside the div
|
# header could be h1/h2/h3 inside the div
|
||||||
header_tag = div.find(["h1", "h2", "h3"])
|
header_tag = div.find(["h1", "h2", "h3"]) # type: ignore
|
||||||
# content is usually one or more <p> tags inside the div
|
# content is usually one or more <p> tags inside the div
|
||||||
p_tags = div.find_all("p")
|
p_tags = div.find_all("p") # type: ignore
|
||||||
|
|
||||||
if header_tag and p_tags:
|
if header_tag and p_tags:
|
||||||
header_text = header_tag.get_text(strip=True)
|
header_text = header_tag.get_text(strip=True) # type: ignore
|
||||||
content_lines = []
|
content_lines = []
|
||||||
|
|
||||||
for p in p_tags:
|
for p in p_tags:
|
||||||
@@ -93,9 +95,9 @@ def render_curl(date=None):
|
|||||||
text = p.get_text(strip=False)
|
text = p.get_text(strip=False)
|
||||||
|
|
||||||
# Extract any <a> links in the paragraph
|
# Extract any <a> links in the paragraph
|
||||||
links = [a.get("href") for a in p.find_all("a", href=True)]
|
links = [a.get("href") for a in p.find_all("a", href=True)] # type: ignore
|
||||||
if links:
|
if links:
|
||||||
text += "\nLinks: " + ", ".join(links)
|
text += "\nLinks: " + ", ".join(links) # type: ignore
|
||||||
|
|
||||||
content_lines.append(text)
|
content_lines.append(text)
|
||||||
|
|
||||||
@@ -111,7 +113,7 @@ def render_curl(date=None):
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/", strict_slashes=False)
|
||||||
def index():
|
def index():
|
||||||
if isCLI(request):
|
if isCLI(request):
|
||||||
return render_curl()
|
return render_curl()
|
||||||
@@ -126,8 +128,7 @@ def path(path):
|
|||||||
return render(path, handshake_scripts=getHandshakeScript(request.host))
|
return render(path, handshake_scripts=getHandshakeScript(request.host))
|
||||||
|
|
||||||
|
|
||||||
@app.route("/old")
|
@app.route("/old", strict_slashes=False)
|
||||||
@app.route("/old/")
|
|
||||||
def old():
|
def old():
|
||||||
now_dates = list_dates()[1:]
|
now_dates = list_dates()[1:]
|
||||||
if isCLI(request):
|
if isCLI(request):
|
||||||
|
|||||||
@@ -122,4 +122,10 @@ def sol_donate_post(amount):
|
|||||||
return jsonify({"message": "Error: Amount too small"}), 400, SOLANA_HEADERS
|
return jsonify({"message": "Error: Amount too small"}), 400, SOLANA_HEADERS
|
||||||
|
|
||||||
transaction = create_transaction(sender, amount)
|
transaction = create_transaction(sender, amount)
|
||||||
return jsonify({"message": "Success", "transaction": transaction}), 200, SOLANA_HEADERS
|
return jsonify({"message": "Success", "transaction": transaction}), 200, SOLANA_HEADERS
|
||||||
|
|
||||||
|
@app.route("/actions.json")
|
||||||
|
def sol_actions():
|
||||||
|
return jsonify(
|
||||||
|
{"rules": [{"pathPattern": "/donate**", "apiPath": "/api/v1/donate**"}]}
|
||||||
|
)
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ def callback():
|
|||||||
print("Refresh Token:", REFRESH_TOKEN)
|
print("Refresh Token:", REFRESH_TOKEN)
|
||||||
return redirect(url_for("spotify.currently_playing"))
|
return redirect(url_for("spotify.currently_playing"))
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/", strict_slashes=False)
|
||||||
@app.route("/playing")
|
@app.route("/playing")
|
||||||
def currently_playing():
|
def currently_playing():
|
||||||
"""Public endpoint showing your current track."""
|
"""Public endpoint showing your current track."""
|
||||||
|
|||||||
@@ -4,6 +4,6 @@ from tools import json_response
|
|||||||
app = Blueprint('template', __name__)
|
app = Blueprint('template', __name__)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/", strict_slashes=False)
|
||||||
def index():
|
def index():
|
||||||
return json_response(request, "Success", 200)
|
return json_response(request, "Success", 200)
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
from flask import Blueprint, render_template, make_response, request, jsonify, send_from_directory, redirect
|
from flask import Blueprint, make_response, request, jsonify, send_from_directory, redirect
|
||||||
|
from tools import error_response
|
||||||
import os
|
import os
|
||||||
|
|
||||||
app = Blueprint('well-known', __name__, url_prefix='/.well-known')
|
app = Blueprint('well-known', __name__, url_prefix='/.well-known')
|
||||||
@@ -25,7 +26,7 @@ def wallets(path):
|
|||||||
if os.path.isfile(".well-known/wallets/" + path.upper()):
|
if os.path.isfile(".well-known/wallets/" + path.upper()):
|
||||||
return redirect("/.well-known/wallets/" + path.upper(), code=302)
|
return redirect("/.well-known/wallets/" + path.upper(), code=302)
|
||||||
|
|
||||||
return render_template("404.html"), 404
|
return error_response(request)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/nostr.json")
|
@app.route("/nostr.json")
|
||||||
|
|||||||
@@ -179,7 +179,6 @@ def serviceWorker():
|
|||||||
|
|
||||||
# region Misc routes
|
# region Misc routes
|
||||||
|
|
||||||
|
|
||||||
@app.route("/meet")
|
@app.route("/meet")
|
||||||
@app.route("/meeting")
|
@app.route("/meeting")
|
||||||
@app.route("/appointment")
|
@app.route("/appointment")
|
||||||
@@ -203,13 +202,6 @@ def api_legacy(function):
|
|||||||
return redirect(f"/api/v1/{function}", code=301)
|
return redirect(f"/api/v1/{function}", code=301)
|
||||||
return error_response(request, message="404 Not Found", code=404)
|
return error_response(request, message="404 Not Found", code=404)
|
||||||
|
|
||||||
|
|
||||||
@app.route("/actions.json")
|
|
||||||
def sol_actions():
|
|
||||||
return jsonify(
|
|
||||||
{"rules": [{"pathPattern": "/donate**", "apiPath": "/api/v1/donate**"}]}
|
|
||||||
)
|
|
||||||
|
|
||||||
# endregion
|
# endregion
|
||||||
|
|
||||||
# region Main routes
|
# region Main routes
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ Contact [/contact]
|
|||||||
Projects [/projects]
|
Projects [/projects]
|
||||||
Tools [/tools]
|
Tools [/tools]
|
||||||
Donate [/donate]
|
Donate [/donate]
|
||||||
API [/api/v1/]
|
API [/api/v1]
|
||||||
|
|
||||||
[1;36m───────────────────────────────────────────────[0m
|
[1;36m───────────────────────────────────────────────[0m
|
||||||
[1;36m ABOUT ME [0m
|
[1;36m ABOUT ME [0m
|
||||||
|
|||||||
Reference in New Issue
Block a user