|
|
|
#! /usr/bin/ruby3.0
|
|
|
|
require 'sinatra'
|
|
|
|
require 'erb'
|
|
|
|
require 'date'
|
|
|
|
require 'ruby-bbcode'
|
|
|
|
require 'toml'
|
|
|
|
require 'kramdown'
|
|
|
|
require './lib/page.rb'
|
|
|
|
|
|
|
|
get '/' do
|
|
|
|
erb :greetpage
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/home' do
|
|
|
|
erb :homepage
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/mobile-menu' do
|
|
|
|
erb:mobilemenu
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/media' do
|
|
|
|
erb :folderpage
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/media/' do
|
|
|
|
erb :folderpage
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/media/*' do
|
|
|
|
erb :blogpage
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/technology' do
|
|
|
|
erb :folderpage
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/technology/' do
|
|
|
|
erb :folderpage
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/technology/*' do
|
|
|
|
erb :blogpage
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/news' do
|
|
|
|
erb :folderpage
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/news/' do
|
|
|
|
erb :folderpage
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/news/*' do
|
|
|
|
erb :blogpage
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/search' do
|
|
|
|
erb :searchpage, locals: {folder: "all", searchquery: ""}
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/search/' do
|
|
|
|
erb :searchpage, locals: {folder: "all", searchquery: ""}
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/search/:folder' do
|
|
|
|
erb :searchpage, locals: {folder: params["folder"].downcase, searchquery: params["search"]}
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/about' do
|
|
|
|
erb :aboutpage
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/contact' do
|
|
|
|
erb :contactpage
|
|
|
|
end
|
|
|
|
|
|
|
|
get '/feed' do
|
|
|
|
content_type 'application/rss+xml'
|
|
|
|
return ERB.new(File.read("./views/feed.erb"), trim_mode: "-").result(binding)
|
|
|
|
end
|
|
|
|
|
|
|
|
not_found do
|
|
|
|
status 404
|
|
|
|
erb :oops
|
|
|
|
end
|