1
0
Fork 0

Compare commits

...

6 Commits

Author SHA1 Message Date
cage 712aa55755 - added checking for SDL2 libraries. 2024-09-29 17:12:52 +02:00
cage 9eb3e8cc50 - updated debian chengelog. 2024-09-29 16:49:46 +02:00
cage 853ccde2fe - changed version number;
- updated NEWS.org.
2024-09-29 16:33:05 +02:00
cage 7ce0595622 - updated changelog. 2024-09-29 15:28:42 +02:00
cage 8230416499 - fixed 'loop-fetch'. 2024-09-29 14:57:44 +02:00
cage ac757ce4a6 - [GUI] added a button that acts as a shortcut to open the TOC of the last opened gempub. 2024-09-29 14:57:35 +02:00
15 changed files with 307 additions and 48 deletions

View File

@ -1,5 +1,21 @@
2024-09-29 cage
* Makefile.am,
* Makefile.in,
* data/icons/fmw_toc.png,
* src/gemini/dummy-server.lisp,
* src/gui/client/gempub-window.lisp,
* src/gui/client/icons.lisp,
* src/gui/client/main-window.lisp,
* src/package.lisp:
- [GUI] added a button that acts as a shortcut to open the TOC of the
last opened gempub.
- fixed 'loop-fetch'.
2024-09-28 cage
* ChangeLog,
* data/scripts/gemget.lisp,
* etc/init.lisp,
* src/command-line.lisp,
@ -14,6 +30,7 @@
trigger a timeout).
- [GUI] rewritten 'loop-fetch' in iterative style to prevent a stack
overflow when the server is too slow providing response's data.
- updated changelog.
2024-09-27 cage

View File

@ -75,6 +75,7 @@ data/icons/fmw_search.png \
data/icons/fmw_star-blue.png \
data/icons/fmw_star-yellow.png \
data/icons/fmw_text.png \
data/icons/fmw_toc.png \
data/icons/fmw_two-pictures.png \
data/icons/fmw_uparrow.png \
data/modules/delete-by-regex.lisp \

View File

@ -331,6 +331,7 @@ PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
PKG_CONFIG = @PKG_CONFIG@
POSUB = @POSUB@
SDL2_CONFIG = @SDL2_CONFIG@
SED = @SED@
SET_MAKE = @SET_MAKE@
SHELL = @SHELL@
@ -442,6 +443,7 @@ data/icons/fmw_search.png \
data/icons/fmw_star-blue.png \
data/icons/fmw_star-yellow.png \
data/icons/fmw_text.png \
data/icons/fmw_toc.png \
data/icons/fmw_two-pictures.png \
data/icons/fmw_uparrow.png \
data/modules/delete-by-regex.lisp \

View File

@ -1,11 +1,12 @@
* 2024-09-27 version 0.9.9.141421356237
* 2024-09-29 version 0.9.9.141421356237
- New features
- [GUI] added support for gempub files
https://codeberg.org/oppenlab/gempub/src/branch/main
- Improvements
- supported emoji shortcodes whan composing a post.
- Bugfix
- fediverse mentions in a post should work as intended;
- many, many bugs fixed, see the changelog file for details.
- many, many, many bugs fixed; see the changelog file for details.
* 2024-07-07 version 0.9.9.14142135623
- New features

114
configure vendored
View File

@ -648,6 +648,7 @@ LTLIBOBJS
LIBOBJS
ENABLE_COMPLETION_FALSE
ENABLE_COMPLETION_TRUE
SDL2_CONFIG
WISH
COMPLETION_DIR
PKG_CONFIG
@ -8084,6 +8085,64 @@ if test "$WISH" = "no" ; then
exit 1;
fi
for ac_prog in sdl2-config
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
printf %s "checking for $ac_word... " >&6; }
if test ${ac_cv_path_SDL2_CONFIG+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) case $SDL2_CONFIG in
[\\/]* | ?:[\\/]*)
ac_cv_path_SDL2_CONFIG="$SDL2_CONFIG" # Let the user override the test with a path.
;;
*)
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
case $as_dir in #(((
'') as_dir=./ ;;
*/) ;;
*) as_dir=$as_dir/ ;;
esac
for ac_exec_ext in '' $ac_executable_extensions; do
if as_fn_executable_p "$as_dir$ac_word$ac_exec_ext"; then
ac_cv_path_SDL2_CONFIG="$as_dir$ac_word$ac_exec_ext"
printf "%s\n" "$as_me:${as_lineno-$LINENO}: found $as_dir$ac_word$ac_exec_ext" >&5
break 2
fi
done
done
IFS=$as_save_IFS
;;
esac ;;
esac
fi
SDL2_CONFIG=$ac_cv_path_SDL2_CONFIG
if test -n "$SDL2_CONFIG"; then
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $SDL2_CONFIG" >&5
printf "%s\n" "$SDL2_CONFIG" >&6; }
else
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: no" >&5
printf "%s\n" "no" >&6; }
fi
test -n "$SDL2_CONFIG" && break
done
test -n "$SDL2_CONFIG" || SDL2_CONFIG="no"
if test "$SDL2_CONFIG" = "no" ; then
as_fn_error $? "Can not find libsdl2 development library." "$LINENO" 5
exit 1;
fi
if test "$COMPLETION_DIR" != ""; then
ENABLE_COMPLETION_TRUE=
ENABLE_COMPLETION_FALSE='#'
@ -8316,6 +8375,61 @@ esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for TTF_Init in -lSDL2_ttf" >&5
printf %s "checking for TTF_Init in -lSDL2_ttf... " >&6; }
if test ${ac_cv_lib_SDL2_ttf_TTF_Init+y}
then :
printf %s "(cached) " >&6
else case e in #(
e) ac_check_lib_save_LIBS=$LIBS
LIBS="-lSDL2_ttf $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
builtin and then its argument prototype would still apply.
The 'extern "C"' is for builds by C++ compilers;
although this is not generally supported in C code supporting it here
has little cost and some practical benefit (sr 110532). */
#ifdef __cplusplus
extern "C"
#endif
char TTF_Init (void);
int
main (void)
{
return TTF_Init ();
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"
then :
ac_cv_lib_SDL2_ttf_TTF_Init=yes
else case e in #(
e) ac_cv_lib_SDL2_ttf_TTF_Init=no ;;
esac
fi
rm -f core conftest.err conftest.$ac_objext conftest.beam \
conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS ;;
esac
fi
{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_SDL2_ttf_TTF_Init" >&5
printf "%s\n" "$ac_cv_lib_SDL2_ttf_TTF_Init" >&6; }
if test "x$ac_cv_lib_SDL2_ttf_TTF_Init" = xyes
then :
printf "%s\n" "#define HAVE_LIBSDL2_TTF 1" >>confdefs.h
LIBS="-lSDL2_ttf $LIBS"
else case e in #(
e) as_fn_error $? "Can not find libsdl ttf." "$LINENO" 5 ;;
esac
fi
ac_header= ac_cache=
for ac_item in $ac_header_c_list

View File

@ -157,6 +157,13 @@ if test "$WISH" = "no" ; then
exit 1;
fi
AC_PATH_PROGS([SDL2_CONFIG],[sdl2-config],[no])
if test "$SDL2_CONFIG" = "no" ; then
AC_MSG_ERROR([Can not find libsdl2 development library.])
exit 1;
fi
AM_CONDITIONAL([ENABLE_COMPLETION],[test "$COMPLETION_DIR" != ""])
AC_PROG_MKDIR_P
@ -171,6 +178,8 @@ AC_CHECK_LIB([sqlite3], [sqlite3_libversion], [], AC_MSG_ERROR([Can not find lib
AC_CHECK_LIB([turbojpeg], [tjInitDecompress], [], AC_MSG_ERROR([Can not find libturbojpeg0.]))
AC_CHECK_LIB([SDL2_ttf], [TTF_Init], [], AC_MSG_ERROR([Can not find libsdl ttf.]))
dnl check headers
AC_CHECK_HEADER([turbojpeg.h], [], [Can not find libturbojpeg0 headers file.], [])

BIN
data/icons/fmw_toc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
tinmop (0.9.9.141421356237-1) unstable; urgency=medium
* update release. (Closes: #00000)
-- cage <cage@invalid>
tinmop (0.9.9.14142135623-1) unstable; urgency=medium
* Initial release. (Closes: #00000)

2
debian/control vendored
View File

@ -18,6 +18,7 @@ Build-Depends:
libgettextpo0,
libncurses-dev,
libsdl2-dev,
libsdl2-ttf-dev,
libsqlite3-dev,
libssl-dev,
libturbojpeg0-dev,
@ -45,6 +46,7 @@ Depends:
libgettextpo0,
libncurses-dev,
libsdl2-dev,
libsdl2-ttf-dev,
libsqlite3-dev,
libssl-dev,
libturbojpeg0-dev,

View File

@ -59,6 +59,21 @@ and key stored in the file pointed by the filesystem path
request
client-cert-fingerprint)
(cond
((cl-ppcre:scan "pause" request)
(let ((response (format nil
"~a text/gemini~a~a"
(code gemini-client::+20+)
#\return #\newline)))
(write-sequence (text-utils:string->octets response)
stream)
(loop for i from 0 below 100 do
(when (= i 10)
(sleep 1))
(write-sequence (text-utils:string->octets (format nil "~a~%" i))
stream)
(finish-output stream))
(close stream)
(get-data)))
((cl-ppcre:scan "slow" request)
(format t "slow...~%")
(let ((response (format nil
@ -79,6 +94,21 @@ and key stored in the file pointed by the filesystem path
((cl-ppcre:scan "timeout" request)
(format t "timeout...~%")
(sleep 3600))
((cl-ppcre:scan "empty-response" request)
(close stream)
(format t "empty response.~%")
(get-data))
((cl-ppcre:scan "empty-body-response" request)
(format t "empty-body...~%")
(let ((response (format nil
"~a text/gemini~a~a"
(code gemini-client::+20+)
#\return #\newline)))
(format t "sending: ~a~%" response)
(write-sequence (text-utils:string->octets response)
stream)
(close stream)
(get-data)))
((null client-cert-fingerprint)
(let ((response (format nil
"~a please provide a certificate~a~a"

View File

@ -129,6 +129,15 @@
gempub-content-directory))
(fs:cat-parent-dir gempub-content-directory "/"))))
(defun open-gemini-toc (main-window gempub-metadata)
(client-main-window::set-address-bar-text main-window
(getf gempub-metadata :book-directory))
(client-main-window::open-iri (getf gempub-metadata :index-file)
main-window
nil)
(ev:with-enqueued-process-and-unblock ()
(client-main-window::inline-all-images main-window)))
(defun open-gempub-clsr (main-window gempub-frame)
(lambda (e)
(declare (ignore e))
@ -142,10 +151,10 @@
id)))
(multiple-value-bind (path book-directory)
(make-gempub-index row)
(client-main-window::set-address-bar-text main-window book-directory)
(client-main-window::open-iri path main-window nil)
(ev:with-enqueued-process-and-unblock ()
(client-main-window::inline-all-images main-window)))))))
(setf (getf row :index-file) path)
(setf (getf row :book-directory) book-directory)
(client-main-window:set-gempub-mode main-window row)
(open-gemini-toc main-window row))))))
(defun init-window (master main-window query-results)
(client-main-window:hide-autocomplete-candidates main-window)

View File

@ -48,6 +48,8 @@
(a:define-constant +profile+ "fmw_profile.png" :test #'string=)
(a:define-constant +toc+ "fmw_toc.png" :test #'string=)
(defparameter *search* nil)
(defparameter *back* nil)
@ -96,6 +98,10 @@
(defparameter *profile-disabled* nil)
(defparameter *toc* nil)
(defparameter *toc-disabled* nil)
(defun icon-filename->filepath (filename)
(if (not (re:scan "(?i)png$" filename))
(res:get-data-file (fs:cat-parent-dir +icon-dir+
@ -141,4 +147,6 @@
(setf *inline-images* (load-icon +inline-images+))
(setf *text* (load-icon +text+))
(setf *profile* (load-icon +profile+))
(setf *profile-disabled* (disable-icon +profile+))))
(setf *profile-disabled* (disable-icon +profile+))
(setf *toc* (load-icon +toc+))
(setf *toc-disabled* (disable-icon +toc+))))

View File

@ -163,29 +163,36 @@
nil)
nil)))
(fetch-latest-lines (iri last-lines-fetched-count)
(gui-goodies:with-notify-errors
(cev:enqueue-request-and-wait-results :gemini-stream-parsed-line-slice
1
ev:+standard-event-priority+
iri
last-lines-fetched-count ; start slice
nil))) ; end slice
(loop-fetch (&optional (last-lines-fetched-count 0))
(let* ((last-lines-fetched (fetch-latest-lines iri last-lines-fetched-count))
(next-start-fetching (length last-lines-fetched)))
(misc:dbg "loop fetch ~a ~a" iri last-lines-fetched-count)
(loop while (not (or (funcall aborting-function)
(and (stream-exausted-p)
(<= next-start-fetching 0))))
(handler-case
(cev:enqueue-request-and-wait-results :gemini-stream-parsed-line-slice
1
ev:+standard-event-priority+
iri
last-lines-fetched-count ; start slice
nil) ; end slice
(error (e)
(ev:with-enqueued-process-and-unblock ()
(gui-goodies:error-dialog main-window e)))))
(loop-fetch ()
(let* ((last-lines-fetched (fetch-latest-lines iri 0))
(last-lines-fetched-count (length last-lines-fetched)))
(loop named fetching
while (not (funcall aborting-function))
do
(progn
(when last-lines-fetched
(ev:with-enqueued-process-and-unblock ()
(gui-goodies:with-notify-errors
(funcall process-function stream-wrapper last-lines-fetched))))
(setf last-lines-fetched (fetch-latest-lines iri last-lines-fetched-count))
(setf next-start-fetching (length last-lines-fetched))
(incf last-lines-fetched-count next-start-fetching)))
(when last-lines-fetched
(ev:with-enqueued-process-and-unblock ()
(gui-goodies:with-notify-errors
(funcall process-function stream-wrapper last-lines-fetched))))
(let* ((stream-finished (stream-exausted-p))
(new-lines-fetched (fetch-latest-lines iri
last-lines-fetched-count))
(new-line-fetched-count (length new-lines-fetched)))
(if (and (= new-line-fetched-count 0)
stream-finished)
(return-from fetching t)
(progn
(setf last-lines-fetched new-lines-fetched)
(incf last-lines-fetched-count new-line-fetched-count)))))
(ev:with-enqueued-process-and-unblock ()
(gui-goodies:with-notify-errors
(perform-after-stream-exausted-actions))))))
@ -364,7 +371,11 @@
(inline-images-button
:initform nil
:initarg :inline-images-button
:accessor inline-images-button)))
:accessor inline-images-button)
(toc-button
:initform nil
:initarg :toc-button
:accessor toc-button)))
(defun autocomplete-iri-clsr (toolbar)
(declare (ignore toolbar))
@ -1524,6 +1535,17 @@ local file paths."
(gui:configure (certificate-button (tool-bar main-window)) :state :disabled)
(set-certificate-button-image main-window icons:*profile-disabled*))
(defun set-toc-button-image (main-window image)
(set-toolbar-button-image main-window 'toc-button image))
(defun set-toc-button-active (main-window)
(gui:configure (toc-button (tool-bar main-window)) :state :normal)
(set-toc-button-image main-window icons:*toc*))
(defun set-toc-button-inactive (main-window)
(gui:configure (toc-button (tool-bar main-window)) :state :disabled)
(set-toc-button-image main-window icons:*toc-disabled*))
(defun toggle-bookmark-iri-clsr (main-window)
(lambda ()
(with-accessors ((tool-bar tool-bar)) main-window
@ -1604,6 +1626,16 @@ local file paths."
(get-address-bar-text main-window))))
(change-client-certificate-key-passphrase main-window key-path))))
(defun open-index-gempub-clsr (main-window)
(lambda ()
(with-accessors ((gempub-metadata gempub-metadata)) main-window
(when (gempub-mode-p main-window)
(let ((iri (getf gempub-metadata :index-file)))
(if (string-not-empty-p iri)
(ev:with-enqueued-process-and-unblock ()
(client-gempub-window::open-gemini-toc main-window gempub-metadata))
(gui-goodies:notify-request-error (_ "Index file not found"))))))))
(defun setup-main-window-events (main-window)
(with-accessors ((tool-bar tool-bar)
(toc-frame toc-frame)
@ -1618,7 +1650,8 @@ local file paths."
(bookmark-button bookmark-button)
(tour-button tour-button)
(subscribe-button subscribe-button)
(inline-images-button inline-images-button)) tool-bar
(inline-images-button inline-images-button)
(toc-button toc-button)) tool-bar
(let ((entry-autocomplete (gui-mw:autocomplete-entry-widget iri-entry))
(toc-listbox (gui:listbox (toc-listbox toc-frame))))
(gui:bind entry-autocomplete
@ -1643,7 +1676,8 @@ local file paths."
(setf (gui:command bookmark-button) (toggle-bookmark-iri-clsr main-window))
(setf (gui:command tour-button) (tour-visit-next-iri-clsr main-window))
(setf (gui:command subscribe-button) (toggle-subscribtion-iri-clsr main-window))
(setf (gui:command inline-images-button) (inline-all-images-clsr main-window))))))
(setf (gui:command inline-images-button) (inline-all-images-clsr main-window))
(setf (gui:command toc-button) (open-index-gempub-clsr main-window))))))
(defmethod initialize-instance :after ((object tool-bar) &key &allow-other-keys)
(with-accessors ((iri-entry iri-entry)
@ -1655,7 +1689,8 @@ local file paths."
(bookmark-button bookmark-button)
(tour-button tour-button)
(subscribe-button subscribe-button)
(inline-images-button inline-images-button)) object
(inline-images-button inline-images-button)
(toc-button toc-button)) object
(gui:configure object :relief :raised)
(setf iri-entry (make-instance 'gui-mw:autocomplete-entry
:master object
@ -1665,6 +1700,9 @@ local file paths."
(setf go-button (make-instance 'gui:button :master object :image icons:*open-iri*))
(setf up-button (make-instance 'gui:button :master object :image icons:*up*))
(setf certificate-button (make-instance 'gui:button :master object :image icons:*profile-disabled*))
(setf toc-button (make-instance 'gui:button
:master object
:image icons:*toc-disabled*))
(setf bookmark-button (make-instance 'gui:button :master object))
(setf tour-button (make-instance 'gui:button :master object :image icons:*bus-go*))
(setf subscribe-button (make-instance 'gui:button
@ -1681,16 +1719,17 @@ local file paths."
(tour-button (_ "go to the next link in tour"))
(subscribe-button (_ "subscribe/unsubscribe to this gemlog"))
(inline-images-button (_ "inline images")))
(gui:grid back-button 0 0 :sticky :nsw)
(gui:grid reload-button 0 1 :sticky :nsw)
(gui:grid up-button 0 2 :sticky :nsw)
(gui:grid certificate-button 0 3 :sticky :nsw)
(gui:grid iri-entry 0 4 :sticky :nswe :padx +minimum-padding+)
(gui:grid go-button 0 5 :sticky :nsw)
(gui:grid bookmark-button 0 6 :sticky :nsw)
(gui:grid subscribe-button 0 7 :sticky :nsw)
(gui:grid tour-button 0 8 :sticky :nsw)
(gui:grid inline-images-button 0 9 :sticky :nsw)
(gui:grid back-button 0 0 :sticky :nsw)
(gui:grid reload-button 0 1 :sticky :nsw)
(gui:grid up-button 0 2 :sticky :nsw)
(gui:grid certificate-button 0 3 :sticky :nsw)
(gui:grid iri-entry 0 4 :sticky :nswe :padx +minimum-padding+)
(gui:grid go-button 0 5 :sticky :nsw)
(gui:grid bookmark-button 0 6 :sticky :nsw)
(gui:grid subscribe-button 0 7 :sticky :nsw)
(gui:grid tour-button 0 8 :sticky :nsw)
(gui:grid inline-images-button 0 9 :sticky :nsw)
(gui:grid toc-button 0 10 :sticky :nsw)
(gui:grid-columnconfigure object 4 :weight 2)
object))
@ -1739,9 +1778,13 @@ local file paths."
main-window)
(defclass main-frame (gui:frame)
((gemtext-widget
((gempub-metadata
:initform nil
:initarg :gemtext-widget
:initarg :gempub-metadata
:accessor gempub-metadata)
(gemtext-widget
:initform nil
:initarg :gemtext-widget
:accessor gemtext-widget)
(gemtext-font-scaling
:initform 1.0
@ -2155,3 +2198,14 @@ local file paths."
(defun hide-autocomplete-candidates (main-window)
(gui-mw:hide-candidates (iri-entry (tool-bar main-window))))
(defun gempub-mode-p (main-window)
(gempub-metadata main-window))
(defun unset-gempub-mode (main-window)
(setf (gempub-metadata main-window) nil)
(set-toc-button-inactive main-window))
(defun set-gempub-mode (main-window metadata)
(setf (gempub-metadata main-window) metadata)
(set-toc-button-active main-window))

View File

@ -3536,7 +3536,9 @@
:*inline-images*
:*text*
:*profile*
:*profile-disabled*))
:*profile-disabled*
:*toc*
:*toc-disabled*))
(defpackage :validation
(:use
@ -3835,7 +3837,11 @@
:make-internal-iri
:internal-iri-bookmark
:show-bookmarks-page
:hide-autocomplete-candidates))
:hide-autocomplete-candidates
:gempub-metadata
:gempub-mode-p
:unset-gempub-mode
:set-gempub-mode))
(defpackage :main
(:use

View File

@ -18,7 +18,7 @@
(defsystem :tinmop
:author "cage"
:license "GPLv3+"
:version "0.9.9.141421356237-rc1"
:version "0.9.9.141421356237"
:pathname "src"
:serial t
:bug-tracker "https://codeberg.org/cage/tinmop/issues"