@whyour/qinglong 0.19.5 → 0.19.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whyour/qinglong",
3
- "version": "0.19.5",
3
+ "version": "0.19.7",
4
4
  "description": "Timed task management platform supporting Python3, JavaScript, Shell, Typescript",
5
5
  "repository": {
6
6
  "type": "git",
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthModel = exports.AuthDataType = exports.LoginStatus = exports.AuthInfo = void 0;
4
+ const _1 = require(".");
5
+ const sequelize_1 = require("sequelize");
6
+ class AuthInfo {
7
+ constructor(options) {
8
+ this.ip = options.ip;
9
+ this.info = options.info;
10
+ this.type = options.type;
11
+ this.id = options.id;
12
+ }
13
+ }
14
+ exports.AuthInfo = AuthInfo;
15
+ var LoginStatus;
16
+ (function (LoginStatus) {
17
+ LoginStatus[LoginStatus["success"] = 0] = "success";
18
+ LoginStatus[LoginStatus["fail"] = 1] = "fail";
19
+ })(LoginStatus || (exports.LoginStatus = LoginStatus = {}));
20
+ var AuthDataType;
21
+ (function (AuthDataType) {
22
+ AuthDataType["loginLog"] = "loginLog";
23
+ AuthDataType["authToken"] = "authToken";
24
+ AuthDataType["notification"] = "notification";
25
+ AuthDataType["removeLogFrequency"] = "removeLogFrequency";
26
+ AuthDataType["systemConfig"] = "systemConfig";
27
+ })(AuthDataType || (exports.AuthDataType = AuthDataType = {}));
28
+ exports.AuthModel = _1.sequelize.define('Auth', {
29
+ ip: sequelize_1.DataTypes.STRING,
30
+ type: sequelize_1.DataTypes.STRING,
31
+ info: {
32
+ type: sequelize_1.DataTypes.JSON,
33
+ allowNull: true,
34
+ },
35
+ });
36
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CrontabModel = exports.CrontabStatus = exports.Crontab = void 0;
4
+ const _1 = require(".");
5
+ const sequelize_1 = require("sequelize");
6
+ class Crontab {
7
+ constructor(options) {
8
+ this.name = options.name;
9
+ this.command = options.command.trim();
10
+ this.schedule = options.schedule;
11
+ this.saved = options.saved;
12
+ this.id = options.id;
13
+ this.status =
14
+ typeof options.status === 'number' && CrontabStatus[options.status]
15
+ ? options.status
16
+ : CrontabStatus.idle;
17
+ this.timestamp = new Date().toString();
18
+ this.isSystem = options.isSystem || 0;
19
+ this.pid = options.pid;
20
+ this.isDisabled = options.isDisabled || 0;
21
+ this.log_path = options.log_path || '';
22
+ this.isPinned = options.isPinned || 0;
23
+ this.labels = options.labels || [];
24
+ this.last_running_time = options.last_running_time || 0;
25
+ this.last_execution_time = options.last_execution_time || 0;
26
+ this.sub_id = options.sub_id;
27
+ this.extra_schedules = options.extra_schedules;
28
+ this.task_before = options.task_before;
29
+ this.task_after = options.task_after;
30
+ }
31
+ }
32
+ exports.Crontab = Crontab;
33
+ var CrontabStatus;
34
+ (function (CrontabStatus) {
35
+ CrontabStatus[CrontabStatus["running"] = 0] = "running";
36
+ CrontabStatus[CrontabStatus["queued"] = 0.5] = "queued";
37
+ CrontabStatus[CrontabStatus["idle"] = 1] = "idle";
38
+ CrontabStatus[CrontabStatus["disabled"] = 2] = "disabled";
39
+ })(CrontabStatus || (exports.CrontabStatus = CrontabStatus = {}));
40
+ exports.CrontabModel = _1.sequelize.define('Crontab', {
41
+ name: {
42
+ unique: 'compositeIndex',
43
+ type: sequelize_1.DataTypes.STRING,
44
+ },
45
+ command: {
46
+ unique: 'compositeIndex',
47
+ type: sequelize_1.DataTypes.STRING,
48
+ },
49
+ schedule: {
50
+ unique: 'compositeIndex',
51
+ type: sequelize_1.DataTypes.STRING,
52
+ },
53
+ timestamp: sequelize_1.DataTypes.STRING,
54
+ saved: sequelize_1.DataTypes.BOOLEAN,
55
+ status: sequelize_1.DataTypes.NUMBER,
56
+ isSystem: sequelize_1.DataTypes.NUMBER,
57
+ pid: sequelize_1.DataTypes.NUMBER,
58
+ isDisabled: sequelize_1.DataTypes.NUMBER,
59
+ isPinned: sequelize_1.DataTypes.NUMBER,
60
+ log_path: sequelize_1.DataTypes.STRING,
61
+ labels: sequelize_1.DataTypes.JSON,
62
+ last_running_time: sequelize_1.DataTypes.NUMBER,
63
+ last_execution_time: sequelize_1.DataTypes.NUMBER,
64
+ sub_id: { type: sequelize_1.DataTypes.NUMBER, allowNull: true },
65
+ extra_schedules: sequelize_1.DataTypes.JSON,
66
+ task_before: sequelize_1.DataTypes.STRING,
67
+ task_after: sequelize_1.DataTypes.STRING,
68
+ });
69
+ //# sourceMappingURL=cron.js.map
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CrontabViewModel = exports.CrontabView = exports.CronViewType = void 0;
4
+ const _1 = require(".");
5
+ const sequelize_1 = require("sequelize");
6
+ var CronViewType;
7
+ (function (CronViewType) {
8
+ CronViewType[CronViewType["\u7CFB\u7EDF"] = 1] = "\u7CFB\u7EDF";
9
+ CronViewType[CronViewType["\u4E2A\u4EBA"] = 2] = "\u4E2A\u4EBA";
10
+ })(CronViewType || (exports.CronViewType = CronViewType = {}));
11
+ class CrontabView {
12
+ constructor(options) {
13
+ this.name = options.name;
14
+ this.id = options.id;
15
+ this.position = options.position;
16
+ this.isDisabled = options.isDisabled || 0;
17
+ this.filters = options.filters;
18
+ this.sorts = options.sorts;
19
+ this.filterRelation = options.filterRelation;
20
+ this.type = options.type || CronViewType.个人;
21
+ }
22
+ }
23
+ exports.CrontabView = CrontabView;
24
+ exports.CrontabViewModel = _1.sequelize.define('CrontabView', {
25
+ name: {
26
+ unique: 'name',
27
+ type: sequelize_1.DataTypes.STRING,
28
+ },
29
+ position: sequelize_1.DataTypes.NUMBER,
30
+ isDisabled: sequelize_1.DataTypes.NUMBER,
31
+ filters: sequelize_1.DataTypes.JSON,
32
+ sorts: sequelize_1.DataTypes.JSON,
33
+ filterRelation: {
34
+ type: sequelize_1.DataTypes.STRING,
35
+ allowNull: true,
36
+ },
37
+ type: sequelize_1.DataTypes.NUMBER,
38
+ });
39
+ //# sourceMappingURL=cronView.js.map
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DependenceModel = exports.unInstallDependenceCommandTypes = exports.versionDependenceCommandTypes = exports.GetDependenceCommandTypes = exports.InstallDependenceCommandTypes = exports.DependenceTypes = exports.DependenceStatus = exports.Dependence = void 0;
4
+ const _1 = require(".");
5
+ const sequelize_1 = require("sequelize");
6
+ class Dependence {
7
+ constructor(options) {
8
+ this.id = options.id;
9
+ this.status =
10
+ typeof options.status === 'number' && DependenceStatus[options.status]
11
+ ? options.status
12
+ : DependenceStatus.queued;
13
+ this.type = options.type || DependenceTypes.nodejs;
14
+ this.timestamp = new Date().toString();
15
+ this.name = options.name.trim();
16
+ this.log = options.log || [];
17
+ this.remark = options.remark || '';
18
+ }
19
+ }
20
+ exports.Dependence = Dependence;
21
+ var DependenceStatus;
22
+ (function (DependenceStatus) {
23
+ DependenceStatus[DependenceStatus["installing"] = 0] = "installing";
24
+ DependenceStatus[DependenceStatus["installed"] = 1] = "installed";
25
+ DependenceStatus[DependenceStatus["installFailed"] = 2] = "installFailed";
26
+ DependenceStatus[DependenceStatus["removing"] = 3] = "removing";
27
+ DependenceStatus[DependenceStatus["removed"] = 4] = "removed";
28
+ DependenceStatus[DependenceStatus["removeFailed"] = 5] = "removeFailed";
29
+ DependenceStatus[DependenceStatus["queued"] = 6] = "queued";
30
+ DependenceStatus[DependenceStatus["cancelled"] = 7] = "cancelled";
31
+ })(DependenceStatus || (exports.DependenceStatus = DependenceStatus = {}));
32
+ var DependenceTypes;
33
+ (function (DependenceTypes) {
34
+ DependenceTypes[DependenceTypes["nodejs"] = 0] = "nodejs";
35
+ DependenceTypes[DependenceTypes["python3"] = 1] = "python3";
36
+ DependenceTypes[DependenceTypes["linux"] = 2] = "linux";
37
+ })(DependenceTypes || (exports.DependenceTypes = DependenceTypes = {}));
38
+ var InstallDependenceCommandTypes;
39
+ (function (InstallDependenceCommandTypes) {
40
+ InstallDependenceCommandTypes[InstallDependenceCommandTypes["pnpm add -g"] = 0] = "pnpm add -g";
41
+ InstallDependenceCommandTypes[InstallDependenceCommandTypes["pip3 install --disable-pip-version-check --root-user-action=ignore"] = 1] = "pip3 install --disable-pip-version-check --root-user-action=ignore";
42
+ InstallDependenceCommandTypes[InstallDependenceCommandTypes["apt install -y"] = 2] = "apt install -y";
43
+ })(InstallDependenceCommandTypes || (exports.InstallDependenceCommandTypes = InstallDependenceCommandTypes = {}));
44
+ var GetDependenceCommandTypes;
45
+ (function (GetDependenceCommandTypes) {
46
+ GetDependenceCommandTypes[GetDependenceCommandTypes["pnpm ls -g "] = 0] = "pnpm ls -g ";
47
+ GetDependenceCommandTypes[GetDependenceCommandTypes["pip3 show --disable-pip-version-check"] = 1] = "pip3 show --disable-pip-version-check";
48
+ GetDependenceCommandTypes[GetDependenceCommandTypes["apt info"] = 2] = "apt info";
49
+ })(GetDependenceCommandTypes || (exports.GetDependenceCommandTypes = GetDependenceCommandTypes = {}));
50
+ var versionDependenceCommandTypes;
51
+ (function (versionDependenceCommandTypes) {
52
+ versionDependenceCommandTypes[versionDependenceCommandTypes["@"] = 0] = "@";
53
+ versionDependenceCommandTypes[versionDependenceCommandTypes["=="] = 1] = "==";
54
+ versionDependenceCommandTypes[versionDependenceCommandTypes["="] = 2] = "=";
55
+ })(versionDependenceCommandTypes || (exports.versionDependenceCommandTypes = versionDependenceCommandTypes = {}));
56
+ var unInstallDependenceCommandTypes;
57
+ (function (unInstallDependenceCommandTypes) {
58
+ unInstallDependenceCommandTypes[unInstallDependenceCommandTypes["pnpm remove -g"] = 0] = "pnpm remove -g";
59
+ unInstallDependenceCommandTypes[unInstallDependenceCommandTypes["pip3 uninstall --disable-pip-version-check --root-user-action=ignore -y"] = 1] = "pip3 uninstall --disable-pip-version-check --root-user-action=ignore -y";
60
+ unInstallDependenceCommandTypes[unInstallDependenceCommandTypes["apt remove -y"] = 2] = "apt remove -y";
61
+ })(unInstallDependenceCommandTypes || (exports.unInstallDependenceCommandTypes = unInstallDependenceCommandTypes = {}));
62
+ exports.DependenceModel = _1.sequelize.define('Dependence', {
63
+ name: sequelize_1.DataTypes.STRING,
64
+ type: sequelize_1.DataTypes.NUMBER,
65
+ timestamp: sequelize_1.DataTypes.STRING,
66
+ status: sequelize_1.DataTypes.NUMBER,
67
+ log: sequelize_1.DataTypes.JSON,
68
+ remark: sequelize_1.DataTypes.STRING,
69
+ });
70
+ //# sourceMappingURL=dependence.js.map
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.EnvModel = exports.minPosition = exports.stepPosition = exports.initPosition = exports.maxPosition = exports.EnvStatus = exports.Env = void 0;
4
+ const _1 = require(".");
5
+ const sequelize_1 = require("sequelize");
6
+ class Env {
7
+ constructor(options) {
8
+ this.value = options.value;
9
+ this.id = options.id;
10
+ this.status =
11
+ typeof options.status === 'number' && EnvStatus[options.status]
12
+ ? options.status
13
+ : EnvStatus.normal;
14
+ this.timestamp = new Date().toString();
15
+ this.position = options.position;
16
+ this.name = options.name;
17
+ this.remarks = options.remarks;
18
+ }
19
+ }
20
+ exports.Env = Env;
21
+ var EnvStatus;
22
+ (function (EnvStatus) {
23
+ EnvStatus[EnvStatus["normal"] = 0] = "normal";
24
+ EnvStatus[EnvStatus["disabled"] = 1] = "disabled";
25
+ })(EnvStatus || (exports.EnvStatus = EnvStatus = {}));
26
+ exports.maxPosition = 9000000000000000;
27
+ exports.initPosition = 4500000000000000;
28
+ exports.stepPosition = 10000000000;
29
+ exports.minPosition = 100;
30
+ exports.EnvModel = _1.sequelize.define('Env', {
31
+ value: { type: sequelize_1.DataTypes.STRING, unique: 'compositeIndex' },
32
+ timestamp: sequelize_1.DataTypes.STRING,
33
+ status: sequelize_1.DataTypes.NUMBER,
34
+ position: sequelize_1.DataTypes.NUMBER,
35
+ name: { type: sequelize_1.DataTypes.STRING, unique: 'compositeIndex' },
36
+ remarks: sequelize_1.DataTypes.STRING,
37
+ });
38
+ //# sourceMappingURL=env.js.map
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.sequelize = void 0;
7
+ const sequelize_1 = require("sequelize");
8
+ const index_1 = __importDefault(require("../config/index"));
9
+ const path_1 = require("path");
10
+ exports.sequelize = new sequelize_1.Sequelize({
11
+ dialect: 'sqlite',
12
+ storage: (0, path_1.join)(index_1.default.dbPath, 'database.sqlite'),
13
+ logging: false,
14
+ retry: {
15
+ max: 10,
16
+ match: ['SQLITE_BUSY: database is locked'],
17
+ },
18
+ pool: {
19
+ max: 5,
20
+ min: 2,
21
+ idle: 30000,
22
+ acquire: 30000,
23
+ evict: 10000,
24
+ },
25
+ transactionType: sequelize_1.Transaction.TYPES.IMMEDIATE,
26
+ });
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,195 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.LarkNotification = exports.WebhookNotification = exports.ChronocatNotification = exports.PushMeNotification = exports.EmailNotification = exports.WePlusBotNotification = exports.PushPlusNotification = exports.IGotNotification = exports.AibotkNotification = exports.WeWorkAppNotification = exports.WeWorkBotNotification = exports.DingtalkBotNotification = exports.TelegramBotNotification = exports.BarkNotification = exports.ChatNotification = exports.PushDeerNotification = exports.ServerChanNotification = exports.GoCqHttpBotNotification = exports.GotifyNotification = exports.NotificationMode = void 0;
4
+ var NotificationMode;
5
+ (function (NotificationMode) {
6
+ NotificationMode["gotify"] = "gotify";
7
+ NotificationMode["goCqHttpBot"] = "goCqHttpBot";
8
+ NotificationMode["serverChan"] = "serverChan";
9
+ NotificationMode["pushDeer"] = "pushDeer";
10
+ NotificationMode["bark"] = "bark";
11
+ NotificationMode["chat"] = "chat";
12
+ NotificationMode["telegramBot"] = "telegramBot";
13
+ NotificationMode["dingtalkBot"] = "dingtalkBot";
14
+ NotificationMode["weWorkBot"] = "weWorkBot";
15
+ NotificationMode["weWorkApp"] = "weWorkApp";
16
+ NotificationMode["aibotk"] = "aibotk";
17
+ NotificationMode["iGot"] = "iGot";
18
+ NotificationMode["pushPlus"] = "pushPlus";
19
+ NotificationMode["wePlusBot"] = "wePlusBot";
20
+ NotificationMode["email"] = "email";
21
+ NotificationMode["pushMe"] = "pushMe";
22
+ NotificationMode["feishu"] = "feishu";
23
+ NotificationMode["webhook"] = "webhook";
24
+ NotificationMode["chronocat"] = "Chronocat";
25
+ })(NotificationMode || (exports.NotificationMode = NotificationMode = {}));
26
+ class NotificationBaseInfo {
27
+ }
28
+ class GotifyNotification extends NotificationBaseInfo {
29
+ constructor() {
30
+ super(...arguments);
31
+ this.gotifyUrl = '';
32
+ this.gotifyToken = '';
33
+ this.gotifyPriority = 0;
34
+ }
35
+ }
36
+ exports.GotifyNotification = GotifyNotification;
37
+ class GoCqHttpBotNotification extends NotificationBaseInfo {
38
+ constructor() {
39
+ super(...arguments);
40
+ this.goCqHttpBotUrl = '';
41
+ this.goCqHttpBotToken = '';
42
+ this.goCqHttpBotQq = '';
43
+ }
44
+ }
45
+ exports.GoCqHttpBotNotification = GoCqHttpBotNotification;
46
+ class ServerChanNotification extends NotificationBaseInfo {
47
+ constructor() {
48
+ super(...arguments);
49
+ this.serverChanKey = '';
50
+ }
51
+ }
52
+ exports.ServerChanNotification = ServerChanNotification;
53
+ class PushDeerNotification extends NotificationBaseInfo {
54
+ constructor() {
55
+ super(...arguments);
56
+ this.pushDeerKey = '';
57
+ this.pushDeerUrl = '';
58
+ }
59
+ }
60
+ exports.PushDeerNotification = PushDeerNotification;
61
+ class ChatNotification extends NotificationBaseInfo {
62
+ constructor() {
63
+ super(...arguments);
64
+ this.chatUrl = '';
65
+ this.chatToken = '';
66
+ }
67
+ }
68
+ exports.ChatNotification = ChatNotification;
69
+ class BarkNotification extends NotificationBaseInfo {
70
+ constructor() {
71
+ super(...arguments);
72
+ this.barkPush = '';
73
+ this.barkIcon = 'https://qn.whyour.cn/logo.png';
74
+ this.barkSound = '';
75
+ this.barkGroup = 'qinglong';
76
+ this.barkLevel = 'active';
77
+ this.barkUrl = '';
78
+ this.barkArchive = "";
79
+ }
80
+ }
81
+ exports.BarkNotification = BarkNotification;
82
+ class TelegramBotNotification extends NotificationBaseInfo {
83
+ constructor() {
84
+ super(...arguments);
85
+ this.telegramBotToken = '';
86
+ this.telegramBotUserId = '';
87
+ this.telegramBotProxyHost = '';
88
+ this.telegramBotProxyPort = '';
89
+ this.telegramBotProxyAuth = '';
90
+ this.telegramBotApiHost = 'https://api.telegram.org';
91
+ }
92
+ }
93
+ exports.TelegramBotNotification = TelegramBotNotification;
94
+ class DingtalkBotNotification extends NotificationBaseInfo {
95
+ constructor() {
96
+ super(...arguments);
97
+ this.dingtalkBotToken = '';
98
+ this.dingtalkBotSecret = '';
99
+ }
100
+ }
101
+ exports.DingtalkBotNotification = DingtalkBotNotification;
102
+ class WeWorkBotNotification extends NotificationBaseInfo {
103
+ constructor() {
104
+ super(...arguments);
105
+ this.weWorkBotKey = '';
106
+ this.weWorkOrigin = '';
107
+ }
108
+ }
109
+ exports.WeWorkBotNotification = WeWorkBotNotification;
110
+ class WeWorkAppNotification extends NotificationBaseInfo {
111
+ constructor() {
112
+ super(...arguments);
113
+ this.weWorkAppKey = '';
114
+ this.weWorkOrigin = '';
115
+ }
116
+ }
117
+ exports.WeWorkAppNotification = WeWorkAppNotification;
118
+ class AibotkNotification extends NotificationBaseInfo {
119
+ constructor() {
120
+ super(...arguments);
121
+ this.aibotkKey = '';
122
+ this.aibotkType = 'room';
123
+ this.aibotkName = '';
124
+ }
125
+ }
126
+ exports.AibotkNotification = AibotkNotification;
127
+ class IGotNotification extends NotificationBaseInfo {
128
+ constructor() {
129
+ super(...arguments);
130
+ this.iGotPushKey = '';
131
+ }
132
+ }
133
+ exports.IGotNotification = IGotNotification;
134
+ class PushPlusNotification extends NotificationBaseInfo {
135
+ constructor() {
136
+ super(...arguments);
137
+ this.pushPlusToken = '';
138
+ this.pushPlusUser = '';
139
+ }
140
+ }
141
+ exports.PushPlusNotification = PushPlusNotification;
142
+ class WePlusBotNotification extends NotificationBaseInfo {
143
+ constructor() {
144
+ super(...arguments);
145
+ this.wePlusBotToken = '';
146
+ this.wePlusBotReceiver = '';
147
+ this.wePlusBotVersion = '';
148
+ }
149
+ }
150
+ exports.WePlusBotNotification = WePlusBotNotification;
151
+ class EmailNotification extends NotificationBaseInfo {
152
+ constructor() {
153
+ super(...arguments);
154
+ this.emailService = '';
155
+ this.emailUser = '';
156
+ this.emailPass = '';
157
+ }
158
+ }
159
+ exports.EmailNotification = EmailNotification;
160
+ class PushMeNotification extends NotificationBaseInfo {
161
+ constructor() {
162
+ super(...arguments);
163
+ this.pushMeKey = '';
164
+ this.pushMeUrl = '';
165
+ }
166
+ }
167
+ exports.PushMeNotification = PushMeNotification;
168
+ class ChronocatNotification extends NotificationBaseInfo {
169
+ constructor() {
170
+ super(...arguments);
171
+ this.chronocatURL = '';
172
+ this.chronocatQQ = '';
173
+ this.chronocatToken = '';
174
+ }
175
+ }
176
+ exports.ChronocatNotification = ChronocatNotification;
177
+ class WebhookNotification extends NotificationBaseInfo {
178
+ constructor() {
179
+ super(...arguments);
180
+ this.webhookHeaders = '';
181
+ this.webhookBody = '';
182
+ this.webhookUrl = '';
183
+ this.webhookMethod = 'GET';
184
+ this.webhookContentType = 'application/json';
185
+ }
186
+ }
187
+ exports.WebhookNotification = WebhookNotification;
188
+ class LarkNotification extends NotificationBaseInfo {
189
+ constructor() {
190
+ super(...arguments);
191
+ this.larkKey = '';
192
+ }
193
+ }
194
+ exports.LarkNotification = LarkNotification;
195
+ //# sourceMappingURL=notify.js.map
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AppModel = exports.App = void 0;
4
+ const _1 = require(".");
5
+ const sequelize_1 = require("sequelize");
6
+ class App {
7
+ constructor(options) {
8
+ this.name = options.name;
9
+ this.scopes = options.scopes;
10
+ this.client_id = options.client_id;
11
+ this.client_secret = options.client_secret;
12
+ this.id = options.id;
13
+ }
14
+ }
15
+ exports.App = App;
16
+ exports.AppModel = _1.sequelize.define('App', {
17
+ name: { type: sequelize_1.DataTypes.STRING, unique: 'name' },
18
+ scopes: sequelize_1.DataTypes.JSON,
19
+ client_id: sequelize_1.DataTypes.STRING,
20
+ client_secret: sequelize_1.DataTypes.STRING,
21
+ tokens: sequelize_1.DataTypes.JSON,
22
+ });
23
+ //# sourceMappingURL=open.js.map
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SockMessage = void 0;
4
+ class SockMessage {
5
+ constructor(options) {
6
+ this.type = options.type;
7
+ this.message = options.message;
8
+ this.references = options.references;
9
+ }
10
+ }
11
+ exports.SockMessage = SockMessage;
12
+ //# sourceMappingURL=sock.js.map
@@ -0,0 +1,82 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SubscriptionModel = exports.SubscriptionStatus = exports.Subscription = void 0;
4
+ const _1 = require(".");
5
+ const sequelize_1 = require("sequelize");
6
+ class Subscription {
7
+ constructor(options) {
8
+ this.id = options.id;
9
+ this.name = options.name || options.alias;
10
+ this.type = options.type;
11
+ this.schedule = options.schedule;
12
+ this.status = this.status =
13
+ typeof options.status === 'number' && SubscriptionStatus[options.status]
14
+ ? options.status
15
+ : SubscriptionStatus.idle;
16
+ this.url = options.url;
17
+ this.whitelist = options.whitelist;
18
+ this.blacklist = options.blacklist;
19
+ this.dependences = options.dependences;
20
+ this.branch = options.branch;
21
+ this.pull_type = options.pull_type;
22
+ this.pull_option = options.pull_option;
23
+ this.pid = options.pid;
24
+ this.is_disabled = options.is_disabled;
25
+ this.log_path = options.log_path;
26
+ this.schedule_type = options.schedule_type;
27
+ this.alias = options.alias;
28
+ this.interval_schedule = options.interval_schedule;
29
+ this.extensions = options.extensions;
30
+ this.sub_before = options.sub_before;
31
+ this.sub_after = options.sub_after;
32
+ this.proxy = options.proxy;
33
+ this.autoAddCron = options.autoAddCron ? 1 : 0;
34
+ this.autoDelCron = options.autoDelCron ? 1 : 0;
35
+ }
36
+ }
37
+ exports.Subscription = Subscription;
38
+ var SubscriptionStatus;
39
+ (function (SubscriptionStatus) {
40
+ SubscriptionStatus[SubscriptionStatus["running"] = 0] = "running";
41
+ SubscriptionStatus[SubscriptionStatus["idle"] = 1] = "idle";
42
+ SubscriptionStatus[SubscriptionStatus["disabled"] = 2] = "disabled";
43
+ SubscriptionStatus[SubscriptionStatus["queued"] = 3] = "queued";
44
+ })(SubscriptionStatus || (exports.SubscriptionStatus = SubscriptionStatus = {}));
45
+ exports.SubscriptionModel = _1.sequelize.define('Subscription', {
46
+ name: {
47
+ unique: 'compositeIndex',
48
+ type: sequelize_1.DataTypes.STRING,
49
+ },
50
+ url: {
51
+ unique: 'compositeIndex',
52
+ type: sequelize_1.DataTypes.STRING,
53
+ },
54
+ schedule: {
55
+ unique: 'compositeIndex',
56
+ type: sequelize_1.DataTypes.STRING,
57
+ },
58
+ interval_schedule: {
59
+ unique: 'compositeIndex',
60
+ type: sequelize_1.DataTypes.JSON,
61
+ },
62
+ type: sequelize_1.DataTypes.STRING,
63
+ whitelist: sequelize_1.DataTypes.STRING,
64
+ blacklist: sequelize_1.DataTypes.STRING,
65
+ status: sequelize_1.DataTypes.NUMBER,
66
+ dependences: sequelize_1.DataTypes.STRING,
67
+ extensions: sequelize_1.DataTypes.STRING,
68
+ sub_before: sequelize_1.DataTypes.STRING,
69
+ sub_after: sequelize_1.DataTypes.STRING,
70
+ branch: sequelize_1.DataTypes.STRING,
71
+ pull_type: sequelize_1.DataTypes.STRING,
72
+ pull_option: sequelize_1.DataTypes.JSON,
73
+ pid: sequelize_1.DataTypes.NUMBER,
74
+ is_disabled: sequelize_1.DataTypes.NUMBER,
75
+ log_path: sequelize_1.DataTypes.STRING,
76
+ schedule_type: sequelize_1.DataTypes.STRING,
77
+ alias: { type: sequelize_1.DataTypes.STRING, unique: 'alias' },
78
+ proxy: { type: sequelize_1.DataTypes.STRING, allowNull: true },
79
+ autoAddCron: { type: sequelize_1.DataTypes.NUMBER, allowNull: true },
80
+ autoDelCron: { type: sequelize_1.DataTypes.NUMBER, allowNull: true },
81
+ });
82
+ //# sourceMappingURL=subscription.js.map
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SystemModel = exports.AuthDataType = exports.LoginStatus = exports.AuthInfo = void 0;
4
+ const _1 = require(".");
5
+ const sequelize_1 = require("sequelize");
6
+ class AuthInfo {
7
+ constructor(options) {
8
+ this.ip = options.ip;
9
+ this.info = options.info;
10
+ this.type = options.type;
11
+ this.id = options.id;
12
+ }
13
+ }
14
+ exports.AuthInfo = AuthInfo;
15
+ var LoginStatus;
16
+ (function (LoginStatus) {
17
+ LoginStatus[LoginStatus["success"] = 0] = "success";
18
+ LoginStatus[LoginStatus["fail"] = 1] = "fail";
19
+ })(LoginStatus || (exports.LoginStatus = LoginStatus = {}));
20
+ var AuthDataType;
21
+ (function (AuthDataType) {
22
+ AuthDataType["loginLog"] = "loginLog";
23
+ AuthDataType["authToken"] = "authToken";
24
+ AuthDataType["notification"] = "notification";
25
+ AuthDataType["removeLogFrequency"] = "removeLogFrequency";
26
+ AuthDataType["systemConfig"] = "systemConfig";
27
+ })(AuthDataType || (exports.AuthDataType = AuthDataType = {}));
28
+ exports.SystemModel = _1.sequelize.define('Auth', {
29
+ ip: sequelize_1.DataTypes.STRING,
30
+ type: sequelize_1.DataTypes.STRING,
31
+ info: {
32
+ type: sequelize_1.DataTypes.JSON,
33
+ allowNull: true,
34
+ },
35
+ });
36
+ //# sourceMappingURL=system.js.map
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SystemClient = exports.SystemService = exports.SystemRunResponse = exports.SystemRunRequest = exports.protobufPackage = void 0;
7
+ /* eslint-disable */
8
+ const grpc_js_1 = require("@grpc/grpc-js");
9
+ const minimal_1 = __importDefault(require("protobufjs/minimal"));
10
+ exports.protobufPackage = "com.ql.system";
11
+ function createBaseSystemRunRequest() {
12
+ return { command: "" };
13
+ }
14
+ exports.SystemRunRequest = {
15
+ encode(message, writer = minimal_1.default.Writer.create()) {
16
+ if (message.command !== "") {
17
+ writer.uint32(10).string(message.command);
18
+ }
19
+ return writer;
20
+ },
21
+ decode(input, length) {
22
+ const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
23
+ let end = length === undefined ? reader.len : reader.pos + length;
24
+ const message = createBaseSystemRunRequest();
25
+ while (reader.pos < end) {
26
+ const tag = reader.uint32();
27
+ switch (tag >>> 3) {
28
+ case 1:
29
+ if (tag !== 10) {
30
+ break;
31
+ }
32
+ message.command = reader.string();
33
+ continue;
34
+ }
35
+ if ((tag & 7) === 4 || tag === 0) {
36
+ break;
37
+ }
38
+ reader.skipType(tag & 7);
39
+ }
40
+ return message;
41
+ },
42
+ fromJSON(object) {
43
+ return { command: isSet(object.command) ? String(object.command) : "" };
44
+ },
45
+ toJSON(message) {
46
+ const obj = {};
47
+ message.command !== undefined && (obj.command = message.command);
48
+ return obj;
49
+ },
50
+ create(base) {
51
+ return exports.SystemRunRequest.fromPartial(base !== null && base !== void 0 ? base : {});
52
+ },
53
+ fromPartial(object) {
54
+ var _a;
55
+ const message = createBaseSystemRunRequest();
56
+ message.command = (_a = object.command) !== null && _a !== void 0 ? _a : "";
57
+ return message;
58
+ },
59
+ };
60
+ function createBaseSystemRunResponse() {
61
+ return {};
62
+ }
63
+ exports.SystemRunResponse = {
64
+ encode(_, writer = minimal_1.default.Writer.create()) {
65
+ return writer;
66
+ },
67
+ decode(input, length) {
68
+ const reader = input instanceof minimal_1.default.Reader ? input : minimal_1.default.Reader.create(input);
69
+ let end = length === undefined ? reader.len : reader.pos + length;
70
+ const message = createBaseSystemRunResponse();
71
+ while (reader.pos < end) {
72
+ const tag = reader.uint32();
73
+ switch (tag >>> 3) {
74
+ }
75
+ if ((tag & 7) === 4 || tag === 0) {
76
+ break;
77
+ }
78
+ reader.skipType(tag & 7);
79
+ }
80
+ return message;
81
+ },
82
+ fromJSON(_) {
83
+ return {};
84
+ },
85
+ toJSON(_) {
86
+ const obj = {};
87
+ return obj;
88
+ },
89
+ create(base) {
90
+ return exports.SystemRunResponse.fromPartial(base !== null && base !== void 0 ? base : {});
91
+ },
92
+ fromPartial(_) {
93
+ const message = createBaseSystemRunResponse();
94
+ return message;
95
+ },
96
+ };
97
+ exports.SystemService = {
98
+ run: {
99
+ path: "/com.ql.system.System/Run",
100
+ requestStream: false,
101
+ responseStream: false,
102
+ requestSerialize: (value) => Buffer.from(exports.SystemRunRequest.encode(value).finish()),
103
+ requestDeserialize: (value) => exports.SystemRunRequest.decode(value),
104
+ responseSerialize: (value) => Buffer.from(exports.SystemRunResponse.encode(value).finish()),
105
+ responseDeserialize: (value) => exports.SystemRunResponse.decode(value),
106
+ },
107
+ };
108
+ exports.SystemClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.SystemService, "com.ql.system.System");
109
+ function isSet(value) {
110
+ return value !== null && value !== undefined;
111
+ }
112
+ //# sourceMappingURL=system.js.map
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const grpc_js_1 = require("@grpc/grpc-js");
7
+ const logger_1 = __importDefault(require("./loaders/logger"));
8
+ const system_1 = require("./protos/system");
9
+ const cross_spawn_1 = __importDefault(require("cross-spawn"));
10
+ const server = new grpc_js_1.Server({ 'grpc.enable_http_proxy': 0 });
11
+ server.addService(system_1.SystemService, {
12
+ run: async (call, callback) => {
13
+ if (call.request.command) {
14
+ const cp = (0, cross_spawn_1.default)(call.request.command, {
15
+ shell: '/bin/bash',
16
+ detached: true,
17
+ });
18
+ cp.unref();
19
+ return callback(null, { code: 200 });
20
+ }
21
+ return callback(null, { status: 1 });
22
+ },
23
+ });
24
+ server.bindAsync(`0.0.0.0:33445`, grpc_js_1.ServerCredentials.createInsecure(), (err, port) => {
25
+ if (err) {
26
+ throw err;
27
+ }
28
+ server.start();
29
+ logger_1.default.debug(`✌️ 系统服务启动成功!`);
30
+ console.debug(`✌️ 系统服务启动成功!`);
31
+ });
32
+ //# sourceMappingURL=system.js.map