Skip to content

Commit c86c35b

Browse files
authored
Merge pull request #1 from Acode-Foundation/plugin-schema
feat: add plugin schema v0.1.0 endpoint
2 parents 161a098 + 79d5f5d commit c86c35b

2 files changed

Lines changed: 137 additions & 1 deletion

File tree

schemas/plugin.v0.1.0.json

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-07/schema#",
3+
"title": "Manifest",
4+
"description": "Acode plugin manifest that is contained inside the file `plugin.json`",
5+
"type": "object",
6+
"properties": {
7+
"author": {
8+
"description": "Details about the plugin author, including name, email, URL, and GitHub username.",
9+
"type": "object",
10+
"properties": {
11+
"email": {
12+
"description": "Email of the author",
13+
"type": "string"
14+
},
15+
"github": {
16+
"description": "GitHub username of the author",
17+
"type": "string"
18+
},
19+
"name": {
20+
"description": "Name of the author",
21+
"type": "string"
22+
},
23+
"url": {
24+
"description": "Url of the author",
25+
"type": "string"
26+
}
27+
},
28+
"required": ["name"]
29+
},
30+
"changelogs": {
31+
"description": "Path to the changelog file documenting version updates and modifications.",
32+
"type": "string"
33+
},
34+
"contributors": {
35+
"description": "An array of objects containing details about project contributors.",
36+
"type": "array",
37+
"items": {
38+
"type": "object",
39+
"properties": {
40+
"github": {
41+
"description": "Contributor's GitHub username.",
42+
"type": "string"
43+
},
44+
"name": {
45+
"description": "Contributor's name.",
46+
"type": "string"
47+
},
48+
"role": {
49+
"description": "Contributor's role in the project.",
50+
"type": "string"
51+
}
52+
}
53+
},
54+
"uniqueItems": true
55+
},
56+
"dependencies": {
57+
"description": "An array plugins to be installed along with plugin",
58+
"type": "array",
59+
"items": {
60+
"description": "Plugin id of dependency",
61+
"type": "string"
62+
},
63+
"uniqueItems": true
64+
},
65+
"files": {
66+
"description": "An array listing the files to be included in the plugin zip file.",
67+
"type": "array",
68+
"items": {
69+
"type": "string"
70+
},
71+
"uniqueItems": true
72+
},
73+
"icon": {
74+
"description": "Path to the icon.png file, serving as the visual representation of the plugin. Icon file size must less than or equal to 50Kb",
75+
"type": "string"
76+
},
77+
"id": {
78+
"description": "Unique identifier for the plugin, following the reverse domain name format or what ever you want (e.g., \"com.example.plugin\").",
79+
"type": "string"
80+
},
81+
"keywords": {
82+
"description": "An array of strings providing searchable terms related to the plugin.",
83+
"type": "array",
84+
"items": {
85+
"type": "string"
86+
},
87+
"uniqueItems": true
88+
},
89+
"main": {
90+
"description": "Path to the bundled main.js file or your plugin's main javascript file, which contains the actual code for the plugin.",
91+
"type": "string"
92+
},
93+
"minVersionCode": {
94+
"description": "Minimum Acode version code required to run the plugin. The plugin will be available only for Acode versions greater than or equal to the specified code.",
95+
"type": "integer",
96+
"minimum": 290
97+
},
98+
"name": {
99+
"description": "Descriptive name of the plugin.",
100+
"type": "string"
101+
},
102+
"price": {
103+
"description": "Price of the plugin in INR (Indian Rupees). If set to 0 or omitted, the plugin is free. This attribute allows for monetization of plugins with a defined price range.",
104+
"maximum": 10000,
105+
"minimum": 0,
106+
"type": "integer"
107+
},
108+
"readme": {
109+
"description": "Path to the readme.md file, providing documentation and information about the plugin.",
110+
"type": "string"
111+
},
112+
"version": {
113+
"description": "Version number of the plugin. Must be incremented for updates.",
114+
"type": "string"
115+
}
116+
},
117+
"required": ["id", "name", "main", "version", "readme", "icon", "author"]
118+
}

server/main.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,30 @@ async function main() {
5656
target: {
5757
namespace: 'android_app',
5858
package_name: 'com.foxdebug.acodefree',
59-
sha256_cert_fingerprints: ['12:66:9B:CA:68:91:87:C3:2A:49:ED:9B:5B:06:3A:06:0E:5B:67:75:34:50:4F:46:DC:DA:A0:AF:71:90:CB:93'],
59+
sha256_cert_fingerprints: [
60+
'12:66:9B:CA:68:91:87:C3:2A:49:ED:9B:5B:06:3A:06:0E:5B:67:75:34:50:4F:46:DC:DA:A0:AF:71:90:CB:93',
61+
],
6062
},
6163
},
6264
]);
6365
});
6466

67+
app.get('/schema/:type/v:version.json', (req, res) => {
68+
const { type, version } = req.params;
69+
if (!['plugin'].includes(type)) {
70+
res.status(404).send({ error: 'Schema not found' });
71+
return;
72+
}
73+
const file = path.resolve(__dirname, `./schemas/${type}.v${version}.json`);
74+
if (fs.existsSync(file)) {
75+
res.header('Content-Type', 'application/schema+json');
76+
const schema = JSON.parse(fs.readFileSync(file, 'utf8'));
77+
res.send(schema);
78+
return;
79+
}
80+
res.status(404).send({ error: 'Schema not found' });
81+
});
82+
6583
app.get('/res/:filename', (req, res) => {
6684
if (!/\.(png|jpg|jpeg|ico|svg|webp)$/.test(req.params.filename)) {
6785
res.status(404).send({ error: 'File not found' });

0 commit comments

Comments
 (0)