Changed license to GPLv2
The virality of the GPL is a feature, not a bug. This is really, really, really not going to be part of anyone's proprietary software. If you want to use any of this as part of anything else, that thing must also be free.
This commit is contained in:
parent
a599d133f4
commit
032dcb7536
5 changed files with 314 additions and 256 deletions
|
|
@ -3,6 +3,22 @@
|
|||
;;(:require [clojure.spec.alpha as s])
|
||||
(:import [java.net URI URISyntaxException]))
|
||||
|
||||
;;; Copyright (C) Simon Brooke, 2022
|
||||
|
||||
;;; This program is free software; you can redistribute it and/or
|
||||
;;; modify it under the terms of the GNU General Public License
|
||||
;;; as published by the Free Software Foundation; either version 2
|
||||
;;; of the License, or (at your option) any later version.
|
||||
|
||||
;;; This program is distributed in the hope that it will be useful,
|
||||
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;;; GNU General Public License for more details.
|
||||
|
||||
;;; You should have received a copy of the GNU General Public License
|
||||
;;; along with this program; if not, write to the Free Software
|
||||
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
(defn object?
|
||||
"Return `true` iff `x` is recognisably an ActivityStreams object.
|
||||
|
||||
|
|
|
|||
|
|
@ -1,20 +1,45 @@
|
|||
(ns dog-and-duck.scratch.parser
|
||||
(:require [clojure.walk :refer [keywordize-keys]]
|
||||
(:require [clojure.java.io :refer [file]]
|
||||
[clojure.string :refer [ends-with?]]
|
||||
[clojure.walk :refer [keywordize-keys]]
|
||||
[clojure.data.json :as json]
|
||||
[dog-and-duck.quack.quack :as q]))
|
||||
|
||||
(defn clean
|
||||
;;; Copyright (C) Simon Brooke, 2022
|
||||
|
||||
;;; This program is free software; you can redistribute it and/or
|
||||
;;; modify it under the terms of the GNU General Public License
|
||||
;;; as published by the Free Software Foundation; either version 2
|
||||
;;; of the License, or (at your option) any later version.
|
||||
|
||||
;;; This program is distributed in the hope that it will be useful,
|
||||
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;;; GNU General Public License for more details.
|
||||
|
||||
;;; You should have received a copy of the GNU General Public License
|
||||
;;; along with this program; if not, write to the Free Software
|
||||
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
(defn clean
|
||||
"Take this `json` input, and return a sequence of ActivityPub objects
|
||||
represented by it."
|
||||
[json]
|
||||
(let [feed (json/read-str json)]
|
||||
(filter
|
||||
q/object?
|
||||
(cond (map? feed) (list (keywordize-keys feed))
|
||||
(coll? feed) (map keywordize-keys feed)))))
|
||||
(map
|
||||
keywordize-keys
|
||||
(filter
|
||||
q/object?
|
||||
(cond (map? feed) (list (keywordize-keys feed))
|
||||
(coll? feed) (map keywordize-keys feed))))))
|
||||
|
||||
(map :type (map keywordize-keys (json/read-str (slurp "resources/feed.json"))))
|
||||
(clean (slurp "resources/activitystreams-test-documents/core-ex1-jsonld.json"))
|
||||
|
||||
(keys (first (map keywordize-keys (json/read-str (slurp "resources/feed.json")))))
|
||||
|
||||
(q/object? (first (map keywordize-keys (json/read-str (slurp "resources/feed.json")))))
|
||||
(map
|
||||
#(when
|
||||
(ends-with? (str %) ".json")
|
||||
(let [objects (clean (slurp %))]
|
||||
(list (str %)
|
||||
(count objects)
|
||||
(map :type objects))))
|
||||
(file-seq (file "resources/activitystreams-test-documents")))
|
||||
|
|
|
|||
|
|
@ -8,6 +8,22 @@
|
|||
[clojure.walk :refer [keywordize-keys]]
|
||||
[clojure.pprint :refer [pprint]]))
|
||||
|
||||
;;; Copyright (C) Simon Brooke, 2022
|
||||
|
||||
;;; This program is free software; you can redistribute it and/or
|
||||
;;; modify it under the terms of the GNU General Public License
|
||||
;;; as published by the Free Software Foundation; either version 2
|
||||
;;; of the License, or (at your option) any later version.
|
||||
|
||||
;;; This program is distributed in the hope that it will be useful,
|
||||
;;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
;;; GNU General Public License for more details.
|
||||
|
||||
;;; You should have received a copy of the GNU General Public License
|
||||
;;; along with this program; if not, write to the Free Software
|
||||
;;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
;;; Use any ActivityPub account handle you like - for example, your own
|
||||
(def account-handle "@simon_brooke@mastodon.scot")
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue