mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2025-08-13 17:29:01 +08:00
feat: Added replaceArtifact API
This commit is contained in:
parent
4a0319e95f
commit
4dd86cb368
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sub-store",
|
"name": "sub-store",
|
||||||
"version": "2.14.12",
|
"version": "2.14.13",
|
||||||
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
"description": "Advanced Subscription Manager for QX, Loon, Surge, Stash and ShadowRocket.",
|
||||||
"main": "src/main.js",
|
"main": "src/main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -19,7 +19,10 @@ export default function register($app) {
|
|||||||
if (!$.read(ARTIFACTS_KEY)) $.write({}, ARTIFACTS_KEY);
|
if (!$.read(ARTIFACTS_KEY)) $.write({}, ARTIFACTS_KEY);
|
||||||
|
|
||||||
// RESTful APIs
|
// RESTful APIs
|
||||||
$app.route('/api/artifacts').get(getAllArtifacts).post(createArtifact);
|
$app.route('/api/artifacts')
|
||||||
|
.get(getAllArtifacts)
|
||||||
|
.post(createArtifact)
|
||||||
|
.put(replaceArtifact);
|
||||||
|
|
||||||
$app.route('/api/artifact/:name')
|
$app.route('/api/artifact/:name')
|
||||||
.get(getArtifact)
|
.get(getArtifact)
|
||||||
@ -32,6 +35,12 @@ function getAllArtifacts(req, res) {
|
|||||||
success(res, allArtifacts);
|
success(res, allArtifacts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function replaceArtifact(req, res) {
|
||||||
|
const allArtifacts = req.body;
|
||||||
|
$.write(allArtifacts, ARTIFACTS_KEY);
|
||||||
|
success(res);
|
||||||
|
}
|
||||||
|
|
||||||
async function getArtifact(req, res) {
|
async function getArtifact(req, res) {
|
||||||
let { name } = req.params;
|
let { name } = req.params;
|
||||||
name = decodeURIComponent(name);
|
name = decodeURIComponent(name);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user