fmt+add deps

This commit is contained in:
Swrup 2026-03-19 19:55:53 +01:00
parent 276bb92d08
commit db36e13563
4 changed files with 38 additions and 27 deletions

View file

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

View file

@ -2,14 +2,24 @@
opam-version: "2.0" opam-version: "2.0"
synopsis: "OCaml library to remove tracking in URLs" synopsis: "OCaml library to remove tracking in URLs"
description: "Use `Clear_url.clean` to remove tracking elements from URLs." description: "Use `Clear_url.clean` to remove tracking elements from URLs."
maintainer: ["swrup <swrup@protonmail.com>"]
authors: ["swrup <swrup@protonmail.com>"] authors: ["swrup <swrup@protonmail.com>"]
license: "ISC" license: "ISC"
tags: ["clear_url" "clean" "url" "tracker" "web3"] tags: ["clear_url" "clean" "url" "tracker" "web3"]
homepage: "https://git.zapashcanon.fr/swrup/clear-url" homepage: "https://forge.kumikode.org/swrup/clear-url"
bug-reports: "https://git.zapashcanon.fr/swrup/ocaml-clear-url/issues" bug-reports: "https://forge.kumikode.org/swrup/ocaml-clear-url/issues"
depends: [ depends: [
"dune" {>= "2.9"} "dune" {>= "2.9"}
"ocaml" {>= "4.08"} "ocaml" {>= "4.08"}
"bos"
"fpath"
"re"
"uri"
"yojson"
"lwt" {with-dev-setup}
"tls-lwt" {with-dev-setup}
"cohttp-lwt" {with-dev-setup}
"cohttp-lwt-unix" {with-dev-setup}
"odoc" {with-doc} "odoc" {with-doc}
] ]
build: [ build: [
@ -28,4 +38,4 @@ build: [
] ]
["dune" "install" "-p" name "--create-install-files" name] ["dune" "install" "-p" name "--create-install-files" name]
] ]
dev-repo: "git+https://git.zapashcanon.fr/swrup/clear-url.git" dev-repo: "git+https://forge.kumikode.org/swrup/clear-url.git"

View file

@ -1,21 +1,16 @@
(lang dune 2.9) (lang dune 2.9)
(name clear_url)
(generate_opam_files true)
(implicit_transitive_deps false) (implicit_transitive_deps false)
(name clear_url) (authors "swrup <swrup@protonmail.com>")
(maintainers "swrup <swrup@protonmail.com>")
(license ISC) (license ISC)
(authors "swrup <swrup@protonmail.com>")
(source (source
(uri git+https://git.zapashcanon.fr/swrup/clear-url.git)) (uri git+https://forge.kumikode.org/swrup/clear-url.git))
(homepage https://forge.kumikode.org/swrup/clear-url)
(homepage https://git.zapashcanon.fr/swrup/clear-url) (bug_reports https://forge.kumikode.org/swrup/ocaml-clear-url/issues)
(bug_reports https://git.zapashcanon.fr/swrup/ocaml-clear-url/issues)
(generate_opam_files true)
(package (package
(name clear_url) (name clear_url)
@ -26,4 +21,13 @@
(clear_url clean url tracker web3)) (clear_url clean url tracker web3))
(depends (depends
(ocaml (ocaml
(>= 4.08)))) (>= 4.08))
bos
fpath
re
uri
yojson
(lwt :with-dev-setup)
(tls-lwt :with-dev-setup)
(cohttp-lwt :with-dev-setup)
(cohttp-lwt-unix :with-dev-setup)))

View file

@ -62,8 +62,7 @@ let clean url =
let regexps_list = let regexps_list =
Array.fold_left Array.fold_left
(fun acc regexps -> (fun acc regexps ->
if Re.matches regexps.urlpattern url <> [] then regexps :: acc else acc if Re.matches regexps.urlpattern url <> [] then regexps :: acc else acc )
)
[] regexps_array [] regexps_array
in in
@ -74,9 +73,7 @@ let clean url =
regexps_list regexps_list
in in
if is_exception then url if is_exception then url
else else (*TODO implement redirection, is it always percent-encoded ?? *)
(*TODO implement redirection, is it always percent-encoded ?? *)
(* apply rawrules to whole url *) (* apply rawrules to whole url *)
let url = let url =
List.fold_left List.fold_left