Compare commits
No commits in common. "86b8d0a5144a95b24292d640122a9877605fd6f3" and "ce557da89ccf47bde249b57f8fb16d886f90b40b" have entirely different histories.
86b8d0a514
...
ce557da89c
|
@ -9,41 +9,31 @@
|
|||
:homepage "https://hak.xwx.moe/jadedctrl/activity-servist"
|
||||
|
||||
:in-order-to ((test-op (test-op "activitypub/tests")))
|
||||
:depends-on (:activity-servist/signatures
|
||||
:alexandria :clack :dexador
|
||||
:local-time :purl :str :webtentacle :yason)
|
||||
:depends-on ("activity-servist/signatures"
|
||||
"alexandria" "clack" "dexador"
|
||||
"local-time" "purl" "str" "webtentacle" "yason")
|
||||
:components ((:file "src/activity-servist")))
|
||||
|
||||
|
||||
(asdf:defsystem "activity-servist/vocab"
|
||||
:version "0.0"
|
||||
:license "AGPLv3"
|
||||
:description "A-S subpackage providing a standard vocabulary for ActivityPub programs."
|
||||
:author "Jaidyn Ann <jadedctrl@posteo.at>"
|
||||
:homepage "https://hak.xwx.moe/jadedctrl/activity-servist"
|
||||
|
||||
:depends-on (:activity-servist/vocab/activity :activity-servist/vocab/litepub))
|
||||
|
||||
|
||||
(asdf:defsystem "activity-servist/vocab/activity"
|
||||
(asdf:defsystem "activity-servist/activity-vocabulary"
|
||||
:version "0.0"
|
||||
:license "AGPLv3"
|
||||
:description "A-S subpackage containing ActivityVocabulary class-definitions."
|
||||
:author "Jaidyn Ann <jadedctrl@posteo.at>"
|
||||
:homepage "https://hak.xwx.moe/jadedctrl/activity-servist"
|
||||
|
||||
:depends-on (:activity-servist/json-ld)
|
||||
:depends-on ("activity-servist/json-ld")
|
||||
:components ((:file "src/activity-vocabulary")))
|
||||
|
||||
|
||||
(asdf:defsystem "activity-servist/vocab/litepub"
|
||||
(asdf:defsystem "activity-servist/litepub"
|
||||
:version "0.0"
|
||||
:license "AGPLv3"
|
||||
:description "A-S subpackage providing an expanded vocabulary."
|
||||
:author "Jaidyn Ann <jadedctrl@posteo.at>"
|
||||
:homepage "https://hak.xwx.moe/jadedctrl/activity-servist"
|
||||
|
||||
:depends-on (:activity-servist/vocab/activity)
|
||||
:depends-on ("activity-servist/activity-vocabulary")
|
||||
:components ((:file "src/litepub")))
|
||||
|
||||
|
||||
|
@ -54,7 +44,7 @@
|
|||
:author "Jaidyn Ann <jadedctrl@posteo.at>"
|
||||
:homepage "https://hak.xwx.moe/jadedctrl/activity-servist"
|
||||
|
||||
:depends-on (:alexandria :dexador :str :yason)
|
||||
:depends-on ("alexandria" "dexador" "str" "yason")
|
||||
:components ((:file "src/json-ld")))
|
||||
|
||||
|
||||
|
@ -65,22 +55,21 @@
|
|||
:author "Jaidyn Ann <jadedctrl@posteo.at>"
|
||||
:homepage "https://hak.xwx.moe/jadedctrl/activity-servist"
|
||||
|
||||
:depends-on (:cl-base64 :flexi-streams :inferior-shell :ironclad :str)
|
||||
:depends-on ("cl-base64" "flexi-streams" "inferior-shell" "ironclad" "str")
|
||||
:components ((:file "src/signatures")))
|
||||
|
||||
|
||||
|
||||
;;; Tests
|
||||
;;; —————————————————————————————————————
|
||||
(asdf:defsystem "activity-servist/tests/vocab/activity"
|
||||
(asdf:defsystem "activity-servist/tests/activity-vocabulary"
|
||||
:version "0.0"
|
||||
:license "AGPLv3"
|
||||
:author "Jaidyn Ann <jadedctrl@posteo.at>"
|
||||
:description "Tests the activity-servist/vocab/activity package, and indirectly /json-ld."
|
||||
:description "Tests the activity-servist/activity-vocabulary package, and indirectly /json-ld."
|
||||
|
||||
:depends-on (:activity-servist/vocab/activity
|
||||
:alexandria :lisp-unit2)
|
||||
:components ((:file "t/vocab/activity")))
|
||||
:depends-on (:activity-servist/activity-vocabulary :alexandria :lisp-unit2)
|
||||
:components ((:file "t/activity-vocabulary")))
|
||||
|
||||
|
||||
(asdf:defsystem "activity-servist/tests/signatures"
|
||||
|
@ -89,8 +78,7 @@
|
|||
:author "Jaidyn Ann <jadedctrl@posteo.at>"
|
||||
:description "Tests for the the activity-servist/signatures package."
|
||||
|
||||
:depends-on (:activity-servist/signatures
|
||||
:lisp-unit2)
|
||||
:depends-on (:activity-servist/signatures :lisp-unit2)
|
||||
:components ((:file "t/signatures")))
|
||||
|
||||
|
||||
|
@ -100,7 +88,7 @@
|
|||
:author "Jaidyn Ann <jadedctrl@posteo.at>"
|
||||
:description "Tests for all activity-servist subpacakges."
|
||||
|
||||
:depends-on (:activity-servist/tests/vocab/activity
|
||||
:depends-on (:activity-servist/tests/activity-vocabulary
|
||||
:activity-servist/tests/signatures
|
||||
:alexandria :lisp-unit2)
|
||||
:components ((:file "t/t")))
|
||||
|
@ -112,6 +100,6 @@
|
|||
`(defmethod asdf:perform ((o asdf:test-op) (c (eql (asdf:find-system ',package))))
|
||||
(eval (read-from-string (format nil "(~A:run-with-summary)" ',package)))))
|
||||
|
||||
(define-asdf-testing activity-servist/tests/vocab/activity)
|
||||
(define-asdf-testing activity-servist/tests/activity-vocabulary)
|
||||
(define-asdf-testing activity-servist/tests/signatures)
|
||||
(define-asdf-testing activity-servist/tests)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;;; activity-vocabulary: Base vocabulary classes for ActivityStreams.
|
||||
;;;; activity-vocabulary: Base classes for ActivityStreams.
|
||||
|
||||
;; Copyright © 2024 Jaidyn Ann <jadedctrl@posteo.at>
|
||||
;;
|
||||
|
@ -15,9 +15,9 @@
|
|||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
(defpackage #:activity-servist/vocab/activity
|
||||
(defpackage #:activity-servist/activity-vocabulary
|
||||
(:use #:cl)
|
||||
(:nicknames "AS/V/A" "ACTIVITY-VOCABULARY")
|
||||
(:nicknames "AS/AV" "ACTIVITY-VOCABULARY")
|
||||
(:shadow #:block #:delete #:ignore #:listen #:read #:remove)
|
||||
;; One should never USE this package, since some class-names shadow
|
||||
;; core Common Lisp symbols! Beware! :P
|
||||
|
@ -53,7 +53,7 @@
|
|||
:relationship-object :relationship-relationship :relationship-subject
|
||||
:tombstone-former-type :tombstone-deleted))
|
||||
|
||||
(in-package #:activity-servist/vocab/activity)
|
||||
(in-package #:activity-servist/activity-vocabulary)
|
||||
|
||||
(defmacro define-json-empty-types (superclass context &rest direct-children)
|
||||
"For each list of DIRECT-CHILDREN, a “hollow” JSON subtype and CLOS subclass
|
||||
|
@ -176,10 +176,10 @@ The notion of “context” used is intentionally vague. The intended function i
|
|||
;; looking at Link’s properties), but it’s implied by the Mention example.
|
||||
(json-ld:define-json-type (link "Link") ()
|
||||
"https://www.w3.org/ns/activitystreams"
|
||||
((json-ld:@id
|
||||
((@id
|
||||
"id"
|
||||
:documentation "Provides the globally unique identifier for a Link.")
|
||||
(json-ld:@type
|
||||
(@type
|
||||
"type"
|
||||
:documentation "Identifies the Link type. Multiple values may be specified.")
|
||||
(height
|
||||
|
|
|
@ -44,19 +44,9 @@ For example: “https://www.w3.org/ns/activitystreams#Object”
|
|||
|
||||
The default value “*” refers to the base JSON-LD-OBJECT type.")
|
||||
|
||||
(defvar *json-types* (make-hash-table :test #'equal)
|
||||
"Stores descriptions of each JSON-type, mapping type-IRI to class-name and property-name to slot-name.
|
||||
Used during encoding an object to JSON, for finding type/property-names from class/slot-names.
|
||||
Keys are the type-IRI (e.g., (“https://www.w3.org/ns/activitystreams#Accept”), and values are an irregular association list, of the form:
|
||||
((CLASS-NAME-SYMBOL . TYPE-NAME) (PROPERTY-IRI SLOT-NAME-SYMBOL . PROPERTY-NAME) ⋯)")
|
||||
|
||||
(defvar *class-defs* (make-hash-table)
|
||||
"Stores the slot definitions of classes, stored directly from DEFINE-JSON-TYPE.
|
||||
Used for the :UPDATE feature of DEFINE-JSON-TYPE, so you can add a slot to a pre-existing class without having to redefine the old slots.")
|
||||
|
||||
(defvar *http-cache* (make-hash-table :test #'equal)
|
||||
"Caches context-texts fetched over HTTP.
|
||||
Maps URLs to text-content, so we don’t have to download the same context again and again.")
|
||||
(defvar *http-cache* (make-hash-table :test #'equal))
|
||||
(defvar *json-types* (make-hash-table :test #'equal))
|
||||
(defvar *class-defs* (make-hash-table))
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -15,11 +15,11 @@
|
|||
;; You should have received a copy of the GNU General Public License
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
(defpackage #:activity-servist/vocab/litepub
|
||||
(defpackage #:activity-servist/litepub
|
||||
(:use #:cl)
|
||||
(:nicknames "AS/V/LP" "LITEPUB"))
|
||||
(:nicknames "AS/LP" "LITEPUB"))
|
||||
|
||||
(in-package #:activity-servist/vocab/litepub)
|
||||
(in-package #:activity-servist/litepub)
|
||||
|
||||
|
||||
;;; Globals
|
||||
|
@ -38,7 +38,7 @@ Defaults to a copy at jam.xwx.moe — because why not? ¯\_(ツ)_/¯")
|
|||
()
|
||||
(:documentation "The base class used for Litepub objects."))
|
||||
|
||||
(json-ld:define-json-type (as/v/a:object "Object") (as/jld::json-ld-object litepub-object) *litepub-uri*
|
||||
(json-ld:define-json-type (as/av:object "Object") (as/jld::json-ld-object litepub-object) *litepub-uri*
|
||||
((atom-uri
|
||||
"atomUri"
|
||||
:documentation "A string containing a URI to an Atom-feed alternative representation of an object.
|
||||
|
@ -60,7 +60,7 @@ Seemingly may be set in the Activity modifying the Note, or the Note itself.")
|
|||
(:update 't))
|
||||
|
||||
|
||||
(json-ld:define-json-type (as/v/a:activity "Activity") (as/v/a:object) *litepub-uri*
|
||||
(json-ld:define-json-type (as/av:activity "Activity") (as/av:object) *litepub-uri*
|
||||
(;; https://blog.dereferenced.org/leveraging-json-ld-compound-typing-for-behavioural-hinting-in-activitypub
|
||||
(invisible
|
||||
"invisible"
|
||||
|
@ -86,7 +86,7 @@ Potentially deprecated/very uncommon.")
|
|||
|
||||
;;; Extended Activity types
|
||||
;;; ————————————————————————————————————————
|
||||
(json-ld:define-json-type (as/v/a:update "Update") (as/v/a:activity) *litepub-uri*
|
||||
(json-ld:define-json-type (as/av:update "Update") (as/av:activity) *litepub-uri*
|
||||
(;; https://ostatus.github.io/spec/OStatus%201.0%20Draft%202.html#rfc.section.6
|
||||
(conversation
|
||||
"conversation"
|
||||
|
@ -98,7 +98,7 @@ The target and origin typically have no defined meaning.")
|
|||
|
||||
|
||||
;; https://codeberg.org/fediverse/fep/src/branch/main/fep/c0e0/fep-c0e0.md
|
||||
(json-ld:define-json-type (emoji-react "EmojiReact") (as/v/a:like) *litepub-uri*
|
||||
(json-ld:define-json-type (emoji-react "EmojiReact") (as/av:like) *litepub-uri*
|
||||
()
|
||||
(:documentation "This activity is similar to Like activity. In addition to standard properties of Like activity, EmojiReact activity MUST have a content property. Reaction content MUST be either a single unicode grapheme, or a shortcode of a custom emoji. If custom emoji is used, EmojiReact activity MUST have a tag property containing a single Emoji object."))
|
||||
|
||||
|
@ -106,12 +106,8 @@ The target and origin typically have no defined meaning.")
|
|||
|
||||
;;; Extended Actor types
|
||||
;;; ————————————————————————————————————————
|
||||
(json-ld:define-json-type (as/v/a:person "Person") (as/v/a:object) *litepub-uri*
|
||||
(json-ld:define-json-type (as/av:person "Person") (as/av:object) *litepub-uri*
|
||||
(;; https://docs.joinmastodon.org/spec/activitypub/#discoverable
|
||||
(public-key
|
||||
"publicKey"
|
||||
:documentation "Contains an object representing a definition of the user’s public key, used for HTTP signatures.
|
||||
Generally contains the properties “id”, “owner”, “publicKeyPem”.")
|
||||
(discoverable
|
||||
"discoverable"
|
||||
:documentation "A boolean value reflecting whether or not a profile should be publically discoverable.")
|
||||
|
@ -135,12 +131,12 @@ One known capabilitity-name is Pleroma’s “acceptsChatMessages”."))
|
|||
;;; Extended Object types
|
||||
;;; ————————————————————————————————————————
|
||||
;; https://docs.joinmastodon.org/spec/activitypub/#Emoji
|
||||
(json-ld:define-json-type (emoji "Emoji") (as/v/a:object) *litepub-uri*
|
||||
(json-ld:define-json-type (emoji "Emoji") (as/av:object) *litepub-uri*
|
||||
()
|
||||
(:documentation "Represents a custom-emoji, with a shortcode (NAME), ID, and ICON (containing MEDIA-TYPE and URL)."))
|
||||
|
||||
|
||||
(json-ld:define-json-type (as/v/a:note "Note") (as/v/a:object) *litepub-uri*
|
||||
(json-ld:define-json-type (as/av:note "Note") (as/av:object) *litepub-uri*
|
||||
(;; https://misskey-hub.net/ns#_misskey_quote
|
||||
(quote-url
|
||||
"quoteUrl"
|
||||
|
@ -162,7 +158,7 @@ It is, however, unclear which one will win out in the end. The implementer prefe
|
|||
|
||||
|
||||
;; https://docs-develop.pleroma.social/backend/development/ap_extensions/#chatmessages
|
||||
(json-ld:define-json-type (chat-message "ChatMessage") (as/v/a:note) *litepub-uri*
|
||||
(json-ld:define-json-type (chat-message "ChatMessage") (as/av:note) *litepub-uri*
|
||||
()
|
||||
(:documentation "Represents a private and one-on-one chat-message.
|
||||
Similar to Notes in creation and use, but TO may contain only one recipient.
|
||||
|
@ -174,12 +170,12 @@ Potentially very uncommon — it is used by at least Pleroma."))
|
|||
Will set/get the value of either QUOTE-URL or QUOTE-URI, depending on which is currently in use.
|
||||
In case of doubt, QUOTE-URL is preferred."))
|
||||
|
||||
(defmethod note-quote-url ((obj as/v/a:note))
|
||||
(defmethod note-quote-url ((obj as/av:note))
|
||||
(or (and (slot-boundp note 'quote-url) (slot-value note 'quote-url))
|
||||
(and (slot-boundp note 'quote-uri) (slot-value note 'quote-uri))))
|
||||
|
||||
(defgeneric (setf note-quote-url) (obj value))
|
||||
(defmethod (setf note-quote-url) ((obj as/v/a:note) value)
|
||||
(defmethod (setf note-quote-url) ((obj as/av:note) value)
|
||||
(if (slot-boundp note 'quote-uri)
|
||||
(setf (slot-value note 'quote-uri) value)
|
||||
(setf (slot-value note 'quote-url) value)))
|
||||
|
@ -189,6 +185,6 @@ In case of doubt, QUOTE-URL is preferred."))
|
|||
;;; Extended Link types
|
||||
;;; ————————————————————————————————————————
|
||||
;; https://docs.joinmastodon.org/spec/activitypub/#Hashtag
|
||||
(json-ld:define-json-type (hashtag "Hashtag") (as/v/a:link litepub-object) *litepub-uri*
|
||||
(json-ld:define-json-type (hashtag "Hashtag") (as/av:link litepub-object) *litepub-uri*
|
||||
()
|
||||
(:documentation "Similar to Mentions, a Hashtag is used to link a post to given topics. Should be stored in a TAG slot, and contain NAME (#hashtag) and HREF (link to a server’s hashtag listing)."))
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
;;;; activity-servist/tests/vocab/activity: Testing activity-vocabulary.
|
||||
;;;; activity-servist/tests/activity-vocabulary: Testing activity-vocabulary.
|
||||
|
||||
;; Copyright © 2024 Jaidyn Levesque <jadedctrl@posteo.at>
|
||||
;;
|
||||
|
@ -15,17 +15,17 @@
|
|||
;; You should have received a copy of the GNU Affero General Public License
|
||||
;; along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
(defpackage :activity-servist/tests/vocab/activity
|
||||
(defpackage :activity-servist/tests/activity-vocabulary
|
||||
(:use :cl :lisp-unit2)
|
||||
(:nicknames "AS/T/V/AV")
|
||||
(:nicknames "AS/T/AV")
|
||||
(:export :run :run-with-summary))
|
||||
|
||||
(in-package :activity-servist/tests/vocab/activity)
|
||||
(in-package :activity-servist/tests/activity-vocabulary)
|
||||
|
||||
(defun run ()
|
||||
"Run all ACTIVITY-VOCABULARY tests."
|
||||
(let ((json-ld:*default-json-type* "https://www.w3.org/ns/activitystreams#Object"))
|
||||
(lisp-unit2:run-tests :package :activity-servist/tests/vocab/activity)))
|
||||
(lisp-unit2:run-tests :package :activity-servist/tests/activity-vocabulary)))
|
||||
|
||||
(defun run-with-summary ()
|
||||
"Run tests with summary for ACTIVITY-VOCABULARY."
|
||||
|
@ -38,7 +38,7 @@
|
|||
;;; ————————————————————————————————————————
|
||||
(defmacro relative-pathname (path)
|
||||
"Return an absolute path adding the relative PATH to the system’s path."
|
||||
`(asdf:system-relative-pathname :activity-servist/tests/vocab/activity ,path))
|
||||
`(asdf:system-relative-pathname :activity-servist/tests/activity-vocabulary ,path))
|
||||
|
||||
(defmacro define-json-test (path tags)
|
||||
"Define a lisp-unit2 test for parsing of the given JSON file.
|
||||
|
@ -92,4 +92,4 @@ Any nested hash-tables found as values are also sorted, recursively."
|
|||
(mapcar (lambda (file)
|
||||
(eval `(define-json-test ,file '(:activity-vocabulary))))
|
||||
(uiop:directory-files
|
||||
(relative-pathname "t/vocab/activity/")))
|
||||
(relative-pathname "t/activity-vocabulary/")))
|
2
t/t.lisp
2
t/t.lisp
|
@ -25,7 +25,7 @@
|
|||
(defun run ()
|
||||
"Run tests from all activity-servist subpackages."
|
||||
(activity-servist/tests/signatures:run)
|
||||
(activity-servist/tests/vocab/activity:run))
|
||||
(activity-servist/tests/activity-vocabulary:run))
|
||||
|
||||
(defun run-with-summary ()
|
||||
"Run tests with summary for all activity-servist subpackages."
|
||||
|
|
Ŝarĝante…
Reference in New Issue