Compare commits

..

No commits in common. "630ef25c156ff7615843d8cf1ee65ecb33f02ebb" and "4bc594b5df58ffc8b1143a56a51422473b953b4b" have entirely different histories.

14 changed files with 172 additions and 148 deletions

View file

@ -1,4 +1,4 @@
version=0.28.1 version=0.27.0
assignment-operator=end-line assignment-operator=end-line
break-cases=fit break-cases=fit
break-fun-decl=wrap break-fun-decl=wrap

View file

@ -1,17 +1,30 @@
(lang dune 3.0) (lang dune 3.0)
(name geochan)
(using menhir 2.1) (using menhir 2.1)
(implicit_transitive_deps false)
(generate_opam_files true) (generate_opam_files true)
(authors "swrup <swrup@protonmail.com>" "pena <pena@kumikode.org>") (implicit_transitive_deps false)
(maintainers "swrup <swrup@protonmail.com>" "pena <pena@kumikode.org>")
(name geochan)
(license AGPL-3.0-or-later) (license AGPL-3.0-or-later)
(authors
"swrup <swrup@protonmail.com>"
"Léo Andrès <contact@ndrs.fr>")
(maintainers
"swrup <swrup@protonmail.com>"
"Léo Andrès <contact@ndrs.fr>")
(source (source
(uri git+https://forge.kumikode.org/swrup/geochan.git)) (uri git+https://git.zapashcanon.fr/zapashcanon/geochan.git))
(homepage https://forge.kumikode.org/swrup/geochan)
(bug_reports https://forge.kumikode.org/swrup/geochan/issues) (homepage https://git.zapashcanon.fr/zapashcanon/geochan)
(bug_reports https://git.zapashcanon.fr/zapashcanon/geochan/issues)
(documentation https://doc.zapashcanon.fr/geochan)
(package (package
(name geochan) (name geochan)

View file

@ -3,8 +3,8 @@ opam-version: "2.0"
synopsis: "A geo-imageboard written in OCaml" synopsis: "A geo-imageboard written in OCaml"
description: description:
"Geochan is an open source imageboard with threads pinned to a geolocation." "Geochan is an open source imageboard with threads pinned to a geolocation."
maintainer: ["swrup <swrup@protonmail.com>" "pena <pena@kumikode.org>"] maintainer: ["swrup <swrup@protonmail.com>" "Léo Andrès <contact@ndrs.fr>"]
authors: ["swrup <swrup@protonmail.com>" "pena <pena@kumikode.org>"] authors: ["swrup <swrup@protonmail.com>" "Léo Andrès <contact@ndrs.fr>"]
license: "AGPL-3.0-or-later" license: "AGPL-3.0-or-later"
tags: [ tags: [
"imageboard" "imageboard"
@ -14,8 +14,9 @@ tags: [
"single-page-application" "single-page-application"
"functional-reactive-programming" "functional-reactive-programming"
] ]
homepage: "https://forge.kumikode.org/swrup/geochan" homepage: "https://git.zapashcanon.fr/zapashcanon/geochan"
bug-reports: "https://forge.kumikode.org/swrup/geochan/issues" doc: "https://doc.zapashcanon.fr/geochan"
bug-reports: "https://git.zapashcanon.fr/zapashcanon/geochan/issues"
depends: [ depends: [
"dune" {>= "3.0"} "dune" {>= "3.0"}
"bos" "bos"
@ -63,4 +64,4 @@ build: [
"@doc" {with-doc} "@doc" {with-doc}
] ]
] ]
dev-repo: "git+https://forge.kumikode.org/swrup/geochan.git" dev-repo: "git+https://git.zapashcanon.fr/zapashcanon/geochan.git"

View file

@ -123,6 +123,7 @@ let add_user_404 id =
| _ -> session | _ -> session
in in
update_session session; update_session session;
begin match find_user id with Some _ -> update_user None | None -> () begin
match find_user id with Some _ -> update_user None | None -> ()
end; end;
() ()

View file

@ -148,7 +148,9 @@ let mk_comment_div t_s =
t_s t_s
|> S.changes |> S.changes
|> E.filter_map (fun rf -> |> E.filter_map (fun rf ->
match rf.Post_form_data.is_open with false -> None | true -> Some true ) match rf.Post_form_data.is_open with
| false -> None
| true -> Some true )
in in
Elr.set_has_focus ~on:focus_e textarea; Elr.set_has_focus ~on:focus_e textarea;
El.div ~at:[ class' "comment-input-div" ] [ label; textarea ] El.div ~at:[ class' "comment-input-div" ] [ label; textarea ]
@ -256,7 +258,9 @@ let profile user =
user.avatar_info user.avatar_info
|> Option.map (fun _ -> |> Option.map (fun _ ->
let input_el = let input_el =
El.input ~at:[ type' "hidden"; name "delete-avatar"; value "" ] () El.input
~at:[ type' "hidden"; name "delete-avatar"; value "" ]
()
in in
let btn = mk_btn "delete current avatar" in let btn = mk_btn "delete current avatar" in
mk ~btn [ input_el ] ) mk ~btn [ input_el ] )

View file

@ -258,7 +258,8 @@ let do_action : Client_types.action -> t -> t =
let quickview = let quickview =
opt |> Option.map (fun (rect, v) -> (rect, Loading v)) |> load_quickview opt |> Option.map (fun (rect, v) -> (rect, Loading v)) |> load_quickview
in in
begin match quickview with begin
match quickview with
| Some (_, Loading post_id) -> Network.GET.post post_id | Some (_, Loading post_id) -> Network.GET.post post_id
| _ -> () | _ -> ()
end; end;
@ -269,7 +270,8 @@ let do_action : Client_types.action -> t -> t =
let do_data_update : Client_types.data_update -> t -> t = let do_data_update : Client_types.data_update -> t -> t =
fun action t -> fun action t ->
Fmt.pr {|do data update: "%a"@.|} pp_data_update action; Fmt.pr {|do data update: "%a"@.|} pp_data_update action;
begin match action with begin
match action with
| Post_update v -> Db.add_post v | Post_update v -> Db.add_post v
| Thread_update thread_w_reply -> | Thread_update thread_w_reply ->
Db.update_thread_w_reply (Some thread_w_reply) Db.update_thread_w_reply (Some thread_w_reply)

View file

@ -72,7 +72,8 @@ let on_link_click () =
let navigation_handler ev = let navigation_handler ev =
(* TODO rm magick if possible *) (* TODO rm magick if possible *)
let el : El.t = Obj.magic (Ev.target ev) in let el : El.t = Obj.magic (Ev.target ev) in
begin if Jstr.equal (El.tag_name el) (Jstr.v "a") then begin
if Jstr.equal (El.tag_name el) (Jstr.v "a") then
match El.at (Jstr.v "href") el with match El.at (Jstr.v "href") el with
| None -> Fmt.failwith "<a> element with no href" | None -> Fmt.failwith "<a> element with no href"
| Some href -> begin | Some href -> begin

View file

@ -81,7 +81,8 @@ module GET = struct
fun req v -> fun req v ->
let open Client_types in let open Client_types in
let open Events in let open Events in
begin match req with begin
match req with
| Catalog -> send_data_update (Catalog_update v) | Catalog -> send_data_update (Catalog_update v)
| Thread _id -> send_data_update (Thread_update v) | Thread _id -> send_data_update (Thread_update v)
| Post _id -> send_data_update (Post_update v) | Post _id -> send_data_update (Post_update v)
@ -154,7 +155,8 @@ module POST = struct
fun o v -> fun o v ->
let open Client_types in let open Client_types in
let open Events in let open Events in
begin match o with begin
match o with
| Home -> | Home ->
send_data_update (Thread_update v); send_data_update (Thread_update v);
send_action (Post_form_change Form_reset); send_action (Post_form_change Form_reset);

View file

@ -1,7 +1,7 @@
default_logger true default_logger true
custom_logger true custom_logger true
admin admin admin admin
source_code_url "https://forge.kumikode.org/swrup/geochan" source_code_url "https://git.zapashcanon.fr/swrup/geochan"
hostname "localhost" hostname "localhost"
port 3696 port 3696
csrf_lifetime 3600 csrf_lifetime 3600