Open sc0ttj opened 5 years ago
Make various Mdsh functions available as an API, so we can POST stuff to the functions, and get back the output from the API response..
This could be useful for posting Markdown to mdsh, and getting back the converted output.. Which would pave the way for a nice Admin Panel running in a cgi-bin, via which users could create their pages.
Another use case would be to post JS, CSS (etc) to some endpoint, and get back the minified versions.
Create the dir mdsh/api/
, and put Bash-CGI scripts in there as endpoints, which are just wrappers around existing functions like process_markdown
, mdsh2md
, mo
, generate_page_data
, etc.
Example: mdsh/api/get-markdown
Post some Markdown to this endpoint, and it will run it through process_markdown
and mdsh2md
, then return the output.
Create a basic admin panel, that has:
On updating the text, we can use onChange
or onKeyUp
on the textarea, to periodically post the textarea contents using AJAX to these endpoints, get the response and add them to the page in a "preview" panel.
The main scripts should know if they're running in a cgi-bin ..
They should check for $REMOTE_HOST (or something.. look it up).
This could be useful for creating a web based admin interface for managing the site (we could use some other stuff I already made to get that going fairly quickly)..
Also, make Bash on Steroids and SQLite available if running in a cgi-bin..
When building a page, could do something like: