Ver código fonte

designing v2 paste & comment format

El RIDO 7 anos atrás
pai
commit
c15351b793
5 arquivos alterados com 239 adições e 31 exclusões
  1. 26 10
      js/comment.jsonld
  2. 38 3
      js/commentmeta.jsonld
  3. 30 12
      js/paste.jsonld
  4. 50 6
      js/pastemeta.jsonld
  5. 95 0
      js/types.jsonld

+ 26 - 10
js/comment.jsonld

@@ -1,16 +1,32 @@
 {
 	"@context": {
 		"so": "https://schema.org/",
-		"status": "so:Integer",
-		"id": "so:name",
-		"parentid": "so:name",
-		"url: {
-			"@id": "so:url",
-			"@type": "@id"
-		},
-		"data": "so:Text",
+		"pb": "?jsonld=types#",
+		"cm": "?jsonld=commentmeta#",
+		"status": {
+			"@type": "so:Integer"
+		},
+		"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"
+		},
 		"meta": {
-			"@id": "?jsonld=commentmeta"
-		}
+			"@type": "cm:MetaData"
+		},
 	}
 }

+ 38 - 3
js/commentmeta.jsonld

@@ -1,8 +1,43 @@
 {
 	"@context": {
 		"so": "https://schema.org/",
-		"postdate": "so:Integer",
-		"nickname": "so:Text",
-		"vizhash": "so:Text"
+		"pb": "?jsonld=types#"
+	},
+	"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"
+		}
 	}
 }

+ 30 - 12
js/paste.jsonld

@@ -1,24 +1,42 @@
 {
 	"@context": {
 		"so": "https://schema.org/",
-		"status": {"@id": "so:Integer"},
-		"id": {"@id": "so:name"},
-		"deletetoken": {"@id": "so:Text"},
+		"pb": "?jsonld=types#",
+		"pm": "?jsonld=pastemeta#",
+		"status": {
+			"@type": "so:Integer"
+		},
+		"id": {
+			"@type": "so:name"
+		},
+		"deletetoken": {
+			"@type": "so:Text"
+		},
 		"url": {
-			"@type": "@id",
-			"@id": "so: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": {
-			"@id": "?jsonld=pastemeta"
+			"@type": "pm:MetaData"
 		},
 		"comments": {
-			"@id": "?jsonld=comment",
+			"@type": "?jsonld=comment",
 			"@container": "@list"
 		},
-		"comment_count": {"@id": "so:Integer"},
-		"comment_offset": {"@id": "so:Integer"}
+		"comment_count": {
+			"@type": "so:Integer"
+		},
+		"comment_offset": {
+			"@type": "so:Integer"
+		}
 	}
 }

+ 50 - 6
js/pastemeta.jsonld

@@ -1,11 +1,55 @@
 {
 	"@context": {
 		"so": "https://schema.org/",
-		"formatter": {"@id": "so:Text"},
-		"postdate": {"@id": "so:Integer"},
-		"opendiscussion": {"@id": "so:True"},
-		"burnafterreading": {"@id": "so:True"},
-		"expire_date": {"@id": "so:Integer"},
-		"remaining_time": {"@id": "so:Integer"}
+		"pb": "?jsonld=types#"
+	},
+	"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"
+			},
+			{
+				"@type": "pb:Formatter"
+			},
+			{
+				"@type": "pb:OpenDiscussion"
+			},
+			{
+				"@type": "pb:BurnAfterReading"
+			},
+			{
+				"@type": "pb:Expire"
+			}
+		]
+	},
+	"MetaData": {
+		"created": {
+			"@type": "pb:CreationTime"
+		},
+		"time_to_live": {
+			"@type": "pb:RemainingSeconds"
+		}
 	}
 }

+ 95 - 0
js/types.jsonld

@@ -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
+	}
+}