-
Notifications
You must be signed in to change notification settings - Fork 150
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
1,011 additions
and
203 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// ==UserSubscribe== | ||
// @name 订阅脚本 | ||
// @description 可以通过指定脚本url订阅一系列的脚本 | ||
// @version 1.0.0 | ||
// @author You | ||
// @connect www.baidu.com | ||
// @scriptUrl https://scriptcat.org/scripts/code/22/test.user.js | ||
// ==/UserSubscribe== |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import IoC from "@App/app/ioc"; | ||
import MessageInternal from "@App/app/message/internal"; | ||
import { | ||
Subscribe, | ||
SUBSCRIBE_STATUS_DISABLE, | ||
SUBSCRIBE_STATUS_ENABLE, | ||
SubscribeDAO, | ||
} from "@App/app/repo/subscribe"; | ||
import Controller from "../controller"; | ||
|
||
@IoC.Singleton(MessageInternal) | ||
export default class SubscribeController extends Controller { | ||
subscribeDAO = new SubscribeDAO(); | ||
|
||
constructor(internal: MessageInternal) { | ||
super(internal, "subscribe"); | ||
} | ||
|
||
upsert(subscribe: Subscribe) { | ||
return this.dispatchEvent("upsert", subscribe); | ||
} | ||
|
||
enable(id: number) { | ||
// 订阅脚本开启和关闭没有副作用,直接修改数据库 | ||
return this.subscribeDAO.update(id, { | ||
status: SUBSCRIBE_STATUS_ENABLE, | ||
}); | ||
} | ||
|
||
disable(id: number) { | ||
return this.subscribeDAO.update(id, { | ||
status: SUBSCRIBE_STATUS_DISABLE, | ||
}); | ||
} | ||
|
||
checkUpdate(id: number) { | ||
return this.dispatchEvent("checkUpdate", id); | ||
} | ||
|
||
delete(id: number) { | ||
return this.dispatchEvent("delete", id); | ||
} | ||
} |
Oops, something went wrong.