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
break-cases=fit
break-fun-decl=wrap

View file

@ -2,14 +2,24 @@
opam-version: "2.0"
synopsis: "OCaml library to remove tracking in URLs"
description: "Use `Clear_url.clean` to remove tracking elements from URLs."
maintainer: ["swrup <swrup@protonmail.com>"]
authors: ["swrup <swrup@protonmail.com>"]
license: "ISC"
tags: ["clear_url" "clean" "url" "tracker" "web3"]
homepage: "https://git.zapashcanon.fr/swrup/clear-url"
bug-reports: "https://git.zapashcanon.fr/swrup/ocaml-clear-url/issues"
homepage: "https://forge.kumikode.org/swrup/clear-url"
bug-reports: "https://forge.kumikode.org/swrup/ocaml-clear-url/issues"
depends: [
"dune" {>= "2.9"}
"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}
]
build: [
@ -28,4 +38,4 @@ build: [
]
["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)
(name clear_url)
(generate_opam_files true)
(implicit_transitive_deps false)
(name clear_url)
(authors "swrup <swrup@protonmail.com>")
(maintainers "swrup <swrup@protonmail.com>")
(license ISC)
(authors "swrup <swrup@protonmail.com>")
(source
(uri git+https://git.zapashcanon.fr/swrup/clear-url.git))
(homepage https://git.zapashcanon.fr/swrup/clear-url)
(bug_reports https://git.zapashcanon.fr/swrup/ocaml-clear-url/issues)
(generate_opam_files true)
(uri git+https://forge.kumikode.org/swrup/clear-url.git))
(homepage https://forge.kumikode.org/swrup/clear-url)
(bug_reports https://forge.kumikode.org/swrup/ocaml-clear-url/issues)
(package
(name clear_url)
@ -26,4 +21,13 @@
(clear_url clean url tracker web3))
(depends
(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

@ -30,11 +30,11 @@ let regexps_array =
let get_array key =
value
|> (fun el ->
(*we can't use `filter_member "rules"` here because empty list
* where removed from the file ..*)
match member key el with
| `Null -> (*it was an empty list *) []
| json -> to_list json )
(*we can't use `filter_member "rules"` here because empty list
* where removed from the file ..*)
match member key el with
| `Null -> (*it was an empty list *) []
| json -> to_list json )
|> filter_string |> Array.of_list
in
let compile_array l =
@ -62,8 +62,7 @@ let clean url =
let regexps_list =
Array.fold_left
(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
in
@ -74,9 +73,7 @@ let clean url =
regexps_list
in
if is_exception then url
else
(*TODO implement redirection, is it always percent-encoded ?? *)
else (*TODO implement redirection, is it always percent-encoded ?? *)
(* apply rawrules to whole url *)
let url =
List.fold_left