1.2.json 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. {
  2. "$schema": "http://json-schema.org/draft-07/schema",
  3. "$id": "https://schemas.premid.app/metadata/1.0",
  4. "title": "Metadata",
  5. "type": "object",
  6. "description": "Metadata that describes a presence.",
  7. "definitions": {
  8. "user": {
  9. "type": "object",
  10. "description": "User information.",
  11. "properties": {
  12. "name": {
  13. "type": "string",
  14. "description": "The name of the user."
  15. },
  16. "id": {
  17. "type": "string",
  18. "description": "The Discord snowflake of the user.",
  19. "pattern": "^\\d+$"
  20. }
  21. },
  22. "additionalProperties": false,
  23. "required": ["name", "id"]
  24. }
  25. },
  26. "properties": {
  27. "$schema": {
  28. "$comment": "This is required otherwise the schema will fail itself when it is applied to a document via $schema. This is optional so that validators that use this schema don't fail if the metadata doesn't have the $schema property.",
  29. "type": "string",
  30. "description": "The metadata schema URL."
  31. },
  32. "author": {
  33. "$ref": "#/definitions/user",
  34. "description": "The author of this presence."
  35. },
  36. "contributors": {
  37. "type": "array",
  38. "description": "Any extra contributors to this presence.",
  39. "items": {
  40. "$ref": "#/definitions/user"
  41. }
  42. },
  43. "service": {
  44. "type": "string",
  45. "description": "The service this presence is for."
  46. },
  47. "altnames": {
  48. "type": "array",
  49. "description": "Alternative names for the service.",
  50. "items": {
  51. "type": "string",
  52. "description": "An alternative name."
  53. },
  54. "minItems": 1
  55. },
  56. "description": {
  57. "type": "object",
  58. "description": "A description of the presence in multiple languages.",
  59. "propertyNames": {
  60. "type": "string",
  61. "description": "The language key. The key must be languagecode(_REGIONCODE).",
  62. "pattern": "^[a-z]{2}(_[A-Z]{2})?$"
  63. },
  64. "patternProperties": {
  65. "^[a-z]{2}(_[A-Z]{2})?$": {
  66. "type": "string",
  67. "description": "The description of the presence in the key's language."
  68. }
  69. },
  70. "additionalProperties": false,
  71. "required": ["en"]
  72. },
  73. "url": {
  74. "type": ["string", "array"],
  75. "description": "The service's website URL, or an array of URLs. Protocols should not be added.",
  76. "pattern": "^(([a-z0-9-]+\\.)*[0-9a-z_-]+(\\.[a-z]+)+|(\\d{1,3}\\.){3}\\d{1,3}|localhost)$",
  77. "items": {
  78. "type": "string",
  79. "description": "One of the service's website URLs.",
  80. "pattern": "^(([a-z0-9-]+\\.)*[0-9a-z_-]+(\\.[a-z]+)+|(\\d{1,3}\\.){3}\\d{1,3}|localhost)$"
  81. },
  82. "minItems": 2
  83. },
  84. "version": {
  85. "type": "string",
  86. "description": "The SemVer version of the presence. Must just be major.minor.patch.",
  87. "pattern": "^\\d+\\.\\d+\\.\\d+$"
  88. },
  89. "logo": {
  90. "type": "string",
  91. "description": "The logo of the service this presence is for.",
  92. "pattern": "^https?:\\/\\/?(?:[a-z0-9-]+\\.)*[0-9a-z_-]+(?:\\.[a-z]+)+\\/.*$"
  93. },
  94. "thumbnail": {
  95. "type": "string",
  96. "description": "A thumbnail of the service this presence is for.",
  97. "pattern": "^https?:\\/\\/?([a-z0-9-]+\\.)*[0-9a-z_-]+(\\.[a-z]+)+\\/.*$"
  98. },
  99. "color": {
  100. "type": "string",
  101. "description": "The theme color of the service this presence is for. Must be either a 6 digit or a 3 digit hex code.",
  102. "pattern": "^#([A-Fa-f0-9]{3}){1,2}$"
  103. },
  104. "tags": {
  105. "type": ["array"],
  106. "description": "The tags for the presence.",
  107. "items": {
  108. "type": "string",
  109. "description": "A tag.",
  110. "pattern": "^[^A-Z\\s!\"#$%&'()*+,./:;<=>?@\\[\\\\\\]^_`{|}~]+$"
  111. },
  112. "minItems": 1
  113. },
  114. "category": {
  115. "type": "string",
  116. "description": "The category the presence falls under.",
  117. "enum": ["anime", "games", "music", "socials", "videos", "other"]
  118. },
  119. "iframe": {
  120. "type": "boolean",
  121. "description": "Whether or not the presence should run in IFrames."
  122. },
  123. "readLogs": {
  124. "type": "boolean",
  125. "description": "Whether or not the extension should be reading logs."
  126. },
  127. "regExp": {
  128. "type": "string",
  129. "description": "A regular expression used to match URLs for the presence to inject into."
  130. },
  131. "iFrameRegExp": {
  132. "type": "string",
  133. "description": "A regular expression used to match IFrames for the presence to inject into."
  134. },
  135. "button": {
  136. "type": "boolean",
  137. "description": "Controls whether the presence is automatically added when the extension is installed. For partner presences only."
  138. },
  139. "warning": {
  140. "type": "boolean",
  141. "description": "Shows a warning saying that it requires additional steps for the presence to function correctly."
  142. },
  143. "settings": {
  144. "type": "array",
  145. "description": "An array of settings the user can change in the presence.",
  146. "items": {
  147. "type": "object",
  148. "description": "A setting.",
  149. "properties": {
  150. "id": {
  151. "type": "string",
  152. "description": "The ID of the setting."
  153. },
  154. "title": {
  155. "type": "string",
  156. "description": "The title of the setting. Required only if `multiLanguage` is disabled."
  157. },
  158. "icon": {
  159. "type": "string",
  160. "description": "The icon of the setting. Required only if `multiLanguage` is disabled.",
  161. "pattern": "^fa[bs] fa-[0-9a-z-]+$"
  162. },
  163. "if": {
  164. "type": "object",
  165. "description": "Restrict showing this setting if another setting is the defined value.",
  166. "propertyNames": {
  167. "type": "string",
  168. "description": "The ID of the setting."
  169. },
  170. "patternProperties": {
  171. "": {
  172. "type": ["string", "number", "boolean"],
  173. "description": "The value of the setting."
  174. }
  175. },
  176. "additionalProperties": false
  177. },
  178. "placeholder": {
  179. "type": "string",
  180. "description": "The placeholder for settings that require input. Shown when the input is empty."
  181. },
  182. "value": {
  183. "type": ["string", "number", "boolean"],
  184. "description": "The default value of the setting. Not compatible with `values`."
  185. },
  186. "values": {
  187. "type": "array",
  188. "description": "The default values of the setting. Not compatible with `value`.",
  189. "items": {
  190. "type": ["string", "number", "boolean"],
  191. "description": "The value of the setting."
  192. }
  193. },
  194. "multiLanguage": {
  195. "type": ["string", "boolean", "array"],
  196. "description": "When false, multi-localization is disabled. When true, strings from the `general.json` file are available for use. When a string, it is the name of a file (excluding .json) of a used language from the localization GitHub repo. When an array of strings, it is all of the file names (excluding .json) of used languages from the localization GitHub repo.",
  197. "items": {
  198. "type": "string",
  199. "description": "The name of a file from the localization GitHub repository."
  200. }
  201. }
  202. },
  203. "additionalProperties": false
  204. }
  205. }
  206. },
  207. "additionalProperties": false,
  208. "required": [
  209. "author",
  210. "service",
  211. "description",
  212. "url",
  213. "version",
  214. "logo",
  215. "thumbnail",
  216. "color",
  217. "tags",
  218. "category"
  219. ]
  220. }