Skip to content

Commit 993522e

Browse files
committed
refactor: Rename generatorUrl to _generatorUrl and add schema enhancements
Schema Changes: - generatorUrl → _generatorUrl (consistent with underscore prefix pattern) - Added _installUrl for full .json URLs (pattern: ^https?://.*\\.json$) - sourceUrl_ → _sourceUrl (moved underscore to prefix) - iconUrl_ → _iconUrl (moved underscore to prefix) - Added deprecation notes for old properties Site.js Changes: - Updated to check data._generatorUrl instead of data.generatorUrl - Added support for data._installUrl with full URL validation - Maintains backward compatibility Sources.json Changes: - S.to-like Generator: generatorUrl → _generatorUrl - Follows standard underscore prefix convention for extensions
1 parent fb5197c commit 993522e

File tree

3 files changed

+29
-9
lines changed

3 files changed

+29
-9
lines changed

assets/js/site.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,9 +155,12 @@ function generateCard(data) {
155155
<p class="card-text">${data.description}</p>
156156
<div class="d-flex justify-content-between align-items-center">
157157
<div class="btn-group">`;
158-
// Check for generatorUrl - if present, show "Generate" button instead of "Install"
159-
if (varExists(data.generatorUrl)) {
160-
html += `<a href="${data.generatorUrl}" target="_blank" rel="noopener noreferrer"><button type="button" class="btn btn-sm btn-success">🚀 Generate</button></a>&nbsp;`;
158+
// Check for _generatorUrl - if present, show "Generate" button instead of "Install"
159+
if (varExists(data._generatorUrl)) {
160+
html += `<a href="${data._generatorUrl}" target="_blank" rel="noopener noreferrer"><button type="button" class="btn btn-sm btn-success">🚀 Generate</button></a>&nbsp;`;
161+
} else if (varExists(data._installUrl)) {
162+
// Use _installUrl if provided (full .json URL)
163+
html += `<a href="grayjay://plugin/${data._installUrl}" target="_blank" rel="noopener noreferrer"><button type="button" class="btn btn-sm btn-primary">Install</button></a>&nbsp;`;
161164
} else if (varExists(installUrl)) {
162165
html += `<a href="${installUrl}" target="_blank" rel="noopener noreferrer"><button type="button" class="btn btn-sm btn-primary">Install</button></a>&nbsp;`;
163166
}

sources.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2311,7 +2311,7 @@
23112311
]
23122312
},
23132313
"note": "⚠️ This is a generator tool! Visit https://grayjay-sources.github.io/grayjay-source-sto-like/ to create your custom plugin",
2314-
"generatorUrl": "https://grayjay-sources.github.io/grayjay-source-sto-like/"
2314+
"_generatorUrl": "https://grayjay-sources.github.io/grayjay-source-sto-like/"
23152315
},
23162316
{
23172317
"name": "Sample",

sources.schema.json

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,22 +109,40 @@
109109
"$ref": "#/definitions/CustomButton"
110110
}
111111
},
112-
"generatorUrl": {
112+
"_generatorUrl": {
113113
"type": "string",
114114
"format": "uri",
115115
"description": "URL to a web-based generator for creating custom plugin instances. If present, shows a 'Generate' button instead of 'Install'"
116116
},
117+
"_installUrl": {
118+
"type": "string",
119+
"format": "uri",
120+
"pattern": "^https?://.*\\.json$",
121+
"description": "Full URL to the config.json file for direct installation. Must be a valid .json URL (not relative)"
122+
},
117123
"_nsfw": {
118124
"type": "boolean",
119125
"description": "Mark source as NSFW content. Will be filtered by default unless user opts in"
120126
},
127+
"_sourceUrl": {
128+
"type": "string",
129+
"format": "uri",
130+
"description": "Relative source URL before conversion to absolute"
131+
},
132+
"_iconUrl": {
133+
"type": "string",
134+
"format": "uri",
135+
"description": "Relative icon URL before conversion to absolute"
136+
},
121137
"iconUrl_": {
122138
"type": "string",
123-
"format": "uri"
139+
"format": "uri",
140+
"description": "Deprecated: Use _iconUrl instead"
124141
},
125142
"sourceUrl_": {
126143
"type": "string",
127-
"format": "uri"
144+
"format": "uri",
145+
"description": "Deprecated: Use _sourceUrl instead"
128146
},
129147
"allowAllHttpHeaderAccess": {
130148
"type": "boolean"
@@ -229,8 +247,7 @@
229247
"DomainHeadersToFind": {
230248
"type": "object",
231249
"additionalProperties": true,
232-
"properties": {
233-
},
250+
"properties": {},
234251
"required": [],
235252
"title": "DomainHeadersToFind"
236253
},

0 commit comments

Comments
 (0)