askrobots / postblob Public

An experimental web framework where PostgreSQL does everything: routing, HTML, file storage, jobs and sessions.

0 downloads

postblob/add_code_link.sql
Download zip
Clone
Clone with git
git clone https://gitstable.com/git/askrobots/postblob.git
HTTPS
https://gitstable.com/git/askrobots/postblob.git
SSH
ssh://git@gitstable.com:2222/askrobots/postblob.git

Cloning needs no sign-in. Pushing over HTTPS asks for your username and an access token. SSH needs your key under SSH keys.

danq9 docs: Add screenshots to README ae44e69 1 year, 1 month ago History
add_code_link.sql · 1.4 KB · 33 lines
1-- Add /code link to homepage
2-- This finds the handle_request function in code_files and updates it
3
4-- First, let's update the stored handle_request function to add the code editor link
5UPDATE code_files
6SET content = regexp_replace(
7 content,
8 '(<div class="card">\s+<h2>🚀 API Endpoints</h2>)',
9 E'<div class="card">
10 <h2>🔥 Hot Deploy Code Editor</h2>
11 <div class="endpoint">
12 <span class="method GET">GET</span>
13 <span class="path">/code</span>
14 <div class="description">Live code editor - Edit functions while the server is running!</div>
15 </div>
16 <div style="margin-top: 20px;">
17 <a href="/code" style="display: inline-block; background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%); color: white; padding: 12px 24px; border-radius: 6px; text-decoration: none; font-weight: bold; box-shadow: 0 4px 15px rgba(0,0,0,0.2); transition: transform 0.2s;">🔥 Open Code Editor</a>
18 </div>
19 </div>
20
21 \\1',
22 'g'
23),
24version = version + 1,
25updated_at = now()
26WHERE path = 'functions/handle_request.sql'
27AND content NOT LIKE '%Hot Deploy Code Editor%'; -- Only update if not already added
28
29-- Now hot reload the function
30SELECT hot_reload('functions/handle_request.sql');
31
32-- Return status
33SELECT 'Code editor link added to homepage!' as result;