aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeffrey Armstrong <jeff@approximatrix.com>2021-05-20 11:14:31 -0400
committerJeffrey Armstrong <jeff@approximatrix.com>2021-05-20 11:14:31 -0400
commita13d6f007be2b43704b6237cacf668452172e591 (patch)
treef0d59928a8bb6ad38dae2dce23b7e9baa82b65a1
parent09e05b225bbea43d77ee1edfb896e5cdef43c145 (diff)
downloadlevitating-a13d6f007be2b43704b6237cacf668452172e591.tar.gz
levitating-a13d6f007be2b43704b6237cacf668452172e591.zip
Added a build date function. Implemented about and home templates for gemini interface.
-rw-r--r--captain/external.f9013
-rw-r--r--captain/web.f902
-rw-r--r--common/utilities.F9011
3 files changed, 23 insertions, 3 deletions
diff --git a/captain/external.f90 b/captain/external.f90
index f3efaaf..e691dfb 100644
--- a/captain/external.f90
+++ b/captain/external.f90
@@ -544,6 +544,7 @@ contains
use logging
use server_response
use request_utils, only: get_job_page_title
+ use utilities, only: build_date
implicit none
class(request), intent(in)::req
@@ -551,11 +552,18 @@ contains
character(1024)::template_file
type(template)::page
character(len=:), pointer::contents
- character(64)::first
+ character(64)::first, template_name
character(128)::job_page_title
! Open the base template
- call template_filepath("index.gmi", template_file)
+ if(trim(req%location) == "/" .or. trim(req%location) == "/index.gmi") then
+ template_name = "home.gmi"
+ else if(trim(req%location) == "/about.gmi") then
+ template_name = "about.gmi"
+ else
+ template_name = "index.gmi"
+ end if
+ call template_filepath(template_name, template_file)
call page%init(trim(template_file))
call write_log("Processing request", LOG_INFO)
@@ -589,6 +597,7 @@ contains
else if(trim(req%location) == "/about.gmi") then
call page%assign('title', 'About')
+ call page%assign('build_date', build_date())
else if(trim(req%location) == "/instructions.gmi") then
diff --git a/captain/web.f90 b/captain/web.f90
index cc3a552..cd94783 100644
--- a/captain/web.f90
+++ b/captain/web.f90
@@ -564,6 +564,7 @@ contains
use http, only: HTTP_CODE_SUCCESS, HTTP_CODE_NOTFOUND
use request_utils, only: get_job_page_title, handle_instruction_command
use captain_db, only: scan_instructions_for_db
+ use utilities, only: build_date
implicit none
type(request), intent(in)::req
@@ -631,6 +632,7 @@ contains
else if(trim(req%location) == "/about.html") then
call page%assign('title', 'About')
+ call page%assign('build_date', build_date())
else if(trim(req%location) == "/instructions.html") then
diff --git a/common/utilities.F90 b/common/utilities.F90
index b0afc8f..d96ec49 100644
--- a/common/utilities.F90
+++ b/common/utilities.F90
@@ -578,4 +578,13 @@ contains
end subroutine echo_file_stdout
-end module utilities \ No newline at end of file
+ function build_date()
+ implicit none
+
+ character(64)::build_date
+
+ build_date = __DATE__
+
+ end function build_date
+
+end module utilities