Initial commit, blog system works
This commit is contained in:
30
.init.lua
Normal file
30
.init.lua
Normal file
@@ -0,0 +1,30 @@
|
||||
-- special script called by main redbean process at startup
|
||||
HidePath('/usr/share/zoneinfo/')
|
||||
HidePath('/usr/share/ssl/')
|
||||
|
||||
-- fm from https://github.com/pkulchenko/fullmoon
|
||||
local fm = require "fm"
|
||||
local app = require "app"
|
||||
|
||||
-----------------------------------------------------------------
|
||||
-- Basic Browser Launch Logic
|
||||
-----------------------------------------------------------------
|
||||
local function launch_browser(url)
|
||||
if os.getenv("OS") == "Windows_NT" then
|
||||
os.execute("start " .. url)
|
||||
else
|
||||
-- Try xdg-open for Linux, then open for macOS
|
||||
if not os.execute("xdg-open " .. url .. " 2>/dev/null") then
|
||||
os.execute("open " .. url)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- Launch browser only on initial startup (skip for daemons/tests:
|
||||
-- set BLOG_NO_BROWSER=1 to suppress).
|
||||
if not _G.launched and not os.getenv("BLOG_NO_BROWSER") then
|
||||
launch_browser("http://localhost:8080")
|
||||
_G.launched = true
|
||||
end
|
||||
|
||||
fm.run()
|
||||
Reference in New Issue
Block a user