はじまりの大地
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"headers": {
|
||||
"user-agent": "http.rb/3.3.0 (Mastodon/2.5.0; +http://localhost:3000/)",
|
||||
"host": "localhost",
|
||||
"date": "Mon, 22 Oct 2018 13:34:22 GMT",
|
||||
"accept-encoding": "gzip",
|
||||
"digest": "SHA-256=FEr5j2WSSfdEMcG3NTOXuGU0lUchfTJx4+BtUlWOwDk=",
|
||||
"content-type": "application/activity+json",
|
||||
"signature": "keyId=\"http://localhost:3000/users/ronan2#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date digest content-type\",signature=\"oLKbgxdFXdXsHJ3x/UsG9Svu7oa8Dyqiy6Jif4wqNuhAqRVMRaG18f+dd2OcfFX3XRGF8p8flZkU6vvoEQBauTwGRGcgXAJuKC1zYIWGk+PeiW8lNUnE4qGapWcTiFnIo7FKauNdsgqg/tvgs1pQIdHkDDjZMI64twP7sTN/4vG1PCq+kyqi/DM+ORLi/W7vFuLVHt2Iz7ikfw/R3/mMtS4FwLops+tVYBQ2iQ9DVRhTwLKVbeL/LLVB/tdGzNZ4F4nImBAQQ9I7WpPM6J/k+cBmoEbrUKs8ptx9gbX3OSsl5wlvPVMNzU9F9yb2MrB/Y/J4qssKz+LbiaktKGj7OQ==\"",
|
||||
"content-length": "2815"
|
||||
},
|
||||
"body": {
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1",
|
||||
{
|
||||
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||
"sensitive": "as:sensitive",
|
||||
"movedTo": {
|
||||
"@id": "as:movedTo",
|
||||
"@type": "@id"
|
||||
},
|
||||
"Hashtag": "as:Hashtag",
|
||||
"ostatus": "http://ostatus.org#",
|
||||
"atomUri": "ostatus:atomUri",
|
||||
"inReplyToAtomUri": "ostatus:inReplyToAtomUri",
|
||||
"conversation": "ostatus:conversation",
|
||||
"toot": "http://joinmastodon.org/ns#",
|
||||
"Emoji": "toot:Emoji",
|
||||
"focalPoint": {
|
||||
"@container": "@list",
|
||||
"@id": "toot:focalPoint"
|
||||
},
|
||||
"featured": {
|
||||
"@id": "toot:featured",
|
||||
"@type": "@id"
|
||||
},
|
||||
"schema": "http://schema.org#",
|
||||
"PropertyValue": "schema:PropertyValue",
|
||||
"value": "schema:value"
|
||||
}
|
||||
],
|
||||
"id": "http://localhost:3000/users/ronan2/statuses/100939547203370948/activity",
|
||||
"type": "Create",
|
||||
"actor": "http://localhost:3000/users/ronan2",
|
||||
"published": "2018-10-22T13:34:18Z",
|
||||
"to": [
|
||||
"https://www.w3.org/ns/activitystreams#Public"
|
||||
],
|
||||
"cc": [
|
||||
"http://localhost:3000/users/ronan2/followers",
|
||||
"http://localhost:9000/accounts/ronan"
|
||||
],
|
||||
"object": {
|
||||
"id": "http://localhost:3000/users/ronan2/statuses/100939547203370948",
|
||||
"type": "Note",
|
||||
"summary": null,
|
||||
"inReplyTo": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752",
|
||||
"published": "2018-10-22T13:34:18Z",
|
||||
"url": "http://localhost:3000/@ronan2/100939547203370948",
|
||||
"attributedTo": "http://localhost:3000/users/ronan2",
|
||||
"to": [
|
||||
"https://www.w3.org/ns/activitystreams#Public"
|
||||
],
|
||||
"cc": [
|
||||
"http://localhost:3000/users/ronan2/followers",
|
||||
"http://localhost:9000/accounts/ronan"
|
||||
],
|
||||
"sensitive": false,
|
||||
"atomUri": "http://localhost:3000/users/ronan2/statuses/100939547203370948",
|
||||
"inReplyToAtomUri": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752",
|
||||
"conversation": "tag:localhost:3000,2018-10-19:objectId=72:objectType=Conversation",
|
||||
"content": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zergzerg</p>",
|
||||
"contentMap": {
|
||||
"en": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zergzerg</p>"
|
||||
},
|
||||
"attachment": [],
|
||||
"tag": [
|
||||
{
|
||||
"type": "Mention",
|
||||
"href": "http://localhost:9000/accounts/ronan",
|
||||
"name": "@ronan@localhost:9000"
|
||||
}
|
||||
]
|
||||
},
|
||||
"signature": {
|
||||
"type": "RsaSignature2017",
|
||||
"creator": "http://localhost:3000/users/ronan2#main-key",
|
||||
"created": "2018-10-22T13:34:19Z",
|
||||
"signatureValue": "x+xL4l8ERziYVhwEafHJyBQOInvNZ0gV4ccYd9AtFYeGJagc8fY6jjjhbDRCD7yMhgTjBX69z20MXnDuwpmM6wej3dt1wLKdIyXVViO84nAlqFz7KmNxtk5lDnAVX/vttscT5YUFvw4dbPT2mQiEd1lKbaLftRiIPEomZpQ37+fUkQdcPrnhruPAISO/Sof1n1LFW4mYIffozteQSZBH6HaCVp+MRMIhdMi5e8w7PD48/cZz8D/EU8Vqi91FM76/3tMqg6nLqQ+8bq74Jvt2kzwZlIufe+I55QMpZOmF6hGIJEt+R0JXdjQbtgcELONmNj2dr8sAlzu7zKlAGuJ24Q=="
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"headers": {
|
||||
"user-agent": "http.rb/3.3.0 (Mastodon/2.5.0; +http://localhost:3000/)",
|
||||
"host": "localhost",
|
||||
"date": "Mon, 22 Oct 2018 13:34:22 GMT",
|
||||
"accept-encoding": "gzip",
|
||||
"digest": "SHA-256=FEr5j2WSSfdEMcG3NTOXuGU0lUchfTJx4+BtUlWOwDk=",
|
||||
"content-type": "application/activity+json",
|
||||
"signature": "keyId=\"http://localhost:3000/users/ronan2#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date digest content-type\",signature=\"oLKbgxdFXdXsHJ3x/UsG9Svu7oa8Dyqiy6Jif4wqNuhAqRVMRaG18f+dd2OcfFX3XRGF8p8flZkU6vvoEQBauTwGRGcgXAJuKC1zYIWGk+PeiW8lNUnE4qGapWcTiFnIo7FKauNdsgqg/tvgs1pQIdHkDDjZMI64twP7sTN/4vG1PCq+kyqi/DM+ORLi/W7vFuLVHt2Iz7ikfw/R3/mMtS4FwLops+tVYBQ2iQ9DVRhTwLKVbeL/LLVB/tdGzNZ4F4nImBAQQ9I7WpPM6J/k+cBmoEbrUKs8ptx9gbX3OSsl4wlvPVMNzU9F9yb2MrB/Y/J4qssKz+LbiaktKGj7OQ==\"",
|
||||
"content-length": "2815"
|
||||
},
|
||||
"body": {
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1",
|
||||
{
|
||||
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||
"sensitive": "as:sensitive",
|
||||
"movedTo": {
|
||||
"@id": "as:movedTo",
|
||||
"@type": "@id"
|
||||
},
|
||||
"Hashtag": "as:Hashtag",
|
||||
"ostatus": "http://ostatus.org#",
|
||||
"atomUri": "ostatus:atomUri",
|
||||
"inReplyToAtomUri": "ostatus:inReplyToAtomUri",
|
||||
"conversation": "ostatus:conversation",
|
||||
"toot": "http://joinmastodon.org/ns#",
|
||||
"Emoji": "toot:Emoji",
|
||||
"focalPoint": {
|
||||
"@container": "@list",
|
||||
"@id": "toot:focalPoint"
|
||||
},
|
||||
"featured": {
|
||||
"@id": "toot:featured",
|
||||
"@type": "@id"
|
||||
},
|
||||
"schema": "http://schema.org#",
|
||||
"PropertyValue": "schema:PropertyValue",
|
||||
"value": "schema:value"
|
||||
}
|
||||
],
|
||||
"id": "http://localhost:3000/users/ronan2/statuses/100939547203370948/activity",
|
||||
"type": "Create",
|
||||
"actor": "http://localhost:3000/users/ronan2",
|
||||
"published": "2018-10-22T13:34:18Z",
|
||||
"to": [
|
||||
"https://www.w3.org/ns/activitystreams#Public"
|
||||
],
|
||||
"cc": [
|
||||
"http://localhost:3000/users/ronan2/followers",
|
||||
"http://localhost:9000/accounts/ronan"
|
||||
],
|
||||
"object": {
|
||||
"id": "http://localhost:3000/users/ronan2/statuses/100939547203370948",
|
||||
"type": "Note",
|
||||
"summary": null,
|
||||
"inReplyTo": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752",
|
||||
"published": "2018-10-22T13:34:18Z",
|
||||
"url": "http://localhost:3000/@ronan2/100939547203370948",
|
||||
"attributedTo": "http://localhost:3000/users/ronan2",
|
||||
"to": [
|
||||
"https://www.w3.org/ns/activitystreams#Public"
|
||||
],
|
||||
"cc": [
|
||||
"http://localhost:3000/users/ronan2/followers",
|
||||
"http://localhost:9000/accounts/ronan"
|
||||
],
|
||||
"sensitive": false,
|
||||
"atomUri": "http://localhost:3000/users/ronan2/statuses/100939547203370948",
|
||||
"inReplyToAtomUri": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752",
|
||||
"conversation": "tag:localhost:3000,2018-10-19:objectId=72:objectType=Conversation",
|
||||
"content": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zergzerg</p>",
|
||||
"contentMap": {
|
||||
"en": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zergzerg</p>"
|
||||
},
|
||||
"attachment": [],
|
||||
"tag": [
|
||||
{
|
||||
"type": "Mention",
|
||||
"href": "http://localhost:9000/accounts/ronan",
|
||||
"name": "@ronan@localhost:9000"
|
||||
}
|
||||
]
|
||||
},
|
||||
"signature": {
|
||||
"type": "RsaSignature2017",
|
||||
"creator": "http://localhost:3000/users/ronan2#main-key",
|
||||
"created": "2018-10-22T13:34:19Z",
|
||||
"signatureValue": "x+xL4l8ERziYVhwEafHJyBQOInvNZ0gV4ccYd9AtFYeGJagc8fY6jjjhbDRCD7yMhgTjBX69z20MXnDuwpmM6wej3dt1wLKdIyXVViO84nAlqFz7KmNxtk5lDnAVX/vttscT5YUFvw4dbPT2mQiEd1lKbaLftRiIPEomZpQ37+fUkQdcPrnhruPAISO/Sof1n1LFW4mYIffozteQSZBH6HaCVp+MRMIhdMi5e8w7PD48/cZz8D/EU8Vqi91FM76/3tMqg6nLqQ+8bq74Jvt2kzwZlIufe+I55QMpZOmF6hGIJEt+R0JXdjQbtgcELONmNj2dr8sAlzu7zKlAGuJ24Q=="
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"publicKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0YyuthHtWWgDe0Fdgdp2\ndC5dTJsRqW6pFw5omIYYYjoES/WRewhVxEA54BhmxD3L1zChfx131N1TS8jVowhW\nm999jpUffKCCvLgYKIXETJDHiDeMONVx8wp7v9fS1HiFXo/E5und39gUMs14CMFZ\n6PE5jRV3r4XIKQJHQl7/X5n5FOb2934K+1TKUeBkbft/AushlKatYQakt3qHxpwx\nFvE+JjGo7QTnzdjaOx/e5QvojdGi2Kx4+jl77j2WVcSo5lOBz04OAVJtChtn82vS\nulPdDh3hZcDn+WK67yAhGP6AnzvOybZZS4zowlKiQ3kqjVVXKdl8gAsL4Y7MZ40R\nJQIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1",
|
||||
{
|
||||
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||
"sensitive": "as:sensitive",
|
||||
"movedTo": {
|
||||
"@id": "as:movedTo",
|
||||
"@type": "@id"
|
||||
},
|
||||
"Hashtag": "as:Hashtag",
|
||||
"ostatus": "http://ostatus.org#",
|
||||
"atomUri": "ostatus:atomUri",
|
||||
"inReplyToAtomUri": "ostatus:inReplyToAtomUri",
|
||||
"conversation": "ostatus:conversation",
|
||||
"toot": "http://joinmastodon.org/ns#",
|
||||
"Emoji": "toot:Emoji",
|
||||
"focalPoint": {
|
||||
"@container": "@list",
|
||||
"@id": "toot:focalPoint"
|
||||
},
|
||||
"featured": {
|
||||
"@id": "toot:featured",
|
||||
"@type": "@id"
|
||||
},
|
||||
"schema": "http://schema.org#",
|
||||
"PropertyValue": "schema:PropertyValue",
|
||||
"value": "schema:value"
|
||||
}
|
||||
],
|
||||
"id": "http://localhost:3000/users/ronan2/statuses/100939345950887698/activity",
|
||||
"type": "Create",
|
||||
"actor": "http://localhost:3000/users/ronan2",
|
||||
"published": "2018-10-22T12:43:07Z",
|
||||
"to": [
|
||||
"https://www.w3.org/ns/activitystreams#Public"
|
||||
],
|
||||
"cc": [
|
||||
"http://localhost:3000/users/ronan2/followers",
|
||||
"http://localhost:9000/accounts/ronan"
|
||||
],
|
||||
"object": {
|
||||
"id": "http://localhost:3000/users/ronan2/statuses/100939345950887698",
|
||||
"type": "Note",
|
||||
"summary": null,
|
||||
"inReplyTo": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752",
|
||||
"published": "2018-10-22T12:43:07Z",
|
||||
"url": "http://localhost:3000/@ronan2/100939345950887698",
|
||||
"attributedTo": "http://localhost:3000/users/ronan2",
|
||||
"to": [
|
||||
"https://www.w3.org/ns/activitystreams#Public"
|
||||
],
|
||||
"cc": [
|
||||
"http://localhost:3000/users/ronan2/followers",
|
||||
"http://localhost:9000/accounts/ronan"
|
||||
],
|
||||
"sensitive": false,
|
||||
"atomUri": "http://localhost:3000/users/ronan2/statuses/100939345950887698",
|
||||
"inReplyToAtomUri": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752",
|
||||
"conversation": "tag:localhost:3000,2018-10-19:objectId=72:objectType=Conversation",
|
||||
"content": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zerg</p>",
|
||||
"contentMap": {
|
||||
"en": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zerg</p>"
|
||||
},
|
||||
"attachment": [],
|
||||
"tag": [
|
||||
{
|
||||
"type": "Mention",
|
||||
"href": "http://localhost:9000/accounts/ronan",
|
||||
"name": "@ronan@localhost:9000"
|
||||
}
|
||||
]
|
||||
},
|
||||
"signature": {
|
||||
"type": "RsaSignature2017",
|
||||
"creator": "http://localhost:3000/users/ronan2#main-key",
|
||||
"created": "2018-10-22T12:43:08Z",
|
||||
"signatureValue": "Vgr8nA0agPr9TcA4BlX+MWhmuE+rBcoIJLpnPbm3E5SnOCXbgjEfEaTLqfuzzkKNsR3PBbkvi3YWK4/DxJ0zmpzSB7yy4NRzluQMVQHqJiFKXAX3Sr3fIrK24xkWW9/F207c1NpFajSGbgnFKBdtFE0e5VqwSrSoOJkZukZW/2ATSnsyzblieuUmvTWpD0PqpUOsynPjw+RqZnqPn0cjw1z2Dm7ZRt3trnyMTXFYZw5U/YuqMY2kpadD6vq780md8kXlJIylxG6ZrlO2jz9fJdnfuVq43d4QFNsBm1K1r2WtNqX+i+wiqh+u3PjF4pzXtl/a3hJOH18IfZnK7I21mQ=="
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
{
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1",
|
||||
{
|
||||
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||
"sensitive": "as:sensitive",
|
||||
"movedTo": {
|
||||
"@id": "as:movedTo",
|
||||
"@type": "@id"
|
||||
},
|
||||
"Hashtag": "as:Hashtag",
|
||||
"ostatus": "http://ostatus.org#",
|
||||
"atomUri": "ostatus:atomUri",
|
||||
"inReplyToAtomUri": "ostatus:inReplyToAtomUri",
|
||||
"conversation": "ostatus:conversation",
|
||||
"toot": "http://joinmastodon.org/ns#",
|
||||
"Emoji": "toot:Emoji",
|
||||
"focalPoint": {
|
||||
"@container": "@list",
|
||||
"@id": "toot:focalPoint"
|
||||
},
|
||||
"featured": {
|
||||
"@id": "toot:featured",
|
||||
"@type": "@id"
|
||||
},
|
||||
"schema": "http://schema.org#",
|
||||
"PropertyValue": "schema:PropertyValue",
|
||||
"value": "schema:value"
|
||||
}
|
||||
],
|
||||
"id": "http://localhost:3000/users/ronan2/statuses/100939345950887698/activity",
|
||||
"type": "Create",
|
||||
"actor": "http://localhost:3000/users/ronan2",
|
||||
"published": "2018-10-22T12:43:07Z",
|
||||
"to": [
|
||||
"https://www.w3.org/ns/activitystreams#Public"
|
||||
],
|
||||
"cc": [
|
||||
"http://localhost:3000/users/ronan2/followers",
|
||||
"http://localhost:9000/accounts/ronan"
|
||||
],
|
||||
"object": {
|
||||
"id": "http://localhost:3000/users/ronan2/statuses/100939345950887698",
|
||||
"type": "Note",
|
||||
"summary": null,
|
||||
"inReplyTo": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752",
|
||||
"published": "2018-10-22T12:43:07Z",
|
||||
"url": "http://localhost:3000/@ronan2/100939345950887698",
|
||||
"attributedTo": "http://localhost:3000/users/ronan2",
|
||||
"to": [
|
||||
"https://www.w3.org/ns/activitystreams#Public"
|
||||
],
|
||||
"cc": [
|
||||
"http://localhost:3000/users/ronan2/followers",
|
||||
"http://localhost:9000/accounts/ronan"
|
||||
],
|
||||
"sensitive": false,
|
||||
"atomUri": "http://localhost:3000/users/ronan2/statuses/100939345950887698",
|
||||
"inReplyToAtomUri": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752",
|
||||
"conversation": "tag:localhost:3000,2018-10-19:objectId=72:objectType=Conversation",
|
||||
"content": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zerg</p>",
|
||||
"contentMap": {
|
||||
"en": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zerg</p>"
|
||||
},
|
||||
"attachment": [],
|
||||
"tag": [
|
||||
{
|
||||
"type": "Mention",
|
||||
"href": "http://localhost:9000/accounts/ronan",
|
||||
"name": "@ronan@localhost:9000"
|
||||
}
|
||||
]
|
||||
},
|
||||
"signature": {
|
||||
"type": "RsaSignature2017",
|
||||
"creator": "http://localhost:3000/users/ronan2#main-key",
|
||||
"created": "2018-10-22T12:43:08Z",
|
||||
"signatureValue": "VgR8nA0agPr9TcA4BlX+MWhmuE+rBcoIJLpnPbm3E5SnOCXbgjEfEaTLqfuzzkKNsR3PBbkvi3YWK4/DxJ0zmpzSB7yy4NRzluQMVQHqJiFKXAX3Sr3fIrK24xkWW9/F207c1NpFajSGbgnFKBdtFE0e5VqwSrSoOJkZukZW/2ATSnsyzblieuUmvTWpD0PqpUOsynPjw+RqZnqPn0cjw1z2Dm7ZRt3trnyMTXFYZw5U/YuqMY2kpadD6vq780md8kXlJIylxG6ZrlO2jz9fJdnfuVq43d4QFNsBm1K1r2WtNqX+i+wiqh+u3PjF4pzXtl/a3hJOH18IfZnK7I21mQ=="
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
{
|
||||
"headers": {
|
||||
"user-agent": "http.rb/3.3.0 (Mastodon/2.5.0; +http://localhost:3000/)",
|
||||
"host": "localhost",
|
||||
"date": "Mon, 22 Oct 2018 13:34:22 GMT",
|
||||
"accept-encoding": "gzip",
|
||||
"digest": "SHA-256=FEr5j2WSSfdEMcG3NTOXuGU0lUchfTJx4+BtUlWOwDk=",
|
||||
"content-type": "application/activity+json",
|
||||
"signature": "keyId=\"http://localhost:3000/users/ronan2#main-key\",algorithm=\"rsa-sha256\",headers=\"(request-target) host date digest content-type\",signature=\"oLKbgxdFXdXsHJ3x/UsG9Svu7oa8Dyqiy6Jif4wqNuhAqRVMRaG18f+dd2OcfFX3XRGF8p8flZkU6vvoEQBauTwGRGcgXAJuKC1zYIWGk+PeiW8lNUnE4qGapWcTiFnIo7FKauNdsgqg/tvgs1pQIdHkDDjZMI64twP7sTN/4vG1PCq+kyqi/DM+ORLi/W7vFuLVHt2Iz7ikfw/R3/mMtS4FwLops+tVYBQ2iQ9DVRhTwLKVbeL/LLVB/tdGzNZ4F4nImBAQQ9I7WpPM6J/k+cBmoEbrUKs8ptx9gbX3OSsl5wlvPVMNzU9F9yb2MrB/Y/J4qssKz+LbiaktKGj7OQ==\"",
|
||||
"content-length": "2815"
|
||||
},
|
||||
"body": {
|
||||
"@context": [
|
||||
"https://www.w3.org/ns/activitystreams",
|
||||
"https://w3id.org/security/v1",
|
||||
{
|
||||
"manuallyApprovesFollowers": "as:manuallyApprovesFollowers",
|
||||
"sensitive": "as:sensitive",
|
||||
"movedTo": {
|
||||
"@id": "as:movedTo",
|
||||
"@type": "@id"
|
||||
},
|
||||
"Hashtag": "as:Hashtag",
|
||||
"ostatus": "http://ostatus.org#",
|
||||
"atomUri": "ostatus:atomUri",
|
||||
"inReplyToAtomUri": "ostatus:inReplyToAtomUri",
|
||||
"conversation": "ostatus:conversation",
|
||||
"toot": "http://joinmastodon.org/ns#",
|
||||
"Emoji": "toot:Emoji",
|
||||
"focalPoint": {
|
||||
"@container": "@list",
|
||||
"@id": "toot:focalPoint"
|
||||
},
|
||||
"featured": {
|
||||
"@id": "toot:featured",
|
||||
"@type": "@id"
|
||||
},
|
||||
"schema": "http://schema.org#",
|
||||
"PropertyValue": "schema:PropertyValue",
|
||||
"value": "schema:value"
|
||||
}
|
||||
],
|
||||
"id": "http://localhost:3000/users/ronan2/statuses/100939547203370948/activity",
|
||||
"type": "Create",
|
||||
"actor": "http://localhost:3000/users/ronan2",
|
||||
"published": "2018-10-22T13:34:18Z",
|
||||
"to": [
|
||||
"https://www.w3.org/ns/activitystreams#Public"
|
||||
],
|
||||
"cc": [
|
||||
"http://localhost:3000/users/ronan2/followers",
|
||||
"http://localhost:9000/accounts/ronan"
|
||||
],
|
||||
"object": {
|
||||
"id": "http://localhost:3000/users/ronan2/statuses/100939547203370948",
|
||||
"type": "Note",
|
||||
"summary": null,
|
||||
"inReplyTo": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752",
|
||||
"published": "2018-10-22T13:34:18Z",
|
||||
"url": "http://localhost:3000/@ronan2/100939547203370948",
|
||||
"attributedTo": "http://localhost:3000/users/ronan2",
|
||||
"to": [
|
||||
"https://www.w3.org/ns/activitystreams#Public"
|
||||
],
|
||||
"cc": [
|
||||
"http://localhost:3000/users/ronan2/followers",
|
||||
"http://localhost:9000/accounts/ronan"
|
||||
],
|
||||
"sensitive": false,
|
||||
"atomUri": "http://localhost:3000/users/ronan2/statuses/100939547203370948",
|
||||
"inReplyToAtomUri": "http://localhost:9000/videos/watch/90e6f8ed-b369-423c-b0c8-f44e5350c752",
|
||||
"conversation": "tag:localhost:3000,2018-10-19:objectId=72:objectType=Conversation",
|
||||
"content": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zergzerg</p>",
|
||||
"contentMap": {
|
||||
"en": "<p><span class=\"h-card\"><a href=\"http://localhost:9000/accounts/ronan\" class=\"u-url mention\">@<span>ronan</span></a></span> zergzerg</p>"
|
||||
},
|
||||
"attachment": [],
|
||||
"tag": [
|
||||
{
|
||||
"type": "Mention",
|
||||
"href": "http://localhost:9000/accounts/ronan",
|
||||
"name": "@ronan@localhost:9000"
|
||||
}
|
||||
]
|
||||
},
|
||||
"signature": {
|
||||
"type": "RsaSignature2017",
|
||||
"creator": "http://localhost:3000/users/ronan2#main-key",
|
||||
"created": "2018-10-22T13:34:19Z",
|
||||
"signatureValue": "x+xL4l8ERziYVhwEafHJyBQOInvNZ0gV4ccYd9AtFYeGJagc8fY6jjjhbDRCD7yMhgTjBX69z20MXnDuwpmM6wej3dt1wLKdIyXVViO84nAlqFz7KmNxtk5lDnAVX/vttscT5YUFvw4dbPT2mQiEd1lKbaLftRiIPEomZpQ37+fUkQdcPrnhruPAISO/Sof1n1LFW4mYIffozteQSZBH6HaCVp+MRMIhdMi5e8w7PD48/cZz8D/EU8Vqi91FM76/3tMqg6nLqQ+8bq74Jvt2kzwZlIufe+I55QMpZOmF6hGIJEt+R0JXdjQbtgcELONmNj2dr8sAlzu7zKlAGuJ24Q=="
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"publicKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA0YyuthHtWWgDe0Fdgdp2\ndC5dTJsRqW6pFw5omIYYYjoES/WRewhVxEA54BhmxD3L1zChfx131N1TS8jVowhW\nm999jpUffKCCvLgYKIXETJDHiDeMONVx8wp7v9fS1HiFXo/E5und39gUMs14CMFZ\n6PE5jRV3r4XIKQJHQl7/X5n5FOb2934K+1TKUeBkbft/AushlKatYQakt3qHxpwx\nFvE+JjGo7QTnzdjaOx/e5QvojdGi2Kx4+jl87j2WVcSo5lOBz04OAVJtChtn82vS\nulPdDh3hZcDn+WK67yAhGP6AnzvOybZZS4zowlKiQ3kqjVVXKdl8gAsL4Y7MZ40R\nJQIDAQAB\n-----END PUBLIC KEY-----\n"
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"type": "Announce",
|
||||
"id": "http://127.0.0.1:9002/videos/watch/997111d4-e8d8-4f45-99d3-857905785d05/announces/1",
|
||||
"actor": "http://127.0.0.1:9002/accounts/peertube",
|
||||
"object": "http://127.0.0.1:9002/videos/watch/997111d4-e8d8-4f45-99d3-857905785d05",
|
||||
"to": [
|
||||
"https://www.w3.org/ns/activitystreams#Public",
|
||||
"http://127.0.0.1:9002/accounts/peertube/followers",
|
||||
"http://127.0.0.1:9002/video-channels/root_channel/followers",
|
||||
"http://127.0.0.1:9002/accounts/root/followers"
|
||||
],
|
||||
"cc": []
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
{
|
||||
"publicKey": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgK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: | サイズ: 143 KiB |
|
変更後 幅: | 高さ: | サイズ: 86 KiB |
|
変更後 幅: | 高さ: | サイズ: 1.7 KiB |
|
変更後 幅: | 高さ: | サイズ: 75 KiB |
|
変更後 幅: | 高さ: | サイズ: 20 KiB |
|
変更後 幅: | 高さ: | サイズ: 727 B |
|
変更後 幅: | 高さ: | サイズ: 20 KiB |
|
変更後 幅: | 高さ: | サイズ: 46 KiB |
|
変更後 幅: | 高さ: | サイズ: 1.6 KiB |
|
変更後 幅: | 高さ: | サイズ: 1.7 KiB |
|
変更後 幅: | 高さ: | サイズ: 80 KiB |
|
変更後 幅: | 高さ: | サイズ: 760 B |
|
変更後 幅: | 高さ: | サイズ: 22 KiB |
|
変更後 幅: | 高さ: | サイズ: 4.7 KiB |
|
変更後 幅: | 高さ: | サイズ: 58 KiB |
|
変更後 幅: | 高さ: | サイズ: 12 KiB |
|
変更後 幅: | 高さ: | サイズ: 59 KiB |
|
変更後 幅: | 高さ: | サイズ: 12 KiB |
|
変更後 幅: | 高さ: | サイズ: 31 KiB |
|
変更後 幅: | 高さ: | サイズ: 524 KiB |
|
変更後 幅: | 高さ: | サイズ: 33 KiB |
|
変更後 幅: | 高さ: | サイズ: 20 KiB |
|
変更後 幅: | 高さ: | サイズ: 6.5 KiB |
|
変更後 幅: | 高さ: | サイズ: 6.7 KiB |
|
変更後 幅: | 高さ: | サイズ: 18 KiB |
|
変更後 幅: | 高さ: | サイズ: 11 KiB |
|
変更後 幅: | 高さ: | サイズ: 21 KiB |
@@ -0,0 +1,14 @@
|
||||
#EXTM3U
|
||||
#EXT-X-VERSION:6
|
||||
#EXT-X-TARGETDURATION:2
|
||||
#EXT-X-MEDIA-SEQUENCE:68
|
||||
#EXT-X-INDEPENDENT-SEGMENTS
|
||||
#EXTINF:2.000000,
|
||||
#EXT-X-PROGRAM-DATE-TIME:2023-04-18T13:38:39.019+0200
|
||||
0-000068.ts
|
||||
#EXTINF:2.000000,
|
||||
#EXT-X-PROGRAM-DATE-TIME:2023-04-18T13:38:41.019+0200
|
||||
0-000069.ts
|
||||
#EXTINF:2.000000,
|
||||
#EXT-X-PROGRAM-DATE-TIME:2023-04-18T13:38:43.019+0200
|
||||
0-000070.
|
||||
@@ -0,0 +1,14 @@
|
||||
#EXTM3U
|
||||
#EXT-X-VERSION:6
|
||||
#EXT-X-TARGETDURATION:2
|
||||
#EXT-X-MEDIA-SEQUENCE:68
|
||||
#EXT-X-INDEPENDENT-SEGMENTS
|
||||
#EXTINF:2.000000,
|
||||
#EXT-X-PROGRAM-DATE-TIME:2023-04-18T13:38:39.019+0200
|
||||
1-000068.ts
|
||||
#EXTINF:2.000000,
|
||||
#EXT-X-PROGRAM-DATE-TIME:2023-04-18T13:38:41.019+0200
|
||||
1-000069.ts
|
||||
#EXTINF:2.000000,
|
||||
#EXT-X-PROGRAM-DATE-TIME:2023-04-18T13:38:43.019+0200
|
||||
1-000070.ts
|
||||
@@ -0,0 +1,8 @@
|
||||
#EXTM3U
|
||||
#EXT-X-VERSION:6
|
||||
#EXT-X-STREAM-INF:BANDWIDTH=1287342,RESOLUTION=640x360,CODECS="avc1.64001f,mp4a.40.2"
|
||||
0.m3u8
|
||||
|
||||
#EXT-X-STREAM-INF:BANDWIDTH=3051742,RESOLUTION=1280x720,CODECS="avc1.64001f,mp4a.40.2"
|
||||
1.m3u8
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
async function register (options) {
|
||||
options.unknownFunction()
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-broken",
|
||||
"version": "0.0.1",
|
||||
"description": "Plugin test broken",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
async function register ({
|
||||
registerExternalAuth,
|
||||
peertubeHelpers,
|
||||
settingsManager,
|
||||
unregisterExternalAuth
|
||||
}) {
|
||||
{
|
||||
const result = registerExternalAuth({
|
||||
authName: 'external-auth-1',
|
||||
authDisplayName: () => 'External Auth 1',
|
||||
onLogout: user => peertubeHelpers.logger.info('On logout %s', user.username),
|
||||
onAuthRequest: (req, res) => {
|
||||
const username = req.query.username
|
||||
|
||||
result.userAuthenticated({
|
||||
req,
|
||||
res,
|
||||
username,
|
||||
email: username + '@example.com'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
const result = registerExternalAuth({
|
||||
authName: 'external-auth-2',
|
||||
authDisplayName: () => 'External Auth 2',
|
||||
onAuthRequest: (req, res) => {
|
||||
result.userAuthenticated({
|
||||
req,
|
||||
res,
|
||||
username: 'kefka',
|
||||
email: 'kefka@example.com',
|
||||
role: 0,
|
||||
displayName: 'Kefka Palazzo',
|
||||
adminFlags: 1,
|
||||
videoQuota: 42000,
|
||||
videoQuotaDaily: 42100,
|
||||
|
||||
// Always use new value except for videoQuotaDaily field
|
||||
userUpdater: ({ fieldName, currentValue, newValue }) => {
|
||||
if (fieldName === 'videoQuotaDaily') return currentValue
|
||||
|
||||
return newValue
|
||||
}
|
||||
})
|
||||
},
|
||||
hookTokenValidity: (options) => {
|
||||
if (options.type === 'refresh') {
|
||||
return { valid: false }
|
||||
}
|
||||
|
||||
if (options.type === 'access') {
|
||||
const token = options.token
|
||||
const now = new Date()
|
||||
now.setTime(now.getTime() - 5000)
|
||||
|
||||
const createdAt = new Date(token.createdAt)
|
||||
|
||||
return { valid: createdAt.getTime() >= now.getTime() }
|
||||
}
|
||||
|
||||
return { valid: true }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
settingsManager.onSettingsChange(settings => {
|
||||
if (settings.disableKefka) {
|
||||
unregisterExternalAuth('external-auth-2')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
|
||||
// ###########################################################################
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-external-auth-one",
|
||||
"version": "0.0.1",
|
||||
"description": "External auth one",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
async function register ({
|
||||
registerExternalAuth,
|
||||
peertubeHelpers
|
||||
}) {
|
||||
{
|
||||
const result = registerExternalAuth({
|
||||
authName: 'external-auth-7',
|
||||
authDisplayName: () => 'External Auth 7',
|
||||
onAuthRequest: (req, res) => {
|
||||
result.userAuthenticated({
|
||||
req,
|
||||
res,
|
||||
username: 'cid',
|
||||
email: 'cid@example.com',
|
||||
displayName: 'Cid Marquez'
|
||||
})
|
||||
},
|
||||
onLogout: (user, req) => {
|
||||
return 'https://example.com/redirectUrl'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
const result = registerExternalAuth({
|
||||
authName: 'external-auth-8',
|
||||
authDisplayName: () => 'External Auth 8',
|
||||
onAuthRequest: (req, res) => {
|
||||
result.userAuthenticated({
|
||||
req,
|
||||
res,
|
||||
username: 'cid',
|
||||
email: 'cid@example.com',
|
||||
displayName: 'Cid Marquez'
|
||||
})
|
||||
},
|
||||
onLogout: (user, req) => {
|
||||
return 'https://example.com/redirectUrl?access_token=' + req.headers['authorization'].split(' ')[1]
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
|
||||
// ###########################################################################
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-external-auth-three",
|
||||
"version": "0.0.1",
|
||||
"description": "External auth three",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {}
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
async function register ({
|
||||
registerExternalAuth,
|
||||
peertubeHelpers
|
||||
}) {
|
||||
{
|
||||
const result = registerExternalAuth({
|
||||
authName: 'external-auth-3',
|
||||
authDisplayName: () => 'External Auth 3',
|
||||
onAuthRequest: (req, res) => {
|
||||
result.userAuthenticated({
|
||||
req,
|
||||
res,
|
||||
username: 'cid',
|
||||
email: 'cid@example.com',
|
||||
displayName: 'Cid Marquez'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
const result = registerExternalAuth({
|
||||
authName: 'external-auth-4',
|
||||
authDisplayName: () => 'External Auth 4',
|
||||
onAuthRequest: (req, res) => {
|
||||
result.userAuthenticated({
|
||||
req,
|
||||
res,
|
||||
username: 'kefka2',
|
||||
email: 'kefka@example.com',
|
||||
displayName: 'Kefka duplication'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
const result = registerExternalAuth({
|
||||
authName: 'external-auth-5',
|
||||
authDisplayName: () => 'External Auth 5',
|
||||
onAuthRequest: (req, res) => {
|
||||
result.userAuthenticated({
|
||||
req,
|
||||
res,
|
||||
username: 'kefka',
|
||||
email: 'kefka@example.com',
|
||||
displayName: 'Kefka duplication'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
const result = registerExternalAuth({
|
||||
authName: 'external-auth-6',
|
||||
authDisplayName: () => 'External Auth 6',
|
||||
onAuthRequest: (req, res) => {
|
||||
result.userAuthenticated({
|
||||
req,
|
||||
res,
|
||||
username: 'existing_user',
|
||||
email: 'existing_user@example.com',
|
||||
displayName: 'Existing user'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
const result = registerExternalAuth({
|
||||
authName: 'external-auth-7',
|
||||
authDisplayName: () => 'External Auth 7',
|
||||
onAuthRequest: (req, res) => {
|
||||
result.userAuthenticated({
|
||||
req,
|
||||
res,
|
||||
username: 'existing_user2',
|
||||
email: 'custom_email_existing_user2@example.com',
|
||||
displayName: 'Existing user 2'
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
|
||||
// ###########################################################################
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-external-auth-two",
|
||||
"version": "0.0.1",
|
||||
"description": "External auth two",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"Hello world": "Bonjour le monde"
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"Hello world": "Ciao, mondo!"
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
async function register ({ registerHook, registerSetting, settingsManager, storageManager, peertubeHelpers }) {
|
||||
registerHook({
|
||||
target: 'filter:api.videos.list.params',
|
||||
handler: obj => addToCount(obj)
|
||||
})
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
|
||||
// ############################################################################
|
||||
|
||||
function addToCount (obj) {
|
||||
return Object.assign({}, obj, { count: obj.count + 1 })
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-filter-translations",
|
||||
"version": "0.0.1",
|
||||
"description": "Plugin test filter and translations",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {
|
||||
"fr-FR": "./languages/fr.json",
|
||||
"it-IT": "./languages/it.json"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
async function register ({
|
||||
getRouter
|
||||
}) {
|
||||
const router = getRouter()
|
||||
router.get('/ping', (req, res) => res.json({ message: 'pong' }))
|
||||
|
||||
router.get('/is-authenticated', (req, res) => res.json({ isAuthenticated: res.locals.authenticated }))
|
||||
|
||||
router.post('/form/post/mirror', (req, res) => {
|
||||
res.json(req.body)
|
||||
})
|
||||
|
||||
router.post('/form/post/mirror-raw-body', (req, res) => {
|
||||
res.json(JSON.parse(req.rawBody))
|
||||
})
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
|
||||
// ###########################################################################
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-five",
|
||||
"version": "0.0.1",
|
||||
"description": "Plugin test 5",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {}
|
||||
}
|
||||
@@ -0,0 +1,208 @@
|
||||
async function register ({
|
||||
peertubeHelpers,
|
||||
registerHook,
|
||||
getRouter
|
||||
}) {
|
||||
const logger = peertubeHelpers.logger
|
||||
|
||||
logger.info('Hello world from plugin four')
|
||||
|
||||
{
|
||||
const username = 'root'
|
||||
const results = await peertubeHelpers.database.query(
|
||||
'SELECT "email" from "user" WHERE "username" = $username',
|
||||
{
|
||||
type: 'SELECT',
|
||||
bind: { username }
|
||||
}
|
||||
)
|
||||
|
||||
logger.info('root email is ' + results[0]['email'])
|
||||
}
|
||||
|
||||
{
|
||||
registerHook({
|
||||
target: 'action:api.video.viewed',
|
||||
handler: async ({ video }) => {
|
||||
const videoFromDB1 = await peertubeHelpers.videos.loadByUrl(video.url)
|
||||
const videoFromDB2 = await peertubeHelpers.videos.loadByIdOrUUID(video.id)
|
||||
const videoFromDB3 = await peertubeHelpers.videos.loadByIdOrUUID(video.uuid)
|
||||
|
||||
if (videoFromDB1.uuid !== videoFromDB2.uuid || videoFromDB2.uuid !== videoFromDB3.uuid) return
|
||||
|
||||
const videoWithFiles = await peertubeHelpers.videos.loadByIdOrUUIDWithFiles(video.id)
|
||||
|
||||
if (videoWithFiles.getHLSPlaylist().getMasterPlaylistUrl(videoWithFiles) === null) {
|
||||
logger.error('Video with files could not be loaded.')
|
||||
return
|
||||
}
|
||||
|
||||
logger.info('video from DB uuid is %s.', videoFromDB1.uuid)
|
||||
|
||||
await peertubeHelpers.videos.removeVideo(video.id)
|
||||
|
||||
logger.info('Video deleted by plugin four.')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
const serverActor = await peertubeHelpers.server.getServerActor()
|
||||
logger.info('server actor name is %s', serverActor.preferredUsername)
|
||||
}
|
||||
|
||||
{
|
||||
logger.info('server url is %s', peertubeHelpers.config.getWebserverUrl())
|
||||
}
|
||||
|
||||
{
|
||||
const actions = {
|
||||
blockServer,
|
||||
unblockServer,
|
||||
blockAccount,
|
||||
unblockAccount,
|
||||
blacklist,
|
||||
unblacklist
|
||||
}
|
||||
|
||||
const router = getRouter()
|
||||
router.post('/commander', async (req, res) => {
|
||||
try {
|
||||
await actions[req.body.command](peertubeHelpers, req.body)
|
||||
|
||||
res.sendStatus(204)
|
||||
} catch (err) {
|
||||
logger.error('Error in commander.', { err })
|
||||
res.sendStatus(500)
|
||||
}
|
||||
})
|
||||
|
||||
router.get('/server-config', async (req, res) => {
|
||||
const serverConfig = await peertubeHelpers.config.getServerConfig()
|
||||
|
||||
return res.json({ serverConfig })
|
||||
})
|
||||
|
||||
router.get('/server-listening-config', async (req, res) => {
|
||||
const config = await peertubeHelpers.config.getServerListeningConfig()
|
||||
|
||||
return res.json({ config })
|
||||
})
|
||||
|
||||
router.get('/static-route', async (req, res) => {
|
||||
const staticRoute = peertubeHelpers.plugin.getBaseStaticRoute()
|
||||
|
||||
return res.json({ staticRoute })
|
||||
})
|
||||
|
||||
router.get('/router-route', async (req, res) => {
|
||||
const routerRoute = peertubeHelpers.plugin.getBaseRouterRoute()
|
||||
|
||||
return res.json({ routerRoute })
|
||||
})
|
||||
|
||||
router.get('/user/:id', async (req, res) => {
|
||||
const user = await peertubeHelpers.user.loadById(req.params.id)
|
||||
if (!user) return res.status(404).end()
|
||||
|
||||
return res.json({
|
||||
username: user.username
|
||||
})
|
||||
})
|
||||
|
||||
router.get('/user', async (req, res) => {
|
||||
const user = await peertubeHelpers.user.getAuthUser(res)
|
||||
if (!user) return res.sendStatus(404)
|
||||
|
||||
const isAdmin = user.role === 0
|
||||
const isModerator = user.role === 1
|
||||
const isUser = user.role === 2
|
||||
|
||||
return res.json({
|
||||
id: user.id,
|
||||
username: user.username,
|
||||
displayName: user.Account.name,
|
||||
isAdmin,
|
||||
isModerator,
|
||||
isUser
|
||||
})
|
||||
})
|
||||
|
||||
router.get('/video-files/:id', async (req, res) => {
|
||||
const details = await peertubeHelpers.videos.getFiles(req.params.id)
|
||||
if (!details) return res.sendStatus(404)
|
||||
|
||||
return res.json(details)
|
||||
})
|
||||
|
||||
router.get('/ffprobe', async (req, res) => {
|
||||
const result = await peertubeHelpers.videos.ffprobe(req.query.path)
|
||||
if (!result) return res.sendStatus(404)
|
||||
|
||||
return res.json(result)
|
||||
})
|
||||
|
||||
router.post('/send-notification', async (req, res) => {
|
||||
peertubeHelpers.socket.sendNotification(req.body.userId, {
|
||||
type: 1,
|
||||
userId: req.body.userId
|
||||
})
|
||||
|
||||
return res.sendStatus(201)
|
||||
})
|
||||
|
||||
router.post('/send-video-live-new-state/:uuid', async (req, res) => {
|
||||
const video = await peertubeHelpers.videos.loadByIdOrUUID(req.params.uuid)
|
||||
peertubeHelpers.socket.sendVideoLiveNewState(video)
|
||||
|
||||
return res.sendStatus(201)
|
||||
})
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
|
||||
// ###########################################################################
|
||||
|
||||
async function blockServer (peertubeHelpers, body) {
|
||||
const serverActor = await peertubeHelpers.server.getServerActor()
|
||||
|
||||
await peertubeHelpers.moderation.blockServer({ byAccountId: serverActor.Account.id, hostToBlock: body.hostToBlock })
|
||||
}
|
||||
|
||||
async function unblockServer (peertubeHelpers, body) {
|
||||
const serverActor = await peertubeHelpers.server.getServerActor()
|
||||
|
||||
await peertubeHelpers.moderation.unblockServer({ byAccountId: serverActor.Account.id, hostToUnblock: body.hostToUnblock })
|
||||
}
|
||||
|
||||
async function blockAccount (peertubeHelpers, body) {
|
||||
const serverActor = await peertubeHelpers.server.getServerActor()
|
||||
|
||||
await peertubeHelpers.moderation.blockAccount({ byAccountId: serverActor.Account.id, handleToBlock: body.handleToBlock })
|
||||
}
|
||||
|
||||
async function unblockAccount (peertubeHelpers, body) {
|
||||
const serverActor = await peertubeHelpers.server.getServerActor()
|
||||
|
||||
await peertubeHelpers.moderation.unblockAccount({ byAccountId: serverActor.Account.id, handleToUnblock: body.handleToUnblock })
|
||||
}
|
||||
|
||||
async function blacklist (peertubeHelpers, body) {
|
||||
await peertubeHelpers.moderation.blacklistVideo({
|
||||
videoIdOrUUID: body.videoUUID,
|
||||
createOptions: body
|
||||
})
|
||||
}
|
||||
|
||||
async function unblacklist (peertubeHelpers, body) {
|
||||
await peertubeHelpers.moderation.unblacklistVideo({ videoIdOrUUID: body.videoUUID })
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-four",
|
||||
"version": "0.0.1",
|
||||
"description": "Plugin test 4",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
async function register ({
|
||||
registerIdAndPassAuth,
|
||||
peertubeHelpers,
|
||||
settingsManager,
|
||||
unregisterIdAndPassAuth
|
||||
}) {
|
||||
registerIdAndPassAuth({
|
||||
authName: 'spyro-auth',
|
||||
|
||||
onLogout: () => {
|
||||
peertubeHelpers.logger.info('On logout for auth 1 - 1')
|
||||
},
|
||||
|
||||
getWeight: () => 15,
|
||||
|
||||
login (body) {
|
||||
if (body.id === 'spyro' && body.password === 'spyro password') {
|
||||
return Promise.resolve({
|
||||
username: 'spyro',
|
||||
email: 'spyro@example.com',
|
||||
role: 2,
|
||||
displayName: 'Spyro the Dragon'
|
||||
})
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
})
|
||||
|
||||
registerIdAndPassAuth({
|
||||
authName: 'crash-auth',
|
||||
|
||||
onLogout: () => {
|
||||
peertubeHelpers.logger.info('On logout for auth 1 - 2')
|
||||
},
|
||||
|
||||
getWeight: () => 50,
|
||||
|
||||
login (body) {
|
||||
if (body.id === 'crash' && body.password === 'crash password') {
|
||||
return Promise.resolve({
|
||||
username: 'crash',
|
||||
email: 'crash@example.com',
|
||||
role: 1,
|
||||
displayName: 'Crash Bandicoot'
|
||||
})
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
})
|
||||
|
||||
settingsManager.onSettingsChange(settings => {
|
||||
if (settings.disableSpyro) {
|
||||
unregisterIdAndPassAuth('spyro-auth')
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
|
||||
// ###########################################################################
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-id-pass-auth-one",
|
||||
"version": "0.0.1",
|
||||
"description": "Id and pass auth one",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
async function register ({
|
||||
registerIdAndPassAuth,
|
||||
peertubeHelpers
|
||||
}) {
|
||||
registerIdAndPassAuth({
|
||||
authName: 'laguna-bad-auth',
|
||||
|
||||
onLogout: () => {
|
||||
peertubeHelpers.logger.info('On logout for auth 3 - 1')
|
||||
},
|
||||
|
||||
getWeight: () => 5,
|
||||
|
||||
login (body) {
|
||||
if (body.id === 'laguna' && body.password === 'laguna password') {
|
||||
return Promise.resolve({
|
||||
username: 'laguna',
|
||||
email: 'laguna@example.com',
|
||||
displayName: 'Laguna Loire'
|
||||
})
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
})
|
||||
|
||||
registerIdAndPassAuth({
|
||||
authName: 'ward-auth',
|
||||
|
||||
getWeight: () => 5,
|
||||
|
||||
login (body) {
|
||||
if (body.id === 'ward') {
|
||||
return Promise.resolve({
|
||||
username: '-ward-42',
|
||||
email: 'ward@example.com'
|
||||
})
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
})
|
||||
|
||||
registerIdAndPassAuth({
|
||||
authName: 'kiros-auth',
|
||||
|
||||
getWeight: () => 5,
|
||||
|
||||
login (body) {
|
||||
if (body.id === 'kiros') {
|
||||
return Promise.resolve({
|
||||
username: 'kiros',
|
||||
email: 'kiros@example.com',
|
||||
displayName: 'a'.repeat(5000)
|
||||
})
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
})
|
||||
|
||||
registerIdAndPassAuth({
|
||||
authName: 'raine-auth',
|
||||
|
||||
getWeight: () => 5,
|
||||
|
||||
login (body) {
|
||||
if (body.id === 'raine') {
|
||||
return Promise.resolve({
|
||||
username: 'raine',
|
||||
email: 'raine@example.com',
|
||||
role: 42
|
||||
})
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
})
|
||||
|
||||
registerIdAndPassAuth({
|
||||
authName: 'ellone-auth',
|
||||
|
||||
getWeight: () => 5,
|
||||
|
||||
login (body) {
|
||||
if (body.id === 'ellone') {
|
||||
return Promise.resolve({
|
||||
username: 'ellone'
|
||||
})
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
|
||||
// ###########################################################################
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-id-pass-auth-three",
|
||||
"version": "0.0.1",
|
||||
"description": "Id and pass auth three",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
async function register ({
|
||||
registerIdAndPassAuth,
|
||||
peertubeHelpers
|
||||
}) {
|
||||
registerIdAndPassAuth({
|
||||
authName: 'laguna-auth',
|
||||
|
||||
onLogout: () => {
|
||||
peertubeHelpers.logger.info('On logout for auth 2 - 1')
|
||||
},
|
||||
|
||||
getWeight: () => 30,
|
||||
|
||||
hookTokenValidity: (options) => {
|
||||
if (options.type === 'refresh') {
|
||||
return { valid: false }
|
||||
}
|
||||
|
||||
if (options.type === 'access') {
|
||||
const token = options.token
|
||||
const now = new Date()
|
||||
now.setTime(now.getTime() - 5000)
|
||||
|
||||
const createdAt = new Date(token.createdAt)
|
||||
|
||||
return { valid: createdAt.getTime() >= now.getTime() }
|
||||
}
|
||||
|
||||
return { valid: true }
|
||||
},
|
||||
|
||||
login (body) {
|
||||
if (body.id === 'laguna' && body.password === 'laguna password') {
|
||||
return Promise.resolve({
|
||||
username: 'laguna',
|
||||
email: 'laguna@example.com',
|
||||
displayName: 'Laguna Loire',
|
||||
adminFlags: 1,
|
||||
videoQuota: 42000,
|
||||
videoQuotaDaily: 42100,
|
||||
|
||||
// Always use new value except for videoQuotaDaily field
|
||||
userUpdater: ({ fieldName, currentValue, newValue }) => {
|
||||
if (fieldName === 'videoQuotaDaily') return currentValue
|
||||
|
||||
return newValue
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
|
||||
// ###########################################################################
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-id-pass-auth-two",
|
||||
"version": "0.0.1",
|
||||
"description": "Id and pass auth two",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
const print = require('a-native-example')
|
||||
|
||||
async function register ({ getRouter }) {
|
||||
print('hello world')
|
||||
|
||||
const router = getRouter()
|
||||
|
||||
router.get('/', (req, res) => {
|
||||
print('hello world')
|
||||
res.sendStatus(204)
|
||||
})
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-native",
|
||||
"version": "0.0.1",
|
||||
"description": "Plugin test-native",
|
||||
"engine": {
|
||||
"peertube": ">=4.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {},
|
||||
"dependencies": {
|
||||
"a-native-example": "^1.0.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
async function register ({ registerHook, registerSetting, settingsManager, storageManager, peertubeHelpers }) {
|
||||
registerHook({
|
||||
target: 'filter:feed.podcast.rss.create-custom-xmlns.result',
|
||||
handler: (result, params) => {
|
||||
return result.concat([
|
||||
{
|
||||
name: "biz",
|
||||
value: "https://example.com/biz-xmlns",
|
||||
},
|
||||
])
|
||||
}
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:feed.podcast.channel.create-custom-tags.result',
|
||||
handler: (result, params) => {
|
||||
const { videoChannel } = params
|
||||
return result.concat([
|
||||
{
|
||||
name: "fooTag",
|
||||
attributes: { "bar": "baz" },
|
||||
value: "42",
|
||||
},
|
||||
{
|
||||
name: "biz:videoChannel",
|
||||
attributes: { "name": videoChannel.name, "id": videoChannel.id },
|
||||
},
|
||||
{
|
||||
name: "biz:buzzItem",
|
||||
value: [
|
||||
{
|
||||
name: "nestedTag",
|
||||
value: "example nested tag",
|
||||
},
|
||||
],
|
||||
},
|
||||
])
|
||||
}
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:feed.podcast.video.create-custom-tags.result',
|
||||
handler: (result, params) => {
|
||||
const { video, liveItem } = params
|
||||
return result.concat([
|
||||
{
|
||||
name: "fizzTag",
|
||||
attributes: { "bar": "baz" },
|
||||
value: "21",
|
||||
},
|
||||
{
|
||||
name: "biz:video",
|
||||
attributes: { "name": video.name, "id": video.id, "isLive": liveItem },
|
||||
},
|
||||
{
|
||||
name: "biz:buzz",
|
||||
value: [
|
||||
{
|
||||
name: "nestedTag",
|
||||
value: "example nested tag",
|
||||
},
|
||||
],
|
||||
}
|
||||
])
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
|
||||
// ############################################################################
|
||||
|
||||
function addToCount (obj) {
|
||||
return Object.assign({}, obj, { count: obj.count + 1 })
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-podcast-custom-tags",
|
||||
"version": "0.0.1",
|
||||
"description": "Plugin test custom tags in Podcast RSS feeds",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": []
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
async function register ({
|
||||
storageManager,
|
||||
peertubeHelpers,
|
||||
getRouter
|
||||
}) {
|
||||
const { logger } = peertubeHelpers
|
||||
|
||||
{
|
||||
await storageManager.storeData('superkey', { value: 'toto' })
|
||||
await storageManager.storeData('anotherkey', { value: 'toto2' })
|
||||
await storageManager.storeData('storedArrayKey', ['toto', 'toto2'])
|
||||
|
||||
const result = await storageManager.getData('superkey')
|
||||
logger.info('superkey stored value is %s', result.value)
|
||||
|
||||
const storedArrayValue = await storageManager.getData('storedArrayKey')
|
||||
logger.info('storedArrayKey isArray is %s', Array.isArray(storedArrayValue) ? 'true' : 'false')
|
||||
logger.info('storedArrayKey stored value is %s', storedArrayValue.join(', '))
|
||||
}
|
||||
|
||||
{
|
||||
getRouter().get('/create-file', async (req, res) => {
|
||||
const basePath = peertubeHelpers.plugin.getDataDirectoryPath()
|
||||
|
||||
fs.writeFile(path.join(basePath, 'Aladdin.txt'), 'Prince Ali', function (err) {
|
||||
if (err) return res.sendStatus(500)
|
||||
|
||||
res.sendStatus(200)
|
||||
})
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
|
||||
// ###########################################################################
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-six",
|
||||
"version": "0.0.1",
|
||||
"description": "Plugin test 6",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {}
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
async function register ({ transcodingManager }) {
|
||||
|
||||
// Output options
|
||||
{
|
||||
{
|
||||
const builder = () => {
|
||||
return {
|
||||
outputOptions: [
|
||||
'-r 10'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
transcodingManager.addVODProfile('libx264', 'low-vod', builder)
|
||||
}
|
||||
|
||||
{
|
||||
const builder = (options) => {
|
||||
return {
|
||||
outputOptions: [
|
||||
'-r:' + options.streamNum + ' 50'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
transcodingManager.addLiveProfile('libx264', 'high-live', builder)
|
||||
}
|
||||
}
|
||||
|
||||
// Input options
|
||||
{
|
||||
{
|
||||
const builder = () => {
|
||||
return {
|
||||
inputOptions: [
|
||||
'-r 5'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
transcodingManager.addVODProfile('libx264', 'input-options-vod', builder)
|
||||
}
|
||||
|
||||
{
|
||||
const builder = () => {
|
||||
return {
|
||||
inputOptions: [
|
||||
'-r 50'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
transcodingManager.addLiveProfile('libx264', 'input-options-live', builder)
|
||||
}
|
||||
}
|
||||
|
||||
// Scale filters
|
||||
{
|
||||
{
|
||||
const builder = () => {
|
||||
return {
|
||||
scaleFilter: {
|
||||
name: 'Glomgold'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
transcodingManager.addVODProfile('libx264', 'bad-scale-vod', builder)
|
||||
}
|
||||
|
||||
{
|
||||
const builder = () => {
|
||||
return {
|
||||
scaleFilter: {
|
||||
name: 'Flintheart'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
transcodingManager.addLiveProfile('libx264', 'bad-scale-live', builder)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-transcoding-one",
|
||||
"version": "0.0.1",
|
||||
"description": "Plugin test transcoding 1",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
async function register ({ transcodingManager }) {
|
||||
|
||||
{
|
||||
const builder = () => {
|
||||
return {
|
||||
outputOptions: []
|
||||
}
|
||||
}
|
||||
|
||||
transcodingManager.addVODProfile('libopus', 'test-vod-profile', builder)
|
||||
transcodingManager.addVODProfile('libvpx-vp9', 'test-vod-profile', builder)
|
||||
|
||||
transcodingManager.addVODEncoderPriority('audio', 'libopus', 1000)
|
||||
transcodingManager.addVODEncoderPriority('video', 'libvpx-vp9', 1000)
|
||||
}
|
||||
|
||||
{
|
||||
const builder = (options) => {
|
||||
return {
|
||||
outputOptions: [
|
||||
'-b:' + options.streamNum + ' 10K'
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
transcodingManager.addLiveProfile('libopus', 'test-live-profile', builder)
|
||||
transcodingManager.addLiveEncoderPriority('audio', 'libopus', 1000)
|
||||
}
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-transcoding-two",
|
||||
"version": "0.0.1",
|
||||
"description": "Plugin test transcoding 2",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
const d = new Date()
|
||||
exports.value = d.getTime()
|
||||
@@ -0,0 +1,14 @@
|
||||
const lib = require('./lib')
|
||||
|
||||
async function register ({ getRouter }) {
|
||||
const router = getRouter()
|
||||
router.get('/get', (req, res) => res.json({ message: lib.value }))
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-unloading",
|
||||
"version": "0.0.1",
|
||||
"description": "Plugin test (modules unloading)",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
async function register ({
|
||||
videoCategoryManager,
|
||||
videoLicenceManager,
|
||||
videoLanguageManager,
|
||||
videoPrivacyManager,
|
||||
playlistPrivacyManager,
|
||||
getRouter
|
||||
}) {
|
||||
videoLanguageManager.addConstant('al_bhed', 'Al Bhed')
|
||||
videoLanguageManager.addLanguage('al_bhed2', 'Al Bhed 2')
|
||||
videoLanguageManager.addConstant('al_bhed3', 'Al Bhed 3')
|
||||
videoLanguageManager.deleteConstant('en')
|
||||
videoLanguageManager.deleteLanguage('fr')
|
||||
videoLanguageManager.deleteConstant('al_bhed3')
|
||||
|
||||
videoCategoryManager.addCategory(42, 'Best category')
|
||||
videoCategoryManager.addConstant(43, 'High best category')
|
||||
videoCategoryManager.deleteConstant(1) // Music
|
||||
videoCategoryManager.deleteCategory(2) // Films
|
||||
|
||||
videoLicenceManager.addLicence(42, 'Best licence')
|
||||
videoLicenceManager.addConstant(43, 'High best licence')
|
||||
videoLicenceManager.deleteConstant(1) // Attribution
|
||||
videoLicenceManager.deleteConstant(7) // Public domain
|
||||
|
||||
videoPrivacyManager.deleteConstant(2)
|
||||
videoPrivacyManager.deletePrivacy(2)
|
||||
playlistPrivacyManager.deleteConstant(3)
|
||||
playlistPrivacyManager.deletePlaylistPrivacy(3)
|
||||
|
||||
{
|
||||
const router = getRouter()
|
||||
router.get('/reset-categories', (req, res) => {
|
||||
videoCategoryManager.resetConstants()
|
||||
|
||||
res.sendStatus(204)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async function unregister () {}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-video-constants",
|
||||
"version": "0.0.1",
|
||||
"description": "Plugin test video constants",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
const WebSocketServer = require('ws').WebSocketServer
|
||||
|
||||
async function register ({
|
||||
registerWebSocketRoute
|
||||
}) {
|
||||
const wss = new WebSocketServer({ noServer: true })
|
||||
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('message', function message(data) {
|
||||
if (data.toString() === 'ping') {
|
||||
ws.send('pong')
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
registerWebSocketRoute({
|
||||
route: '/toto',
|
||||
|
||||
handler: (request, socket, head) => {
|
||||
wss.handleUpgrade(request, socket, head, ws => {
|
||||
wss.emit('connection', ws, request)
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
|
||||
// ###########################################################################
|
||||
@@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "peertube-plugin-test-websocket",
|
||||
"version": "0.0.1",
|
||||
"description": "Plugin test websocket",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"Hi": "Coucou"
|
||||
}
|
||||
@@ -0,0 +1,526 @@
|
||||
async function register ({ registerHook, registerSetting, settingsManager, storageManager, peertubeHelpers }) {
|
||||
{
|
||||
registerSetting({
|
||||
name: 'unique-setting',
|
||||
label: 'Unique setting',
|
||||
type: 'select',
|
||||
options: []
|
||||
})
|
||||
|
||||
registerSetting({
|
||||
name: 'unique-setting',
|
||||
label: 'Unique setting',
|
||||
type: 'select',
|
||||
options: [
|
||||
{
|
||||
value: 1,
|
||||
label: 'One'
|
||||
}
|
||||
]
|
||||
})
|
||||
|
||||
registerSetting({
|
||||
label: 'Unnamed 1',
|
||||
type: 'input'
|
||||
})
|
||||
|
||||
registerSetting({
|
||||
label: 'Unnamed 2',
|
||||
type: 'input'
|
||||
})
|
||||
|
||||
const actionHooks = [
|
||||
'action:application.listening',
|
||||
'action:notifier.notification.created',
|
||||
|
||||
'action:api.video.updated',
|
||||
'action:api.video.deleted',
|
||||
'action:api.video.uploaded',
|
||||
'action:api.video.viewed',
|
||||
|
||||
'action:api.video.file-updated',
|
||||
|
||||
'action:api.video-channel.created',
|
||||
'action:api.video-channel.updated',
|
||||
'action:api.video-channel.deleted',
|
||||
|
||||
'action:api.live-video.created',
|
||||
'action:live.video.state.updated',
|
||||
|
||||
'action:api.video-thread.created',
|
||||
'action:api.video-comment-reply.created',
|
||||
'action:api.video-comment.deleted',
|
||||
|
||||
'action:api.video-caption.created',
|
||||
'action:api.video-caption.deleted',
|
||||
|
||||
'action:api.user.blocked',
|
||||
'action:api.user.unblocked',
|
||||
'action:api.user.registered',
|
||||
'action:api.user.created',
|
||||
'action:api.user.deleted',
|
||||
'action:api.user.updated',
|
||||
'action:api.user.oauth2-got-token',
|
||||
|
||||
'action:api.video-playlist-element.created'
|
||||
]
|
||||
|
||||
for (const h of actionHooks) {
|
||||
registerHook({
|
||||
target: h,
|
||||
handler: () => peertubeHelpers.logger.debug('Run hook %s.', h)
|
||||
})
|
||||
}
|
||||
|
||||
for (const h of [ 'action:activity-pub.remote-video.created', 'action:activity-pub.remote-video.updated' ]) {
|
||||
registerHook({
|
||||
target: h,
|
||||
handler: ({ video, videoAPObject }) => {
|
||||
peertubeHelpers.logger.debug('Run hook %s - AP %s - video %s.', h, video.name, videoAPObject.name )
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.videos.list.params',
|
||||
handler: obj => addToCount(obj)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.videos.list.result',
|
||||
handler: obj => addToTotal(obj)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video-playlist.videos.list.params',
|
||||
handler: obj => addToCount(obj)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video-playlist.videos.list.result',
|
||||
handler: obj => addToTotal(obj)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.accounts.videos.list.params',
|
||||
handler: obj => addToCount(obj)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.accounts.videos.list.result',
|
||||
handler: obj => addToTotal(obj, 2)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video-channels.videos.list.params',
|
||||
handler: obj => addToCount(obj, 3)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video-channels.videos.list.result',
|
||||
handler: obj => addToTotal(obj, 3)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.user.me.videos.list.params',
|
||||
handler: obj => addToCount(obj, 4)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.user.me.videos.list.result',
|
||||
handler: obj => addToTotal(obj, 4)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.user.me.get.result',
|
||||
handler: (result) => {
|
||||
result.customParam = 'Customized'
|
||||
|
||||
return result
|
||||
}
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.user.me.subscription-videos.list.params',
|
||||
handler: obj => addToCount(obj)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.user.me.subscription-videos.list.result',
|
||||
handler: obj => addToTotal(obj, 4)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video.get.result',
|
||||
handler: video => {
|
||||
video.name += ' <3'
|
||||
|
||||
return video
|
||||
}
|
||||
})
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video-channels.list.params',
|
||||
handler: obj => addToCount(obj, 1)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video-channels.list.result',
|
||||
handler: obj => addToTotal(obj, 1)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video-channel.get.result',
|
||||
handler: channel => {
|
||||
channel.name += ' <3'
|
||||
|
||||
return channel
|
||||
}
|
||||
})
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
for (const hook of [ 'filter:api.video.upload.accept.result', 'filter:api.live-video.create.accept.result' ]) {
|
||||
registerHook({
|
||||
target: hook,
|
||||
handler: ({ accepted }, { videoBody, liveVideoBody }) => {
|
||||
if (!accepted) return { accepted: false }
|
||||
|
||||
const name = videoBody
|
||||
? videoBody.name
|
||||
: liveVideoBody.name
|
||||
|
||||
if (name.indexOf('bad word') !== -1) return { accepted: false, errorMessage: 'bad word' }
|
||||
|
||||
return { accepted: true }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video.update-file.accept.result',
|
||||
handler: ({ accepted }, { videoFile }) => {
|
||||
if (!accepted) return { accepted: false }
|
||||
if (videoFile.filename.includes('webm')) return { accepted: false, errorMessage: 'no webm' }
|
||||
|
||||
return { accepted: true }
|
||||
}
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video.pre-import-url.accept.result',
|
||||
handler: ({ accepted }, { videoImportBody }) => {
|
||||
if (!accepted) return { accepted: false }
|
||||
if (videoImportBody.targetUrl.includes('bad')) return { accepted: false, errorMessage: 'bad target url' }
|
||||
|
||||
return { accepted: true }
|
||||
}
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video.pre-import-torrent.accept.result',
|
||||
handler: ({ accepted }, { videoImportBody }) => {
|
||||
if (!accepted) return { accepted: false }
|
||||
if (videoImportBody.name.includes('bad torrent')) return { accepted: false, errorMessage: 'bad torrent' }
|
||||
|
||||
return { accepted: true }
|
||||
}
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video.post-import-url.accept.result',
|
||||
handler: ({ accepted }, { video }) => {
|
||||
if (!accepted) return { accepted: false }
|
||||
if (video.name.includes('bad word')) return { accepted: false, errorMessage: 'bad word' }
|
||||
|
||||
return { accepted: true }
|
||||
}
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video.post-import-torrent.accept.result',
|
||||
handler: ({ accepted }, { video }) => {
|
||||
if (!accepted) return { accepted: false }
|
||||
if (video.name.includes('bad word')) return { accepted: false, errorMessage: 'bad word' }
|
||||
|
||||
return { accepted: true }
|
||||
}
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video.user-import.accept.result',
|
||||
handler: ({ accepted }, { videoBody }) => {
|
||||
if (!accepted) return { accepted: false }
|
||||
if (videoBody.name === 'video 1') return { accepted: false, errorMessage: 'bad word' }
|
||||
|
||||
return { accepted: true }
|
||||
}
|
||||
})
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video-thread.create.accept.result',
|
||||
handler: ({ accepted }, { commentBody }) => checkCommentBadWord(accepted, commentBody)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video-comment-reply.create.accept.result',
|
||||
handler: ({ accepted }, { commentBody }) => checkCommentBadWord(accepted, commentBody)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:activity-pub.remote-video-comment.create.accept.result',
|
||||
handler: ({ accepted }, { comment }) => checkCommentBadWord(accepted, comment)
|
||||
})
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
registerHook({
|
||||
target: 'filter:activity-pub.activity.context.build.result',
|
||||
handler: context => context.concat([ { recordedAt: 'https://schema.org/recordedAt' } ])
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:activity-pub.video.json-ld.build.result',
|
||||
handler: (jsonld, { video }) => ({ ...jsonld, videoName: video.name })
|
||||
})
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video-threads.list.params',
|
||||
handler: obj => addToCount(obj)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video-threads.list.result',
|
||||
handler: obj => addToTotal(obj)
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.video-thread-comments.list.result',
|
||||
handler: obj => {
|
||||
obj.data.forEach(c => c.text += ' <3')
|
||||
|
||||
return obj
|
||||
}
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:video.auto-blacklist.result',
|
||||
handler: (blacklisted, { video }) => {
|
||||
if (blacklisted) return true
|
||||
if (video.name.includes('please blacklist me')) return true
|
||||
|
||||
return false
|
||||
}
|
||||
})
|
||||
|
||||
{
|
||||
registerHook({
|
||||
target: 'filter:api.user.signup.allowed.result',
|
||||
handler: (result, params) => {
|
||||
if (params && params.body && params.body.email && params.body.email.includes('jma 1')) {
|
||||
return { allowed: false, errorMessage: 'No jma 1' }
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.user.request-signup.allowed.result',
|
||||
handler: (result, params) => {
|
||||
if (params && params.body && params.body.email && params.body.email.includes('jma 2')) {
|
||||
return { allowed: false, errorMessage: 'No jma 2' }
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.download.torrent.allowed.result',
|
||||
handler: (result, params) => {
|
||||
if (params && params.downloadName.includes('bad torrent')) {
|
||||
return { allowed: false, errorMessage: 'Liu Bei' }
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.download.video.allowed.result',
|
||||
handler: async (result, params) => {
|
||||
const loggedInUser = await peertubeHelpers.user.getAuthUser(params.res)
|
||||
if (loggedInUser) return { allowed: true }
|
||||
|
||||
if (params && !params.streamingPlaylist && params.video.name.includes('bad file')) {
|
||||
return { allowed: false, errorMessage: 'Cao Cao' }
|
||||
}
|
||||
|
||||
if (params && params.streamingPlaylist && params.video.name.includes('bad playlist file')) {
|
||||
return { allowed: false, errorMessage: 'Sun Jian' }
|
||||
}
|
||||
|
||||
return result
|
||||
}
|
||||
})
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
registerHook({
|
||||
target: 'filter:html.embed.video.allowed.result',
|
||||
handler: (result, params) => {
|
||||
return {
|
||||
allowed: false,
|
||||
html: 'Lu Bu'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:html.embed.video-playlist.allowed.result',
|
||||
handler: (result, params) => {
|
||||
return {
|
||||
allowed: false,
|
||||
html: 'Diao Chan'
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
registerHook({
|
||||
target: 'filter:html.client.json-ld.result',
|
||||
handler: (jsonld, context) => {
|
||||
if (!context || !context.video) return jsonld
|
||||
|
||||
return Object.assign(jsonld, { recordedAt: 'http://example.com/recordedAt' })
|
||||
}
|
||||
})
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
registerHook({
|
||||
target: 'filter:api.server.stats.get.result',
|
||||
handler: (result) => {
|
||||
return { ...result, customStats: 14 }
|
||||
}
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:job-queue.process.params',
|
||||
handler: (object, context) => {
|
||||
if (context.type !== 'video-studio-edition') return object
|
||||
|
||||
object.data.tasks = [
|
||||
{
|
||||
name: 'cut',
|
||||
options: {
|
||||
start: 0,
|
||||
end: 1
|
||||
}
|
||||
}
|
||||
]
|
||||
|
||||
return object
|
||||
}
|
||||
})
|
||||
|
||||
registerHook({
|
||||
target: 'filter:transcoding.auto.resolutions-to-transcode.result',
|
||||
handler: (object, context) => {
|
||||
if (context.video.name.includes('transcode-filter')) {
|
||||
object = [ 100 ]
|
||||
}
|
||||
|
||||
return object
|
||||
}
|
||||
})
|
||||
|
||||
// Upload/import/live attributes
|
||||
for (const target of [
|
||||
'filter:api.video.upload.video-attribute.result',
|
||||
'filter:api.video.import-url.video-attribute.result',
|
||||
'filter:api.video.import-torrent.video-attribute.result',
|
||||
'filter:api.video.live.video-attribute.result',
|
||||
'filter:api.video.user-import.video-attribute.result'
|
||||
]) {
|
||||
registerHook({
|
||||
target,
|
||||
handler: (result) => {
|
||||
return { ...result, description: result.description + ' - ' + target }
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
{
|
||||
const filterHooks = [
|
||||
'filter:api.search.videos.local.list.params',
|
||||
'filter:api.search.videos.local.list.result',
|
||||
'filter:api.search.videos.index.list.params',
|
||||
'filter:api.search.videos.index.list.result',
|
||||
'filter:api.search.video-channels.local.list.params',
|
||||
'filter:api.search.video-channels.local.list.result',
|
||||
'filter:api.search.video-channels.index.list.params',
|
||||
'filter:api.search.video-channels.index.list.result',
|
||||
'filter:api.search.video-playlists.local.list.params',
|
||||
'filter:api.search.video-playlists.local.list.result',
|
||||
'filter:api.search.video-playlists.index.list.params',
|
||||
'filter:api.search.video-playlists.index.list.result',
|
||||
|
||||
'filter:api.overviews.videos.list.params',
|
||||
'filter:api.overviews.videos.list.result',
|
||||
|
||||
'filter:job-queue.process.params',
|
||||
'filter:job-queue.process.result'
|
||||
]
|
||||
|
||||
for (const h of filterHooks) {
|
||||
registerHook({
|
||||
target: h,
|
||||
handler: (obj) => {
|
||||
peertubeHelpers.logger.debug('Run hook %s.', h)
|
||||
|
||||
return obj
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function unregister () {
|
||||
return
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
register,
|
||||
unregister
|
||||
}
|
||||
|
||||
// ############################################################################
|
||||
|
||||
function addToCount (obj, amount = 1) {
|
||||
return Object.assign({}, obj, { count: obj.count + amount })
|
||||
}
|
||||
|
||||
function addToTotal (result, amount = 1) {
|
||||
return {
|
||||
data: result.data,
|
||||
total: result.total + amount
|
||||
}
|
||||
}
|
||||
|
||||
function checkCommentBadWord (accepted, commentBody) {
|
||||
if (!accepted) return { accepted: false }
|
||||
if (commentBody.text.indexOf('bad word') !== -1) return { accepted: false, errorMessage: 'bad word '}
|
||||
|
||||
return { accepted: true }
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "peertube-plugin-test",
|
||||
"version": "0.0.1",
|
||||
"description": "Plugin test",
|
||||
"engine": {
|
||||
"peertube": ">=1.3.0"
|
||||
},
|
||||
"keywords": [
|
||||
"peertube",
|
||||
"plugin"
|
||||
],
|
||||
"homepage": "https://github.com/Chocobozzz/PeerTube",
|
||||
"author": "Chocobozzz",
|
||||
"bugs": "https://github.com/Chocobozzz/PeerTube/issues",
|
||||
"library": "./main.js",
|
||||
"staticDirs": {},
|
||||
"css": [],
|
||||
"clientScripts": [],
|
||||
"translations": {
|
||||
"fr-FR": "./languages/fr.json"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@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