designing v2 paste & comment format

This commit is contained in:
El RIDO 2018-12-17 19:43:16 +01:00
parent cde96d8f24
commit c15351b793
No known key found for this signature in database
GPG Key ID: 0F5C940A6BD81F92
5 changed files with 239 additions and 31 deletions

View File

@ -1,16 +1,32 @@
{ {
"@context": { "@context": {
"so": "https://schema.org/", "so": "https://schema.org/",
"status": "so:Integer", "pb": "?jsonld=types#",
"id": "so:name", "cm": "?jsonld=commentmeta#",
"parentid": "so:name", "status": {
"url: { "@type": "so:Integer"
"@id": "so:url", },
"@type": "@id" "id": {
"@type": "so:name"
},
"parentid": {
"@type": "so:name"
},
"url": {
"@type": "so:url"
},
"v": {
"@type": "so:Integer",
"@value": 2
},
"ct": {
"@type": "pb:CipherText"
},
"adata": {
"@type": "cm:AuthenticatedData"
}, },
"data": "so:Text",
"meta": { "meta": {
"@id": "?jsonld=commentmeta" "@type": "cm:MetaData"
} },
} }
} }

View File

@ -1,8 +1,43 @@
{ {
"@context": { "@context": {
"so": "https://schema.org/", "so": "https://schema.org/",
"postdate": "so:Integer", "pb": "?jsonld=types#"
"nickname": "so:Text", },
"vizhash": "so:Text" "AuthenticatedData": {
"@container": "@list",
"@value": [
{
"@type": "pb:InitializationVector"
},
{
"@type": "pb:Salt"
},
{
"@type": "pb:Iterations"
},
{
"@type": "pb:KeySize"
},
{
"@type": "pb:TagSize"
},
{
"@type": "pb:Algorithm"
},
{
"@type": "pb:Mode"
},
{
"@type": "pb:Compression"
}
]
},
"MetaData": {
"created": {
"@type": "CreationTime"
},
"icon": {
"@type": "so:url"
}
} }
} }

View File

@ -1,24 +1,42 @@
{ {
"@context": { "@context": {
"so": "https://schema.org/", "so": "https://schema.org/",
"status": {"@id": "so:Integer"}, "pb": "?jsonld=types#",
"id": {"@id": "so:name"}, "pm": "?jsonld=pastemeta#",
"deletetoken": {"@id": "so:Text"}, "status": {
"url": { "@type": "so:Integer"
"@type": "@id", },
"@id": "so:url" "id": {
"@type": "so:name"
},
"deletetoken": {
"@type": "so:Text"
},
"url": {
"@type": "so:url"
},
"v": {
"@type": "so:Integer",
"@value": 2
},
"ct": {
"@type": "pb:CipherText"
},
"adata": {
"@type": "pm:AuthenticatedData"
}, },
"data": {"@id": "so:Text"},
"attachment": {"@id": "so:Text"},
"attachmentname": {"@id": "so:Text"},
"meta": { "meta": {
"@id": "?jsonld=pastemeta" "@type": "pm:MetaData"
}, },
"comments": { "comments": {
"@id": "?jsonld=comment", "@type": "?jsonld=comment",
"@container": "@list" "@container": "@list"
}, },
"comment_count": {"@id": "so:Integer"}, "comment_count": {
"comment_offset": {"@id": "so:Integer"} "@type": "so:Integer"
},
"comment_offset": {
"@type": "so:Integer"
}
} }
} }

View File

@ -1,11 +1,55 @@
{ {
"@context": { "@context": {
"so": "https://schema.org/", "so": "https://schema.org/",
"formatter": {"@id": "so:Text"}, "pb": "?jsonld=types#"
"postdate": {"@id": "so:Integer"}, },
"opendiscussion": {"@id": "so:True"}, "AuthenticatedData": {
"burnafterreading": {"@id": "so:True"}, "@container": "@list",
"expire_date": {"@id": "so:Integer"}, "@value": [
"remaining_time": {"@id": "so:Integer"} {
"@type": "pb:InitializationVector"
},
{
"@type": "pb:Salt"
},
{
"@type": "pb:Iterations"
},
{
"@type": "pb:KeySize"
},
{
"@type": "pb:TagSize"
},
{
"@type": "pb:Algorithm"
},
{
"@type": "pb:Mode"
},
{
"@type": "pb:Compression"
},
{
"@type": "pb:Formatter"
},
{
"@type": "pb:OpenDiscussion"
},
{
"@type": "pb:BurnAfterReading"
},
{
"@type": "pb:Expire"
}
]
},
"MetaData": {
"created": {
"@type": "pb:CreationTime"
},
"time_to_live": {
"@type": "pb:RemainingSeconds"
}
} }
} }

95
js/types.jsonld Normal file
View File

@ -0,0 +1,95 @@
{
"@context": {
"so": "https://schema.org/",
"dp": "http://dbpedia.org/resource/",
"pb": "?jsonld=types#"
},
"Base64": {
"@type": "so:Text"
},
"CipherText": {
"@type": "pb:Base64"
},
"PasteCipherMessage": {
"paste": {
"@type": "so:Text"
},
"attachment": {
"@type": "so:MediaObject"
},
"attachment_name": {
"@type": "so:Text"
}
},
"CommentCipherMessage": {
"comment": {
"@type": "so:Text"
},
"nickname": {
"@type": "so:Text"
}
},
"InitializationVector": {
"@type": "pb:Base64"
},
"Salt": {
"@type": "pb:Base64"
},
"Iterations": {
"@type": "so:Integer",
"@minimum": 1
},
"KeySize": {
"@type": "so:Integer",
"@value": 256,
"@minimum": 128,
"@maximum": 256,
"@enum": [128, 196, 256]
},
"TagSize": {
"@type": "so:Integer",
"@value": 128,
"@minimum": 32,
"@maximum": 128,
"@enum": [32, 64, 96, 104, 112, 120, 128]
},
"Algorithm": {
"@type": "so:Text",
"@value": "aes"
},
"Mode": {
"@type": "so:Text",
"@value": "gcm",
"@enum": ["ctr", "cbc", "gcm"]
},
"Compression": {
"@type": "so:Text",
"@value": "zlib",
"@enum": ["zlib", "none"]
},
"Formatter": {
"@type": "so:Text",
"@value": "plaintext",
"@enum": ["plaintext", "syntaxhighlighting", "markdown"]
},
"Expire": {
"@type": "so:Text",
"@value": "1week",
"@enum": ["5min", "10min", "1hour", "1day", "1week", "1month", "1year", "never"]
},
"OpenDiscussion": {
"@type": "so:Boolean",
"@enum": [false, true]
},
"BurnAfterReading": {
"@type": "so:Boolean",
"@enum": [false, true]
},
"CreationTime": {
"@type": "dp:Unix_time"
},
"RemainingSeconds": {
"@type": "dp:Second",
"@minimum": 1
}
}