aboutsummaryrefslogtreecommitdiff
path: root/interfaces
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2021-03-03 14:37:56 +0100
committerJohn Ankarström <john@ankarstrom.se>2021-03-03 14:37:56 +0100
commitedd1b21f926f0bcec0033b4b481fe12f54029224 (patch)
treea71bfb06f6dcfc2459befff8a2b3c962265c66cc /interfaces
parent2d149be50f74973965abec8c826fe5576a4f2440 (diff)
downloadcomb-edd1b21f926f0bcec0033b4b481fe12f54029224.tar.gz
web: Create admin sub-interface
Diffstat (limited to 'interfaces')
-rw-r--r--interfaces/http/admin/admin.rb16
-rw-r--r--interfaces/http/http.rb2
2 files changed, 17 insertions, 1 deletions
diff --git a/interfaces/http/admin/admin.rb b/interfaces/http/admin/admin.rb
new file mode 100644
index 0000000..347a051
--- /dev/null
+++ b/interfaces/http/admin/admin.rb
@@ -0,0 +1,16 @@
+class AdminInterface < Sinatra::Base
+ enable :sessions
+
+ before ['/admin', '/admin/*'] do
+ redirect '/login', 303 if not false
+ end
+
+ get '/login' do
+ end
+
+ get '/admin' do
+ @title = $config.title
+ @posts = Post.all
+ erb :index
+ end
+end
diff --git a/interfaces/http/http.rb b/interfaces/http/http.rb
index 0589c93..ec5f105 100644
--- a/interfaces/http/http.rb
+++ b/interfaces/http/http.rb
@@ -5,7 +5,7 @@ $config = Config.first
class HTTPInterface < Sinatra::Base
require_relative 'web/web'; use WebInterface
- # require_relative 'admin/admin'; use AdminInterface
+ require_relative 'admin/admin'; use AdminInterface
# require_relative 'rss/rss'; use RSSInterface
run! if app_file == $0