はじまりの大地

このコミットが含まれているのは:
2024-07-15 09:14:04 +09:00
コミット 6632905f32
3501個のファイルの変更1439465行の追加0行の削除
+156
ファイルの表示
@@ -0,0 +1,156 @@
import { ActivityPubActor } from './activitypub-actor.js'
import { ActivityPubSignature } from './activitypub-signature.js'
import {
ActivityFlagReasonObject,
ActivityObject,
APObjectId,
CacheFileObject,
PlaylistObject,
VideoCommentObject,
VideoObject,
WatchActionObject
} from './objects/index.js'
export type ActivityUpdateObject =
Extract<ActivityObject, VideoObject | CacheFileObject | PlaylistObject | ActivityPubActor | string> | ActivityPubActor
// Cannot Extract from Activity because of circular reference
export type ActivityUndoObject =
ActivityFollow | ActivityLike | ActivityDislike | ActivityCreate<CacheFileObject | string> | ActivityAnnounce
export type ActivityCreateObject =
Extract<ActivityObject, VideoObject | CacheFileObject | WatchActionObject | VideoCommentObject | PlaylistObject | string>
export type Activity =
ActivityCreate<ActivityCreateObject> |
ActivityUpdate<ActivityUpdateObject> |
ActivityDelete |
ActivityFollow |
ActivityAccept |
ActivityAnnounce |
ActivityUndo<ActivityUndoObject> |
ActivityLike |
ActivityReject |
ActivityView |
ActivityDislike |
ActivityFlag |
ActivityApproveReply |
ActivityRejectReply
export type ActivityType =
'Create' |
'Update' |
'Delete' |
'Follow' |
'Accept' |
'Announce' |
'Undo' |
'Like' |
'Reject' |
'View' |
'Dislike' |
'Flag' |
'ApproveReply' |
'RejectReply'
export interface ActivityAudience {
to: string[]
cc: string[]
}
export interface BaseActivity {
'@context'?: any[]
id: string
to?: string[]
cc?: string[]
actor: string | ActivityPubActor
type: ActivityType
signature?: ActivityPubSignature
}
export interface ActivityCreate <T extends ActivityCreateObject> extends BaseActivity {
type: 'Create'
object: T
}
export interface ActivityUpdate <T extends ActivityUpdateObject> extends BaseActivity {
type: 'Update'
object: T
}
export interface ActivityDelete extends BaseActivity {
type: 'Delete'
object: APObjectId
}
export interface ActivityFollow extends BaseActivity {
type: 'Follow'
object: string
}
export interface ActivityAccept extends BaseActivity {
type: 'Accept'
object: ActivityFollow
}
export interface ActivityApproveReply extends BaseActivity {
type: 'ApproveReply'
object: string
inReplyTo: string
}
export interface ActivityRejectReply extends BaseActivity {
type: 'RejectReply'
object: string
inReplyTo: string
}
export interface ActivityReject extends BaseActivity {
type: 'Reject'
object: ActivityFollow
}
export interface ActivityAnnounce extends BaseActivity {
type: 'Announce'
object: APObjectId
}
export interface ActivityUndo <T extends ActivityUndoObject> extends BaseActivity {
type: 'Undo'
object: T
}
export interface ActivityLike extends BaseActivity {
type: 'Like'
object: APObjectId
}
export interface ActivityView extends BaseActivity {
type: 'View'
actor: string
object: APObjectId
// If sending a "viewer" event
expires?: string
result?: {
type: 'InteractionCounter'
interactionType: 'WatchAction'
userInteractionCount: number
}
}
export interface ActivityDislike extends BaseActivity {
id: string
type: 'Dislike'
actor: string
object: APObjectId
}
export interface ActivityFlag extends BaseActivity {
type: 'Flag'
content: string
object: APObjectId | APObjectId[]
tag?: ActivityFlagReasonObject[]
startAt?: number
endAt?: number
}
+41
ファイルの表示
@@ -0,0 +1,41 @@
import { ActivityIconObject, ActivityPubAttributedTo } from './objects/common-objects.js'
export type ActivityPubActorType = 'Person' | 'Application' | 'Group' | 'Service' | 'Organization'
export interface ActivityPubActor {
'@context': any[]
type: ActivityPubActorType
id: string
following: string
followers: string
playlists?: string
inbox: string
outbox: string
preferredUsername: string
url: string
name: string
endpoints: {
sharedInbox: string
}
summary: string
attributedTo?: ActivityPubAttributedTo[]
support?: string
publicKey: {
id: string
owner: string
publicKeyPem: string
}
// Lemmy attribute for groups
postingRestrictedToMods?: boolean
image?: ActivityIconObject | ActivityIconObject[]
icon?: ActivityIconObject | ActivityIconObject[]
published?: string
// For export
likes?: string
dislikes?: string
}
+9
ファイルの表示
@@ -0,0 +1,9 @@
import { Activity } from './activity.js'
export interface ActivityPubCollection {
'@context': any[]
type: 'Collection' | 'CollectionPage'
totalItems: number
partOf?: string
items: Activity[]
}
+12
ファイルの表示
@@ -0,0 +1,12 @@
export interface ActivityPubOrderedCollection<T> {
id: string
'@context': any[]
type: 'OrderedCollection' | 'OrderedCollectionPage'
totalItems: number
orderedItems: T[]
partOf?: string
next?: string
first?: string
}
+5
ファイルの表示
@@ -0,0 +1,5 @@
import { Activity } from './activity.js'
import { ActivityPubCollection } from './activitypub-collection.js'
import { ActivityPubOrderedCollection } from './activitypub-ordered-collection.js'
export type RootActivity = Activity | ActivityPubCollection | ActivityPubOrderedCollection<Activity>
+6
ファイルの表示
@@ -0,0 +1,6 @@
export interface ActivityPubSignature {
type: string
created: Date
creator: string
signatureValue: string
}
+19
ファイルの表示
@@ -0,0 +1,19 @@
export type ContextType =
'Video' |
'Comment' |
'Playlist' |
'Follow' |
'Reject' |
'Accept' |
'View' |
'Announce' |
'CacheFile' |
'Delete' |
'Rate' |
'Flag' |
'Actor' |
'Collection' |
'WatchAction' |
'Chapters' |
'ApproveReply' |
'RejectReply'
+9
ファイルの表示
@@ -0,0 +1,9 @@
export * from './objects/index.js'
export * from './activity.js'
export * from './activitypub-actor.js'
export * from './activitypub-collection.js'
export * from './activitypub-ordered-collection.js'
export * from './activitypub-root.js'
export * from './activitypub-signature.js'
export * from './context.js'
export * from './webfinger.js'
+15
ファイルの表示
@@ -0,0 +1,15 @@
import { ActivityFlagReasonObject } from './common-objects.js'
export interface AbuseObject {
type: 'Flag'
content: string
mediaType: 'text/markdown'
object: string | string[]
tag?: ActivityFlagReasonObject[]
startAt?: number
endAt?: number
}
+17
ファイルの表示
@@ -0,0 +1,17 @@
import { AbuseObject } from './abuse-object.js'
import { CacheFileObject } from './cache-file-object.js'
import { PlaylistObject } from './playlist-object.js'
import { VideoCommentObject } from './video-comment-object.js'
import { VideoObject } from './video-object.js'
import { WatchActionObject } from './watch-action-object.js'
export type ActivityObject =
VideoObject |
AbuseObject |
VideoCommentObject |
CacheFileObject |
PlaylistObject |
WatchActionObject |
string
export type APObjectId = string | { id: string }
+9
ファイルの表示
@@ -0,0 +1,9 @@
import { ActivityVideoUrlObject, ActivityPlaylistUrlObject } from './common-objects.js'
export interface CacheFileObject {
id: string
type: 'CacheFile'
object: string
expires: string
url: ActivityVideoUrlObject | ActivityPlaylistUrlObject
}
+136
ファイルの表示
@@ -0,0 +1,136 @@
import { AbusePredefinedReasonsString } from '../../moderation/abuse/abuse-reason.model.js'
export interface ActivityIdentifierObject {
identifier: string
name: string
url?: string
}
export interface ActivityIconObject {
type: 'Image'
url: string
mediaType: string
width: number
height: number | null
}
export type ActivityVideoUrlObject = {
type: 'Link'
mediaType: 'video/mp4' | 'video/webm' | 'video/ogg' | 'audio/mp4'
href: string
height: number
width: number | null
size: number
fps: number
}
export type ActivityPlaylistSegmentHashesObject = {
type: 'Link'
name: 'sha256'
mediaType: 'application/json'
href: string
}
export type ActivityVideoFileMetadataUrlObject = {
type: 'Link'
rel: [ 'metadata', any ]
mediaType: 'application/json'
height: number
width: number | null
href: string
fps: number
}
export type ActivityTrackerUrlObject = {
type: 'Link'
rel: [ 'tracker', 'websocket' | 'http' ]
name: string
href: string
}
export type ActivityStreamingPlaylistInfohashesObject = {
type: 'Infohash'
name: string
}
export type ActivityPlaylistUrlObject = {
type: 'Link'
mediaType: 'application/x-mpegURL'
href: string
tag?: ActivityTagObject[]
}
export type ActivityBitTorrentUrlObject = {
type: 'Link'
mediaType: 'application/x-bittorrent' | 'application/x-bittorrent;x-scheme-handler/magnet'
href: string
height: number
width: number | null
fps: number | null
}
export type ActivityMagnetUrlObject = {
type: 'Link'
mediaType: 'application/x-bittorrent;x-scheme-handler/magnet'
href: string
height: number
width: number | null
fps: number | null
}
export type ActivityHtmlUrlObject = {
type: 'Link'
mediaType: 'text/html'
href: string
}
export interface ActivityHashTagObject {
type: 'Hashtag'
href?: string
name: string
}
export interface ActivityMentionObject {
type: 'Mention'
href?: string
name: string
}
export interface ActivityFlagReasonObject {
type: 'Hashtag'
name: AbusePredefinedReasonsString
}
export type ActivityTagObject =
ActivityPlaylistSegmentHashesObject
| ActivityStreamingPlaylistInfohashesObject
| ActivityVideoUrlObject
| ActivityHashTagObject
| ActivityMentionObject
| ActivityBitTorrentUrlObject
| ActivityMagnetUrlObject
| ActivityVideoFileMetadataUrlObject
export type ActivityUrlObject =
ActivityVideoUrlObject
| ActivityPlaylistUrlObject
| ActivityBitTorrentUrlObject
| ActivityMagnetUrlObject
| ActivityHtmlUrlObject
| ActivityVideoFileMetadataUrlObject
| ActivityTrackerUrlObject
export type ActivityPubAttributedTo = { type: 'Group' | 'Person', id: string } | string
export interface ActivityTombstoneObject {
'@context'?: any
id: string
url?: string
type: 'Tombstone'
name?: string
formerType?: string
inReplyTo?: string
published: string
updated: string
deleted: string
}
+11
ファイルの表示
@@ -0,0 +1,11 @@
export * from './abuse-object.js'
export * from './activitypub-object.js'
export * from './cache-file-object.js'
export * from './common-objects.js'
export * from './playlist-element-object.js'
export * from './playlist-object.js'
export * from './video-caption-object.js'
export * from './video-chapters-object.js'
export * from './video-comment-object.js'
export * from './video-object.js'
export * from './watch-action-object.js'
+10
ファイルの表示
@@ -0,0 +1,10 @@
export interface PlaylistElementObject {
id: string
type: 'PlaylistElement'
url: string
position: number
startTimestamp?: number
stopTimestamp?: number
}
+29
ファイルの表示
@@ -0,0 +1,29 @@
import { ActivityIconObject, ActivityPubAttributedTo } from './common-objects.js'
export interface PlaylistObject {
id: string
type: 'Playlist'
name: string
content: string
mediaType: 'text/markdown'
uuid: string
totalItems: number
attributedTo: ActivityPubAttributedTo[]
icon?: ActivityIconObject
published: string
updated: string
orderedItems?: string[]
partOf?: string
next?: string
first?: string
to?: string[]
}
+5
ファイルの表示
@@ -0,0 +1,5 @@
import { ActivityIdentifierObject } from './common-objects.js'
export interface VideoCaptionObject extends ActivityIdentifierObject {
automaticallyGenerated: boolean
}
+11
ファイルの表示
@@ -0,0 +1,11 @@
export interface VideoChaptersObject {
id: string
hasPart: VideoChapterObject[]
}
// Same as https://schema.org/hasPart
export interface VideoChapterObject {
name: string
startOffset: number
endOffset: number
}
+21
ファイルの表示
@@ -0,0 +1,21 @@
import { ActivityPubAttributedTo, ActivityTagObject } from './common-objects.js'
export interface VideoCommentObject {
type: 'Note'
id: string
content: string
mediaType: 'text/markdown'
inReplyTo: string
published: string
updated: string
url: string
attributedTo: ActivityPubAttributedTo
tag: ActivityTagObject[]
replyApproval: string | null
to?: string[]
cc?: string[]
}
+93
ファイルの表示
@@ -0,0 +1,93 @@
import { LiveVideoLatencyModeType, VideoCommentPolicyType, VideoStateType } from '../../videos/index.js'
import {
ActivityIconObject,
ActivityIdentifierObject,
ActivityPubAttributedTo,
ActivityTagObject,
ActivityUrlObject
} from './common-objects.js'
import { VideoCaptionObject } from './video-caption-object.js'
import { VideoChapterObject } from './video-chapters-object.js'
export interface VideoObject {
type: 'Video'
id: string
name: string
duration: string
uuid: string
tag: ActivityTagObject[]
category: ActivityIdentifierObject
licence: ActivityIdentifierObject
language: ActivityIdentifierObject
subtitleLanguage: VideoCaptionObject[]
views: number
sensitive: boolean
isLiveBroadcast: boolean
liveSaveReplay: boolean
permanentLive: boolean
latencyMode: LiveVideoLatencyModeType
commentsEnabled?: boolean
commentsPolicy: VideoCommentPolicyType
canReply: 'as:Public' | 'https://www.w3.org/ns/activitystreams#Public'
downloadEnabled: boolean
waitTranscoding: boolean
state: VideoStateType
published: string
originallyPublishedAt: string
updated: string
uploadDate: string
mediaType: 'text/markdown'
content: string
support: string
aspectRatio: number
icon: ActivityIconObject[]
url: ActivityUrlObject[]
likes: string
dislikes: string
shares: string
comments: string
hasParts: string | VideoChapterObject[]
attributedTo: ActivityPubAttributedTo[]
preview?: ActivityPubStoryboard[]
to?: string[]
cc?: string[]
// For export
attachment?: {
type: 'Video'
url: string
mediaType: string
height: number
size: number
fps: number
}[]
}
export interface ActivityPubStoryboard {
type: 'Image'
rel: [ 'storyboard' ]
url: {
href: string
mediaType: string
width: number
height: number
tileWidth: number
tileHeight: number
tileDuration: string
}[]
}
+23
ファイルの表示
@@ -0,0 +1,23 @@
export interface WatchActionObject {
id: string
type: 'WatchAction'
startTime: string
endTime: string
location?: {
addressCountry: string
addressRegion: string
}
uuid: string
object: string
actionStatus: 'CompletedActionStatus'
duration: string
watchSections: {
startTimestamp: number
endTimestamp: number
}[]
}
+9
ファイルの表示
@@ -0,0 +1,9 @@
export interface WebFingerData {
subject: string
aliases: string[]
links: {
rel: 'self'
type: 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
href: string
}[]
}