aboutsummaryrefslogtreecommitdiff
path: root/captain
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2021-03-27 18:12:44 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2021-03-27 18:12:44 -0400
commitc7bf38f440c3e1cafd2ddb35d4505e936d4e3e86 (patch)
treefadb6178fb5be6316c6e71774d3fb6f7f425bf70 /captain
parentfd9077056f7f33c60b218636ead0644d42e75a09 (diff)
downloadlevitating-c7bf38f440c3e1cafd2ddb35d4505e936d4e3e86.tar.gz
levitating-c7bf38f440c3e1cafd2ddb35d4505e936d4e3e86.zip
Starting work towards processing external gemini requests.
Diffstat (limited to 'captain')
-rw-r--r--captain/config.f9011
-rw-r--r--captain/external.f9029
-rw-r--r--captain/gemini.f9014
-rw-r--r--captain/templates/index.gmi1
4 files changed, 50 insertions, 5 deletions
diff --git a/captain/config.f90 b/captain/config.f90
index e66d42f..338dc4d 100644
--- a/captain/config.f90
+++ b/captain/config.f90
@@ -118,4 +118,15 @@ contains
end subroutine load_configuration
+ subroutine template_filepath(x, res)
+ use utilities, only: combine_paths
+ implicit none
+
+ character(*), intent(in)::x
+ character(*), intent(out)::res
+
+ call combine_paths(template_directory, x, res)
+
+ end subroutine template_filepath
+
end module config
diff --git a/captain/external.f90 b/captain/external.f90
index 56a7317..d33e13d 100644
--- a/captain/external.f90
+++ b/captain/external.f90
@@ -5,12 +5,39 @@ implicit none
contains
subroutine external_request_gemini(request)
+ use page_template
implicit none
character(*), intent(in)::request
+
+ character(1024)::template_file
+ type(template)::page
+
+ ! Open the base template
+ call template_filepath("index.gmi", template_file)
+ call page%init(template_file)
+
+ if(trim(request) == "/" .or. trim(request) == "/index.gmi") then
-
+
+ else if(trim(request) == "/releases.gmi") then
+
+
+
+ else if(trim(request) == "/jobs.gmi") then
+
+
+
+ else if(trim(request) == "/players.gmi") then
+
+
+
+ else if(trim(request) == "/about.gmi") then
+
+
+ end if
+
end subroutine external_request_gemini
end module external_handling \ No newline at end of file
diff --git a/captain/gemini.f90 b/captain/gemini.f90
index ce7b984..7f21392 100644
--- a/captain/gemini.f90
+++ b/captain/gemini.f90
@@ -120,11 +120,17 @@ contains
call write_log("Request is "//trim(request))
- ! If it ends in a slash, let's manually and silently add "index.gmi"
- if(request(len_trim(request):len_trim(request)) == "/") then
- request = trim(request)//"index.gmi"
+ if(len_trim(request) .ge. 4) then
+ if(request(1:4) == '/api') then
+ !call handle_api_request(request)
+ else
+ call external_request_gemini(request)
+ end if
+ else
+ call external_request_gemini(request)
end if
-
+
+
end subroutine handle_request
diff --git a/captain/templates/index.gmi b/captain/templates/index.gmi
index 0c260db..492d25d 100644
--- a/captain/templates/index.gmi
+++ b/captain/templates/index.gmi
@@ -3,6 +3,7 @@
The Levitating captain interface for the {{ project }} project.
+=> /index.gmi Home
=> /releases.gmi Releases
=> /jobs.gmi Jobs
=> /players.gmi Players