aboutsummaryrefslogtreecommitdiff
path: root/main.F90
diff options
context:
space:
mode:
Diffstat (limited to 'main.F90')
-rw-r--r--main.F9046
1 files changed, 43 insertions, 3 deletions
diff --git a/main.F90 b/main.F90
index 7d9206e..7903ca7 100644
--- a/main.F90
+++ b/main.F90
@@ -26,6 +26,7 @@ use request
#ifdef WINDOWS_GUI
use ag_render, only: appgraphics_renderer
use ag_binary, only: appgraphics_binary_handler
+use appgraphics, only: setapplicationdpiaware
#else
!use sdl_render
use dumb_render
@@ -47,11 +48,14 @@ use wsa_network, only: windows_network_startup => startup
use favorite_handling
+use favicon
+
implicit none
character(256)::initial_site
character(1024)::current_url, desired_url, input
- type(connection)::conn
+
+ character(1024)::server
#ifdef WINDOWS_GUI
type(appgraphics_renderer)::r
@@ -79,6 +83,10 @@ implicit none
#ifdef WINDOWS
call windows_network_startup()
#endif
+
+#ifdef WINDOWS_GUI
+ !call setapplicationdpiaware()
+#endif
if(command_argument_count() > 0) then
@@ -101,7 +109,7 @@ implicit none
#ifdef WINDOWS
initial_site = "lr87://home"
#else
- initial_site = "gemini://gus.guru/"
+ initial_site = "gemini://medusae.space/"
#endif
end if
@@ -119,7 +127,7 @@ implicit none
current_url = " "
first_line => null()
- open(unit=io, form="formatted", status="scratch", access='stream')
+ open(unit=io, form="formatted", status='scratch', access='stream')
do while(running)
@@ -146,6 +154,10 @@ implicit none
if(.not. loaded) then
+ call check_slashless_url(desired_url)
+
+ call r%clear_favicon()
+
call r%report_status("Requesting "//trim(desired_url))
return_code = request_url(desired_url, io, return_type, bh)
@@ -175,6 +187,9 @@ implicit none
desired_url = " "
locations_visited => add_location(locations_visited, current_url)
+
+ call get_server_from_url(current_url, server)
+ call r%set_favicon(get_favicon(server))
if(r%type_supported(return_type)) then
@@ -256,6 +271,8 @@ implicit none
call handle_relative_url(desired_url, input)
end if
+ call r%clear_favicon()
+
loaded = .false.
case (render_action_favorite)
@@ -370,5 +387,28 @@ contains
end if
end subroutine save_favorites
+
+ ! Checks to see if the url is just a server name with no
+ ! trailing slash, and fixes it
+ subroutine check_slashless_url(url)
+ implicit none
+
+ character(*), intent(inout)::url
+ integer::i, slash_count
+
+ slash_count = 0
+ if(index(url, "://") /= 0) then
+ do i = 1, len_trim(url)
+ if(url(i:i) == '/') then
+ slash_count = slash_count + 1
+ end if
+ end do
+
+ if(slash_count == 2) then
+ url(i:i) = "/"
+ end if
+ end if
+
+ end subroutine check_slashless_url
end program gemini