forked from atdixon/me.untethr.nostr-relay
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented new 2022 nips, dust-off, add some practical leniency in p…
…laces
- Loading branch information
Showing
17 changed files
with
373 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
{:deps | ||
{org.clojure/clojure {:mvn/version "1.10.3"} | ||
{org.clojure/clojure {:mvn/version "1.11.1"} | ||
|
||
http-kit/http-kit {:mvn/version "2.6.0-alpha1"} | ||
metosin/reitit-core {:mvn/version "0.5.15"} | ||
metosin/reitit-ring {:mvn/version "0.5.15"} | ||
http-kit/http-kit {:mvn/version "2.6.0"} | ||
metosin/reitit-core {:mvn/version "0.5.18"} | ||
metosin/reitit-ring {:mvn/version "0.5.18"} | ||
|
||
org.xerial/sqlite-jdbc {:mvn/version "3.36.0.2"} | ||
org.xerial/sqlite-jdbc {:mvn/version "3.40.0.0"} | ||
seancorfield/next.jdbc {:mvn/version "1.2.659"} | ||
|
||
fr.acinq.secp256k1/secp256k1-kmp {:mvn/version "0.6.2"} | ||
fr.acinq.secp256k1/secp256k1-kmp-jni-jvm {:mvn/version "0.6.2"} | ||
fr.acinq.secp256k1/secp256k1-kmp {:mvn/version "0.7.0"} | ||
fr.acinq.secp256k1/secp256k1-kmp-jni-jvm {:mvn/version "0.7.0"} | ||
|
||
metosin/jsonista {:mvn/version "0.3.5"} | ||
clj-commons/clj-yaml {:mvn/version "0.7.107"} | ||
metosin/jsonista {:mvn/version "0.3.7"} | ||
clj-commons/clj-yaml {:mvn/version "1.0.26"} | ||
|
||
com.google.guava/guava {:mvn/version "31.0.1-jre"} | ||
com.google.guava/guava {:mvn/version "31.1-jre"} | ||
|
||
metrics-clojure/metrics-clojure {:mvn/version "2.10.0"} | ||
metrics-clojure-jvm/metrics-clojure-jvm {:mvn/version "2.10.0"} | ||
io.dropwizard.metrics/metrics-json {:mvn/version "3.2.2"} | ||
io.dropwizard.metrics/metrics-json {:mvn/version "4.2.13"} | ||
|
||
org.clojure/tools.logging {:mvn/version "1.2.4"} | ||
ch.qos.logback/logback-classic {:mvn/version "1.2.10"}} | ||
ch.qos.logback/logback-classic {:mvn/version "1.4.5"}} | ||
|
||
:aliases | ||
{:test {:extra-paths ["test"] | ||
:extra-deps {io.github.cognitect-labs/test-runner | ||
{:git/tag "v0.5.0" :git/sha "b3fd0d2"} | ||
org.clojure/test.check {:mvn/version "1.1.1"} | ||
org.clojure/data.csv {:mvn/version "1.0.0"}} | ||
org.clojure/data.csv {:mvn/version "1.0.1"}} | ||
:main-opts ["-m" "cognitect.test-runner"] | ||
:exec-fn cognitect.test-runner.api/test} | ||
:perf {:extra-deps {criterium/criterium {:mvn/version "0.4.6"} | ||
com.clojure-goes-fast/clj-async-profiler {:mvn/version "0.5.1"}}} | ||
com.clojure-goes-fast/clj-async-profiler {:mvn/version "1.0.3"}}} | ||
:hacking {:extra-deps | ||
{org.bouncycastle/bcprov-jdk15on {:mvn/version "1.70"} | ||
org.graalvm.js/js {:mvn/version "22.0.0"}}} | ||
org.graalvm.js/js {:mvn/version "22.2.0"}}} | ||
:uberdeps {:replace-deps {uberdeps/uberdeps {:mvn/version "1.1.2"}} | ||
:replace-paths [] | ||
:main-opts ["-m" "uberdeps.uberjar"]}}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(ns me.untethr.nostr.common | ||
(:require [clojure.set :as set])) | ||
|
||
(defn indexable-tag-str?* | ||
[^String s] | ||
;; for now, we'll only index single lowercase ascii character tags, though | ||
;; nip-12 specifies ambiguous "single-letter key"; we'll also reject queries | ||
;; that don't use lowercase ascii for generic tags. | ||
;; @see https://github.com/nostr-protocol/nips/blob/master/12.md | ||
(.matches s "[a-z]")) | ||
|
||
(def allowed-filter-tag-queries-set | ||
(into #{} | ||
(comp (map char) (map #(str "#" %)) (map keyword)) | ||
(range (int \a) (inc (int \z))))) | ||
|
||
(def allow-filter-tag-queries-sans-e-and-p-set | ||
(set/difference allowed-filter-tag-queries-set #{:#e :#p})) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(ns me.untethr.nostr.json-facade | ||
(:require | ||
[jsonista.core :as json] | ||
[me.untethr.nostr.metrics :as metrics])) | ||
|
||
(def json-mapper | ||
(json/object-mapper | ||
{:encode-key-fn name | ||
:decode-key-fn keyword | ||
:modules [(metrics/create-jackson-metrics-module)]})) | ||
|
||
(defn parse | ||
[payload] | ||
(json/read-value payload json-mapper)) | ||
|
||
(defn write-str* | ||
^String [o] | ||
(json/write-value-as-string o json-mapper)) |
Oops, something went wrong.