├── .nvmrc ├── autox-ts ├── src │ ├── ui.ts │ ├── static │ │ └── .gitkeep │ ├── statics │ │ └── .gitkeep │ ├── assets │ │ └── project.json │ ├── test.ts │ └── action.ts ├── lib │ └── .gitkeep ├── .gitignore ├── types │ ├── project │ │ └── global.d.ts │ └── autox │ │ ├── modules │ │ ├── storages.d.ts │ │ ├── media.d.ts │ │ ├── floaty.d.ts │ │ ├── sensors.d.ts │ │ ├── colors.d.ts │ │ ├── global.d.ts │ │ ├── keys.d.ts │ │ ├── threads.d.ts │ │ ├── root.d.ts │ │ ├── coordinate.d.ts │ │ ├── http.d.ts │ │ └── ui.d.ts │ │ ├── adbkit.d.ts │ │ └── auto.d.ts ├── tsup.config.ts ├── tsconfig.json └── package.json ├── web-control ├── server │ ├── .nvmrc │ ├── .dockerignore │ ├── src │ │ ├── common │ │ │ ├── souljs │ │ │ │ ├── .prettierignore │ │ │ │ ├── .prettierrc │ │ │ │ ├── tsconfig.build.json │ │ │ │ ├── lib │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── enums.ts │ │ │ │ │ ├── utils │ │ │ │ │ │ ├── is-master.ts │ │ │ │ │ │ ├── logger.ts │ │ │ │ │ │ └── load-modules.ts │ │ │ │ │ ├── decorators │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ ├── render.ts │ │ │ │ │ │ ├── cron-job.ts │ │ │ │ │ │ ├── swagger-api.ts │ │ │ │ │ │ ├── middleware.ts │ │ │ │ │ │ ├── request-params.ts │ │ │ │ │ │ ├── param-decorator-tool.ts │ │ │ │ │ │ ├── request-mapping.ts │ │ │ │ │ │ └── joi-schema.ts │ │ │ │ │ ├── interfaces.ts │ │ │ │ │ ├── router │ │ │ │ │ │ └── response-handler.ts │ │ │ │ │ ├── constants.ts │ │ │ │ │ ├── middlewares │ │ │ │ │ │ └── param-validate.ts │ │ │ │ │ └── application.ts │ │ │ │ ├── .gitignore │ │ │ │ ├── tslint.json │ │ │ │ ├── tsconfig.json │ │ │ │ └── .vscode │ │ │ │ │ └── launch.json │ │ │ ├── soul-orm │ │ │ │ ├── .prettierignore │ │ │ │ ├── .prettierrc │ │ │ │ ├── lib │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── tx.ts │ │ │ │ │ ├── re-cartesian.ts │ │ │ │ │ └── test.ts │ │ │ │ ├── tsconfig.build.json │ │ │ │ ├── .gitignore │ │ │ │ ├── tslint.json │ │ │ │ ├── tsconfig.json │ │ │ │ ├── package.json │ │ │ │ └── README.md │ │ │ ├── dbm │ │ │ │ └── index.ts │ │ │ └── application │ │ │ │ └── index.ts │ │ ├── config │ │ │ └── index.ts │ │ ├── modules │ │ │ └── default │ │ │ │ ├── config.ts │ │ │ │ ├── router.ts │ │ │ │ └── main.ts │ │ ├── utils │ │ │ ├── uuid.ts │ │ │ ├── enums.ts │ │ │ ├── md5.ts │ │ │ ├── create-sign.ts │ │ │ ├── redis.ts │ │ │ ├── db.ts │ │ │ ├── result-utils.ts │ │ │ ├── log4js.ts │ │ │ ├── re-cartesian.ts │ │ │ └── lock.ts │ │ ├── decorators │ │ │ ├── cur-user.ts │ │ │ └── role.ts │ │ ├── typing │ │ │ └── WebSocket.d.ts │ │ ├── model │ │ │ ├── script.model.ts │ │ │ ├── log.model.ts │ │ │ ├── task.model.ts │ │ │ ├── admin.model.ts │ │ │ ├── device.model.ts │ │ │ ├── scheduler.model.ts │ │ │ └── base.model.ts │ │ ├── service │ │ │ ├── LogcatManager.ts │ │ │ └── ScriptExecutor.ts │ │ └── middleware │ │ │ ├── error-handle.ts │ │ │ └── app-session.ts │ ├── .env.development │ ├── tsconfig.build.json │ ├── .env.production │ ├── nodemon.json │ ├── Dockerfile │ ├── tsconfig.json │ ├── tslint.json │ ├── README.md │ └── .vscode │ │ └── launch.json ├── web │ ├── .dockerignore │ ├── .eslintignore │ ├── babel.config.js │ ├── tests │ │ └── unit │ │ │ ├── .eslintrc.js │ │ │ ├── components │ │ │ ├── Hamburger.spec.js │ │ │ └── SvgIcon.spec.js │ │ │ └── utils │ │ │ ├── validate.spec.js │ │ │ ├── parseTime.spec.js │ │ │ └── formatTime.spec.js │ ├── .travis.yml │ ├── public │ │ ├── favicon.ico │ │ └── lib │ │ │ └── codemirror │ │ │ ├── theme │ │ │ ├── ambiance-mobile.css │ │ │ ├── neat.css │ │ │ ├── ssms.css │ │ │ ├── elegant.css │ │ │ ├── neo.css │ │ │ ├── eclipse.css │ │ │ ├── bespin.css │ │ │ ├── isotope.css │ │ │ ├── hopscotch.css │ │ │ ├── railscasts.css │ │ │ ├── colorforth.css │ │ │ ├── cobalt.css │ │ │ ├── idea.css │ │ │ ├── night.css │ │ │ ├── gruvbox-dark.css │ │ │ ├── rubyblue.css │ │ │ └── tomorrow-night-bright.css │ │ │ ├── addon │ │ │ ├── display │ │ │ │ ├── fullscreen.css │ │ │ │ ├── fullscreen.js │ │ │ │ └── autorefresh.js │ │ │ ├── search │ │ │ │ └── matchesonscrollbar.css │ │ │ ├── fold │ │ │ │ ├── foldgutter.css │ │ │ │ ├── markdown-fold.js │ │ │ │ └── indent-fold.js │ │ │ ├── dialog │ │ │ │ └── dialog.css │ │ │ ├── hint │ │ │ │ ├── show-hint.css │ │ │ │ └── anyword-hint.js │ │ │ ├── mode │ │ │ │ └── multiplex_test.js │ │ │ ├── edit │ │ │ │ └── trailingspace.js │ │ │ ├── tern │ │ │ │ └── worker.js │ │ │ ├── lint │ │ │ │ ├── yaml-lint.js │ │ │ │ ├── css-lint.js │ │ │ │ ├── json-lint.js │ │ │ │ └── coffeescript-lint.js │ │ │ ├── runmode │ │ │ │ └── colorize.js │ │ │ └── scroll │ │ │ │ ├── simplescrollbars.css │ │ │ │ └── scrollpastend.js │ │ │ ├── demo │ │ │ ├── closetag.html │ │ │ ├── resize.html │ │ │ ├── matchtags.html │ │ │ ├── rulers.html │ │ │ ├── placeholder.html │ │ │ ├── marker.html │ │ │ ├── trailingspace.html │ │ │ └── closebrackets.html │ │ │ └── mode │ │ │ ├── http │ │ │ └── index.html │ │ │ ├── htmlembedded │ │ │ └── htmlembedded.js │ │ │ └── javascript │ │ │ └── typescript.html │ ├── src │ │ ├── assets │ │ │ └── 404_images │ │ │ │ ├── 404.png │ │ │ │ └── 404_cloud.png │ │ ├── layout │ │ │ ├── components │ │ │ │ ├── index.js │ │ │ │ ├── Sidebar │ │ │ │ │ ├── Item.vue │ │ │ │ │ ├── Link.vue │ │ │ │ │ ├── FixiOSBug.js │ │ │ │ │ └── index.vue │ │ │ │ └── AppMain.vue │ │ │ └── mixin │ │ │ │ └── ResizeHandler.js │ │ ├── App.vue │ │ ├── api │ │ │ ├── table.js │ │ │ └── user.js │ │ ├── store │ │ │ ├── getters.js │ │ │ ├── index.js │ │ │ └── modules │ │ │ │ ├── settings.js │ │ │ │ ├── device.js │ │ │ │ └── app.js │ │ ├── icons │ │ │ ├── svg │ │ │ │ ├── link.svg │ │ │ │ ├── user.svg │ │ │ │ ├── example.svg │ │ │ │ ├── table.svg │ │ │ │ ├── password.svg │ │ │ │ ├── nested.svg │ │ │ │ ├── eye.svg │ │ │ │ ├── eye-open.svg │ │ │ │ └── tree.svg │ │ │ ├── index.js │ │ │ └── svgo.yml │ │ ├── utils │ │ │ ├── get-page-title.js │ │ │ ├── timeFormatFilter.js │ │ │ ├── auth.js │ │ │ ├── validate.js │ │ │ └── auto-height.js │ │ ├── settings.js │ │ ├── styles │ │ │ ├── mixin.scss │ │ │ ├── variables.scss │ │ │ ├── element-ui.scss │ │ │ ├── transition.scss │ │ │ └── index.scss │ │ ├── views │ │ │ └── dashboard │ │ │ │ └── index.vue │ │ └── components │ │ │ ├── Hamburger │ │ │ └── index.vue │ │ │ └── SvgIcon │ │ │ └── index.vue │ ├── .env.production │ ├── jsconfig.json │ ├── .env.staging │ ├── default.conf │ ├── postcss.config.js │ ├── .gitignore │ ├── .editorconfig │ ├── Dockerfile │ ├── mock │ │ ├── table.js │ │ └── user.js │ ├── .env.development │ ├── jest.config.js │ ├── build │ │ └── index.js │ ├── LICENSE │ └── package.json ├── desktop.ini ├── image │ ├── device.png │ ├── develop.png │ ├── scheduler.png │ └── workspaces.png ├── mysql │ ├── Dockerfile │ └── utf8mb4.cnf ├── .gitignore ├── README.md ├── update.sql ├── LICENSE └── docker-compose.yml ├── .gitignore ├── ref-log ├── service │ ├── package.json │ └── utils │ │ └── log4js.js ├── main.js ├── websocket.js └── adb-record.js ├── upload ├── package.json └── index.js ├── .vscode └── launch.json └── package.json /.nvmrc: -------------------------------------------------------------------------------- 1 | v16.13.0 -------------------------------------------------------------------------------- /autox-ts/src/ui.ts: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /autox-ts/lib/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /autox-ts/src/static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /autox-ts/src/statics/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web-control/server/.nvmrc: -------------------------------------------------------------------------------- 1 | v16.13.0 -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | upload/temp/* 3 | log -------------------------------------------------------------------------------- /web-control/web/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /web-control/server/.dockerignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/.prettierignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web-control/server/src/common/soul-orm/.prettierignore: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web-control/desktop.ini: -------------------------------------------------------------------------------- 1 | [ViewState] 2 | Mode= 3 | Vid= 4 | FolderType=Generic 5 | -------------------------------------------------------------------------------- /web-control/web/.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | src/assets 3 | public 4 | dist 5 | -------------------------------------------------------------------------------- /web-control/server/src/common/dbm/index.ts: -------------------------------------------------------------------------------- 1 | export * from "../soul-orm/lib/index"; 2 | -------------------------------------------------------------------------------- /web-control/server/src/common/application/index.ts: -------------------------------------------------------------------------------- 1 | export * from "../souljs/lib/index"; 2 | -------------------------------------------------------------------------------- /web-control/web/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/app' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /web-control/web/tests/unit/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | jest: true 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /web-control/image/device.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/debug-null/autojs-web/HEAD/web-control/image/device.png -------------------------------------------------------------------------------- /web-control/image/develop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/debug-null/autojs-web/HEAD/web-control/image/develop.png -------------------------------------------------------------------------------- /web-control/image/scheduler.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/debug-null/autojs-web/HEAD/web-control/image/scheduler.png -------------------------------------------------------------------------------- /web-control/image/workspaces.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/debug-null/autojs-web/HEAD/web-control/image/workspaces.png -------------------------------------------------------------------------------- /web-control/web/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 10 3 | script: npm run test 4 | notifications: 5 | email: false 6 | -------------------------------------------------------------------------------- /web-control/web/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/debug-null/autojs-web/HEAD/web-control/web/public/favicon.ico -------------------------------------------------------------------------------- /web-control/server/src/common/soul-orm/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all", 4 | "printWidth": 120 5 | } -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all", 4 | "printWidth": 120 5 | } -------------------------------------------------------------------------------- /web-control/web/src/assets/404_images/404.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/debug-null/autojs-web/HEAD/web-control/web/src/assets/404_images/404.png -------------------------------------------------------------------------------- /web-control/server/.env.development: -------------------------------------------------------------------------------- 1 | # just a flag 2 | ENV = 'development' 3 | 4 | # base api 5 | MYSQL_HOST = '127.0.0.1' 6 | MYSQL_PORT = 3306 7 | 8 | -------------------------------------------------------------------------------- /web-control/server/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "compilerOptions": { 4 | "sourceMap": false 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /web-control/server/src/config/index.ts: -------------------------------------------------------------------------------- 1 | import { NODE_ENV } from "../utils/enums"; 2 | 3 | export default { 4 | env: NODE_ENV.dev, 5 | port: 3001, 6 | }; 7 | -------------------------------------------------------------------------------- /web-control/web/src/assets/404_images/404_cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/debug-null/autojs-web/HEAD/web-control/web/src/assets/404_images/404_cloud.png -------------------------------------------------------------------------------- /web-control/server/.env.production: -------------------------------------------------------------------------------- 1 | # just a flag 2 | ENV = 'production' 3 | 4 | # base api 5 | MYSQL_HOST = '127.0.0.1' 6 | MYSQL_PORT = 3306 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /web-control/server/src/modules/default/config.ts: -------------------------------------------------------------------------------- 1 | import { NODE_ENV } from "../../utils/enums"; 2 | 3 | export default { 4 | env: NODE_ENV.dev, 5 | port: 8889, 6 | }; 7 | -------------------------------------------------------------------------------- /autox-ts/.gitignore: -------------------------------------------------------------------------------- 1 | # workspace 2 | .idea/ 3 | *.iws 4 | *.iml 5 | *.ipr 6 | 7 | # project 8 | dist/ 9 | node_modules/ 10 | package-lock.json 11 | *.lock 12 | *.log 13 | -------------------------------------------------------------------------------- /web-control/web/.env.production: -------------------------------------------------------------------------------- 1 | # just a flag 2 | ENV = 'production' 3 | 4 | # base api 5 | VUE_APP_BASE_API = 'http://127.0.0.1:8889' 6 | VUE_APP_WS_HOST = 'ws://127.0.0.1:8889' 7 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/ambiance-mobile.css: -------------------------------------------------------------------------------- 1 | .cm-s-ambiance.CodeMirror { 2 | -webkit-box-shadow: none; 3 | -moz-box-shadow: none; 4 | box-shadow: none; 5 | } 6 | -------------------------------------------------------------------------------- /web-control/server/src/common/soul-orm/lib/index.ts: -------------------------------------------------------------------------------- 1 | export * from './query-builder'; 2 | 3 | export * from './dbm'; 4 | 5 | export * from './tx'; 6 | 7 | export * from './re-cartesian'; 8 | -------------------------------------------------------------------------------- /web-control/web/src/layout/components/index.js: -------------------------------------------------------------------------------- 1 | export { default as Navbar } from './Navbar'; 2 | export { default as Sidebar } from './Sidebar'; 3 | export { default as AppMain } from './AppMain'; 4 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/display/fullscreen.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-fullscreen { 2 | position: fixed; 3 | top: 0; left: 0; right: 0; bottom: 0; 4 | height: auto; 5 | z-index: 9; 6 | } 7 | -------------------------------------------------------------------------------- /web-control/web/src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 12 | -------------------------------------------------------------------------------- /web-control/web/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "baseUrl": "./", 4 | "paths": { 5 | "@/*": ["src/*"] 6 | } 7 | }, 8 | "exclude": ["node_modules", "dist"] 9 | } 10 | -------------------------------------------------------------------------------- /web-control/web/.env.staging: -------------------------------------------------------------------------------- 1 | NODE_ENV = production 2 | 3 | # just a flag 4 | ENV = 'staging' 5 | 6 | # base api 7 | VUE_APP_BASE_API = 'http://localhost:8889' 8 | VUE_APP_WS_HOST = 'ws://localhost:8889' 9 | 10 | -------------------------------------------------------------------------------- /web-control/mysql/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM mysql 2 | 3 | LABEL OG=felord.cn 4 | ENV MYSQL_ROOT_PASSWORD=root 5 | ENV MYSQL_DATABASE=cloud_auto 6 | 7 | COPY utf8mb4.cnf /etc/mysql/conf.d/utf8mb4.cnf 8 | COPY . /docker-entrypoint-initdb.d -------------------------------------------------------------------------------- /web-control/server/src/common/soul-orm/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": [ 4 | "lib/**/*", 5 | "index.ts" 6 | ], 7 | "exclude": [ 8 | "sample/**/*" 9 | ] 10 | } -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/tsconfig.build.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "./tsconfig.json", 3 | "include": [ 4 | "lib/**/*", 5 | "index.ts" 6 | ], 7 | "exclude": [ 8 | "sample/**/*" 9 | ] 10 | } -------------------------------------------------------------------------------- /web-control/server/src/utils/uuid.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @Author: kun 3 | * @Date: 2019-10 4 | */ 5 | 6 | import * as uuid from 'uuid'; 7 | 8 | export default () => { 9 | return uuid.v1().replace(/-/gi, ''); 10 | }; 11 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/index.ts: -------------------------------------------------------------------------------- 1 | export * from './createApplication'; 2 | 3 | export * from './application'; 4 | 5 | export * from './decorators'; 6 | 7 | export { PARAM_VALIDATIONE_RROR } from './constants'; 8 | -------------------------------------------------------------------------------- /web-control/web/default.conf: -------------------------------------------------------------------------------- 1 | server { 2 | listen 80; 3 | server_name localhost; 4 | 5 | location / { 6 | root /usr/share/nginx/html; 7 | index index.html index.htm; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /web-control/web/src/api/table.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | export function getList(params) { 4 | return request({ 5 | url: '/table/list', 6 | method: 'get', 7 | params 8 | }); 9 | } 10 | -------------------------------------------------------------------------------- /web-control/server/nodemon.json: -------------------------------------------------------------------------------- 1 | { 2 | "watch": ["src"], 3 | "ext": "ts", 4 | "ignore": [ 5 | ".git", 6 | "node_modules/**/node_modules" 7 | ], 8 | "exec": "ts-node -r tsconfig-paths/register src/modules/default/main.ts" 9 | } -------------------------------------------------------------------------------- /web-control/server/src/decorators/cur-user.ts: -------------------------------------------------------------------------------- 1 | import { createParamDecorator } from "../common/application"; 2 | 3 | const CurUser = createParamDecorator((ctx) => { 4 | return ctx.state.curUser; 5 | }); 6 | 7 | export default CurUser; 8 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | npm-debug.log* 4 | yarn-debug.log* 5 | yarn-error.log* 6 | 7 | # Editor directories and files 8 | .idea 9 | *.suo 10 | *.ntvs* 11 | *.njsproj 12 | *.sln 13 | -------------------------------------------------------------------------------- /web-control/server/src/common/soul-orm/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | npm-debug.log* 4 | yarn-debug.log* 5 | yarn-error.log* 6 | 7 | # Editor directories and files 8 | .idea 9 | *.suo 10 | *.ntvs* 11 | *.njsproj 12 | *.sln 13 | -------------------------------------------------------------------------------- /web-control/server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:14 2 | 3 | COPY . /server 4 | WORKDIR /server 5 | 6 | 7 | RUN npm config set registry=https://registry.npm.taobao.org 8 | RUN npm install 9 | # RUN npm run build 10 | 11 | CMD ["npm","run","start"] -------------------------------------------------------------------------------- /web-control/web/postcss.config.js: -------------------------------------------------------------------------------- 1 | // https://github.com/michael-ciniawsky/postcss-load-config 2 | 3 | module.exports = { 4 | 'plugins': { 5 | // to edit target browsers: use "browserslist" field in package.json 6 | 'autoprefixer': {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /web-control/server/src/utils/enums.ts: -------------------------------------------------------------------------------- 1 | export enum NODE_ENV { 2 | dev = 'development', 3 | test = 'test', 4 | prod = 'production', 5 | } 6 | 7 | export enum SYS_ROLE { 8 | admin = 'admin', 9 | agent = 'agent', 10 | merchant = 'merchant', 11 | } 12 | -------------------------------------------------------------------------------- /web-control/mysql/utf8mb4.cnf: -------------------------------------------------------------------------------- 1 | [client] 2 | default-character-set=utf8mb4 3 | 4 | [mysql] 5 | default-character-set=utf8mb4 6 | 7 | 8 | [mysqld] 9 | collation-server = utf8mb4_unicode_520_ci 10 | init-connect='SET NAMES utf8mb4' 11 | character-set-server = utf8mb4 -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/search/matchesonscrollbar.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-search-match { 2 | background: gold; 3 | border-top: 1px solid orange; 4 | border-bottom: 1px solid orange; 5 | -moz-box-sizing: border-box; 6 | box-sizing: border-box; 7 | opacity: .5; 8 | } 9 | -------------------------------------------------------------------------------- /autox-ts/src/assets/project.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "autox-typescript-template", 3 | "versionName": "0.0.1", 4 | "versionCode": 1, 5 | "packageName": "com.lanaqi.autox.template", 6 | "main": "main.js", 7 | "launchConfig": { 8 | "hideLogs": false 9 | } 10 | } -------------------------------------------------------------------------------- /web-control/web/.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules/ 3 | dist/ 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | package-lock.json 8 | tests/**/coverage/ 9 | 10 | # Editor directories and files 11 | .idea 12 | .vscode 13 | *.suo 14 | *.ntvs* 15 | *.njsproj 16 | *.sln 17 | -------------------------------------------------------------------------------- /web-control/web/src/store/getters.js: -------------------------------------------------------------------------------- 1 | const getters = { 2 | sidebar: state => state.app.sidebar, 3 | device: state => state.app.device, 4 | token: state => state.user.token, 5 | avatar: state => state.user.avatar, 6 | name: state => state.user.name 7 | }; 8 | export default getters; 9 | -------------------------------------------------------------------------------- /autox-ts/types/project/global.d.ts: -------------------------------------------------------------------------------- 1 | // 全局 2 | 3 | declare global { 4 | 5 | // 注入环境名称 6 | var injectEnvName: string; 7 | 8 | // 注入资源路径 9 | var injectAssetsPath: string; 10 | 11 | // 注入项目名称 12 | var injectProjectName: string; 13 | 14 | } 15 | 16 | export { 17 | }; 18 | -------------------------------------------------------------------------------- /web-control/server/src/modules/default/router.ts: -------------------------------------------------------------------------------- 1 | export * from './controller/auth.controller'; 2 | export * from './controller/script.controller'; 3 | export * from './controller/device.controller'; 4 | export * from './controller/scheduler.controller'; 5 | export * from './controller/api.controller'; 6 | -------------------------------------------------------------------------------- /web-control/server/src/utils/md5.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @Author: kun 3 | * @Date: 2019-10 4 | */ 5 | 6 | import * as crypto from 'crypto'; 7 | 8 | export default (str: string): string => { 9 | const md5 = crypto.createHash('md5'); 10 | md5.update(str); 11 | return md5.digest('hex'); 12 | }; 13 | -------------------------------------------------------------------------------- /web-control/web/src/icons/svg/link.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/enums.ts: -------------------------------------------------------------------------------- 1 | export enum ParamDecoratorType { 2 | Request = 'Request', 3 | Response = 'Response', 4 | Ctx = 'Ctx', 5 | Next = 'Next', 6 | Query = 'Query', 7 | Body = 'Body', 8 | KoaInstance = 'KoaInstance', 9 | ApplicationInstance = 'ApplicationInstance', 10 | } 11 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/utils/is-master.ts: -------------------------------------------------------------------------------- 1 | import * as cluster from 'cluster'; 2 | 3 | export function isPM2Master(): boolean { 4 | return parseInt(process.env.INSTANCE_ID, 10) === 0; 5 | } 6 | 7 | export default function isMaster(): boolean { 8 | return cluster.isMaster || isPM2Master(); 9 | } 10 | -------------------------------------------------------------------------------- /web-control/web/src/utils/get-page-title.js: -------------------------------------------------------------------------------- 1 | import defaultSettings from '@/settings'; 2 | 3 | const title = defaultSettings.title || 'Vue Admin Template'; 4 | 5 | export default function getPageTitle(pageTitle) { 6 | if (pageTitle) { 7 | return `${pageTitle} - ${title}`; 8 | } 9 | return `${title}`; 10 | } 11 | -------------------------------------------------------------------------------- /web-control/.gitignore: -------------------------------------------------------------------------------- 1 | *.iml 2 | .gradle 3 | /tools 4 | /local.properties 5 | /.idea/workspace.xml 6 | /.idea/libraries 7 | /.idea/caches 8 | .DS_Store 9 | /build 10 | /release 11 | /captures 12 | .externalNativeBuild 13 | *.apk 14 | *.exe 15 | .idea/caches/build_file_checksums.ser 16 | server/utils/db.ts 17 | log 18 | mysql/data -------------------------------------------------------------------------------- /web-control/web/.editorconfig: -------------------------------------------------------------------------------- 1 | # http://editorconfig.org 2 | root = true 3 | 4 | [*] 5 | charset = utf-8 6 | indent_style = space 7 | indent_size = 2 8 | end_of_line = lf 9 | insert_final_newline = true 10 | trim_trailing_whitespace = true 11 | 12 | [*.md] 13 | insert_final_newline = false 14 | trim_trailing_whitespace = false 15 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/decorators/index.ts: -------------------------------------------------------------------------------- 1 | export * from './request-mapping'; 2 | export * from './request-params'; 3 | export * from './middleware'; 4 | export * from './render'; 5 | export * from './swagger-api'; 6 | export * from './joi-schema'; 7 | export * from './cron-job'; 8 | export * from './param-decorator-tool'; 9 | -------------------------------------------------------------------------------- /web-control/web/src/utils/timeFormatFilter.js: -------------------------------------------------------------------------------- 1 | import moment from 'moment'; 2 | const MyPlugin = {}; 3 | 4 | MyPlugin.install = function(Vue, options) { 5 | Vue.filter('time', function(value) { 6 | if (!value) return ''; 7 | return moment(value).format('YY-MM-DD HH:mm:ss'); 8 | }); 9 | }; 10 | 11 | export default MyPlugin; 12 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/decorators/render.ts: -------------------------------------------------------------------------------- 1 | import 'reflect-metadata'; 2 | import { METADATA_ROUTER_RENDER_VIEW } from '../constants'; 3 | 4 | export function Render(view: string) { 5 | return (target: any, propertyKey?: string) => { 6 | Reflect.defineMetadata(METADATA_ROUTER_RENDER_VIEW, view, target, propertyKey); 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/interfaces.ts: -------------------------------------------------------------------------------- 1 | import * as Koa from 'koa'; 2 | 3 | export interface ILogger { 4 | info(message: any, ...args: any[]): void; 5 | warn(message: any, ...args: any[]): void; 6 | error(message: any, ...args: any[]): void; 7 | } 8 | 9 | export type IParamConvertFunc = (ctx: Koa.Context, data?: any) => any; 10 | -------------------------------------------------------------------------------- /web-control/web/src/icons/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import SvgIcon from '@/components/SvgIcon';// svg component 3 | 4 | // register globally 5 | Vue.component('svg-icon', SvgIcon); 6 | 7 | const req = require.context('./svg', false, /\.svg$/); 8 | const requireAll = requireContext => requireContext.keys().map(requireContext); 9 | requireAll(req); 10 | -------------------------------------------------------------------------------- /web-control/README.md: -------------------------------------------------------------------------------- 1 | ## AutoJs Web Control 2 | 3 | ### 特性 4 | 5 | 1. 支持群控 6 | 2. 脚本开发 7 | 3. 定时任务 8 | 4. 实时日志 9 | 10 | ## USE 11 | 12 | 1. 下载 Autojs 13 | 2. 连接电脑,地址 host:port 14 | 15 | ## 启动服务 16 | 17 | ```sh 18 | 19 | # 修改server 下的 .env.production 的host为服务器IP 20 | docker-compose up --build 21 | 22 | ``` 23 | 24 | ### 注意: 25 | 1、mysql 版本最多5.7. 因为node只支持5.7 26 | -------------------------------------------------------------------------------- /web-control/web/src/icons/svgo.yml: -------------------------------------------------------------------------------- 1 | # replace default config 2 | 3 | # multipass: true 4 | # full: true 5 | 6 | plugins: 7 | 8 | # - name 9 | # 10 | # or: 11 | # - name: false 12 | # - name: true 13 | # 14 | # or: 15 | # - name: 16 | # param1: 1 17 | # param2: 2 18 | 19 | - removeAttrs: 20 | attrs: 21 | - 'fill' 22 | - 'fill-rule' 23 | -------------------------------------------------------------------------------- /web-control/web/src/settings.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | 3 | title: 'Vue Admin Template', 4 | 5 | /** 6 | * @type {boolean} true | false 7 | * @description Whether fix the header 8 | */ 9 | fixedHeader: false, 10 | 11 | /** 12 | * @type {boolean} true | false 13 | * @description Whether show the logo in sidebar 14 | */ 15 | sidebarLogo: false 16 | }; 17 | -------------------------------------------------------------------------------- /web-control/web/src/utils/auth.js: -------------------------------------------------------------------------------- 1 | import Cookies from 'js-cookie'; 2 | 3 | const TokenKey = 'vue_admin_template_token'; 4 | 5 | export function getToken() { 6 | return Cookies.get(TokenKey); 7 | } 8 | 9 | export function setToken(token) { 10 | return Cookies.set(TokenKey, token); 11 | } 12 | 13 | export function removeToken() { 14 | return Cookies.remove(TokenKey); 15 | } 16 | -------------------------------------------------------------------------------- /web-control/server/src/typing/WebSocket.d.ts: -------------------------------------------------------------------------------- 1 | // // import * as Koa from "koa"; 2 | 3 | // // declare module "koa" { 4 | // // interface Request { 5 | // // body: any; 6 | // // rawBody: string; 7 | // // rawBody2: string; 8 | // // } 9 | // // } 10 | 11 | // declare module "ws" { 12 | // interface WebSocket { 13 | // isAlive: boolean; 14 | // } 15 | // } -------------------------------------------------------------------------------- /autox-ts/types/autox/modules/storages.d.ts: -------------------------------------------------------------------------------- 1 | interface Storage { 2 | get(key: string, defaultValue?: T): T; 3 | put(key: string, value: T): void; 4 | remove(key: string): void; 5 | contains(key: string): boolean; 6 | clear(): void; 7 | } 8 | 9 | declare namespace storages { 10 | function create(name: string): Storage; 11 | function remove(name: string): boolean; 12 | } -------------------------------------------------------------------------------- /ref-log/service/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "author": "", 3 | "name": "express-session-parse", 4 | "version": "0.0.0", 5 | "repository": "websockets/ws", 6 | "scripts": { 7 | "dev": "node index.js" 8 | }, 9 | "dependencies": { 10 | "express": "^4.16.4", 11 | "express-session": "^1.16.1", 12 | "log4js": "^6.9.1", 13 | "uuid": "^8.3.2", 14 | "ws": "^8.13.0" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /web-control/server/src/model/script.model.ts: -------------------------------------------------------------------------------- 1 | import BaseModel from './base.model'; 2 | 3 | export const tableName = 'script'; 4 | export interface ITableStructure { 5 | [propname: string]: any 6 | }; 7 | 8 | export class DeviceModel extends BaseModel { 9 | 10 | constructor() { 11 | super({ tableName }); 12 | } 13 | 14 | } 15 | 16 | export default new DeviceModel(); 17 | 18 | -------------------------------------------------------------------------------- /web-control/server/src/utils/create-sign.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @Author: kun 3 | */ 4 | 5 | import md5 from './md5'; 6 | 7 | export default function createSign(data: any, key: string): string { 8 | const keys = Object.keys(data); 9 | keys.sort(); // 将所有字段按照ascii码排序 10 | const signStr = keys.map(k => `${k}=${data[k]}`).join('&'); 11 | const sign = md5(signStr + '&key=' + key); 12 | return sign; 13 | } 14 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/utils/logger.ts: -------------------------------------------------------------------------------- 1 | import { ILogger } from '../interfaces'; 2 | 3 | export class Logger implements ILogger { 4 | info(message: any, ...args: any[]): void {} // tslint:disable-line 5 | warn(message: any, ...args: any[]): void {} // tslint:disable-line 6 | error(message: any, ...args: any[]): void {} // tslint:disable-line 7 | } 8 | 9 | export const logger = new Logger(); 10 | -------------------------------------------------------------------------------- /upload/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "upload", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "formidable": "^2.1.1", 14 | "socket.io": "^4.6.2", 15 | "uuid": "^9.0.0", 16 | "ws": "^8.13.0" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /web-control/web/src/icons/svg/user.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web-control/web/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:14 as web-builder 2 | 3 | COPY . /web 4 | 5 | WORKDIR /web 6 | RUN npm config set registry=https://registry.npm.taobao.org 7 | RUN npm install 8 | RUN npm run build:prod 9 | 10 | # production environment 11 | FROM nginx:1.16.0-alpine 12 | 13 | RUN rm -v /etc/nginx/conf.d/default.conf 14 | ADD default.conf /etc/nginx/conf.d/ 15 | COPY --from=web-builder /web/dist /usr/share/nginx/html 16 | CMD ["nginx", "-g", "daemon off;"] 17 | 18 | -------------------------------------------------------------------------------- /web-control/web/src/utils/validate.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Created by PanJiaChen on 16/11/18. 3 | */ 4 | 5 | /** 6 | * @param {string} path 7 | * @returns {Boolean} 8 | */ 9 | export function isExternal(path) { 10 | return /^(https?:|mailto:|tel:)/.test(path); 11 | } 12 | 13 | /** 14 | * @param {string} str 15 | * @returns {Boolean} 16 | */ 17 | export function validUsername(str) { 18 | const valid_map = ['admin', 'editor']; 19 | return valid_map.indexOf(str.trim()) >= 0; 20 | } 21 | -------------------------------------------------------------------------------- /autox-ts/types/autox/modules/media.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace media { 2 | function scanFile(path: string): void; 3 | function playMusic(path: string, volume?: number, looping?: boolean); 4 | function musicSeekTo(msec: number): void; 5 | function pauseMusic(): void; 6 | function resumeMusic(): void; 7 | function stopMusic(): void; 8 | function isMusicPlaying(): boolean; 9 | function getMusicDuration(): number; 10 | function getMusicCurrentPosition(): number; 11 | } 12 | -------------------------------------------------------------------------------- /web-control/server/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "skipLibCheck": true, 4 | "module": "commonjs", 5 | "declaration": false, 6 | "removeComments": true, 7 | "emitDecoratorMetadata": true, 8 | "experimentalDecorators": true, 9 | "target": "es6", 10 | "sourceMap": false, 11 | "outDir": "./dist", 12 | "baseUrl": "./", 13 | "paths": { 14 | "@/*":["src/*"], 15 | } 16 | }, 17 | "exclude": [ 18 | "node_modules", 19 | ] 20 | } 21 | -------------------------------------------------------------------------------- /web-control/web/src/store/index.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue'; 2 | import Vuex from 'vuex'; 3 | import getters from './getters'; 4 | import app from './modules/app'; 5 | import settings from './modules/settings'; 6 | import user from './modules/user'; 7 | import device from './modules/device'; 8 | 9 | Vue.use(Vuex); 10 | 11 | const store = new Vuex.Store({ 12 | modules: { 13 | app, 14 | settings, 15 | user, 16 | device 17 | }, 18 | getters 19 | }); 20 | 21 | export default store; 22 | -------------------------------------------------------------------------------- /.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // 使用 IntelliSense 了解相关属性。 3 | // 悬停以查看现有属性的描述。 4 | // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "type": "node", 9 | "request": "launch", 10 | "name": "启动程序", 11 | "skipFiles": [ 12 | "/**" 13 | ], 14 | "program": "${workspaceFolder}/service/index.js" 15 | } 16 | ] 17 | } -------------------------------------------------------------------------------- /web-control/web/src/api/user.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | export function login(data) { 4 | return request({ 5 | url: '/auth/login', 6 | method: 'post', 7 | data 8 | }); 9 | } 10 | 11 | export function getInfo(token) { 12 | return request({ 13 | url: '/auth/info', 14 | method: 'get', 15 | params: { token } 16 | }); 17 | } 18 | 19 | export function logout() { 20 | return request({ 21 | url: '/auth/logout', 22 | method: 'post' 23 | }); 24 | } 25 | -------------------------------------------------------------------------------- /web-control/web/src/icons/svg/example.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /autox-ts/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import { defineConfig, Options as TsupOptions } from 'tsup'; 2 | 3 | import { TsupConfigBuilder } from './build/TsupConfigBuilder'; 4 | 5 | // @ts-ignore 6 | import { name as packageName } from './package.json'; 7 | 8 | export default defineConfig((overrideOptions: TsupOptions) => 9 | TsupConfigBuilder.withNewConfig( 10 | overrideOptions, 11 | [ 12 | ], 13 | [ 14 | 'common-tags', 15 | ], 16 | packageName, 17 | true, 18 | ), 19 | ); 20 | -------------------------------------------------------------------------------- /web-control/web/src/styles/mixin.scss: -------------------------------------------------------------------------------- 1 | @mixin clearfix { 2 | &:after { 3 | content: ""; 4 | display: table; 5 | clear: both; 6 | } 7 | } 8 | 9 | @mixin scrollBar { 10 | &::-webkit-scrollbar-track-piece { 11 | background: #d3dce6; 12 | } 13 | 14 | &::-webkit-scrollbar { 15 | width: 6px; 16 | } 17 | 18 | &::-webkit-scrollbar-thumb { 19 | background: #99a9bf; 20 | border-radius: 20px; 21 | } 22 | } 23 | 24 | @mixin relative { 25 | position: relative; 26 | width: 100%; 27 | height: 100%; 28 | } 29 | -------------------------------------------------------------------------------- /web-control/server/src/common/soul-orm/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": ["tslint:recommended"], 4 | "jsRules": { 5 | "no-unused-expression": true 6 | }, 7 | "rules": { 8 | "quotemark": [true, "single"], 9 | "member-access": [false], 10 | "ordered-imports": [false], 11 | "max-line-length": [true, 150], 12 | "member-ordering": [false], 13 | "interface-name": [false], 14 | "arrow-parens": false, 15 | "object-literal-sort-keys": false 16 | }, 17 | "rulesDirectory": [] 18 | } 19 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": ["tslint:recommended"], 4 | "jsRules": { 5 | "no-unused-expression": true 6 | }, 7 | "rules": { 8 | "quotemark": [true, "single"], 9 | "member-access": [false], 10 | "ordered-imports": [false], 11 | "max-line-length": [true, 150], 12 | "member-ordering": [false], 13 | "interface-name": [false], 14 | "arrow-parens": false, 15 | "object-literal-sort-keys": false 16 | }, 17 | "rulesDirectory": [] 18 | } 19 | -------------------------------------------------------------------------------- /autox-ts/types/autox/modules/floaty.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace floaty { 2 | function window(layout: any): FloatyWindow; 3 | function closeAll(): void; 4 | interface FloatyWindow { 5 | setAdjustEnabled(enabled: boolean): void; 6 | setPosition(x: number, y: number): void; 7 | getX(): number; 8 | getY(): number; 9 | setSize(width: number, height: number): void; 10 | getWidht(): number; 11 | getHeight(): number; 12 | close(): void; 13 | exitOnClose(): void; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /autox-ts/src/test.ts: -------------------------------------------------------------------------------- 1 | console.show(true); //程序结束自动 隐藏控制台 2 | console.info('test-----------------') 3 | console.warn('test-----------------') 4 | console.error('test-----------------') 5 | console.verbose('test-----------------') 6 | 7 | // events.broadcast.on("log", function(name){ 8 | // console.log("🚀 ~ file: main.ts:2 ~ events.broadcast.on ~ name:", name) 9 | // toast("你好, " + name); 10 | // }); 11 | // //保持脚本运行 12 | // setInterval(()=>{}, 1000); 13 | 14 | 15 | 16 | // setInterval(()=>{ 17 | // events.broadcast.emit("log", "小明"); 18 | 19 | // },1000) -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/router/response-handler.ts: -------------------------------------------------------------------------------- 1 | import * as Koa from 'koa'; 2 | import { Application } from '../application'; 3 | 4 | export class ResponseHandler { 5 | private readonly appInstance: Application; 6 | 7 | constructor(appInstance: Application) { 8 | this.appInstance = appInstance; 9 | } 10 | 11 | responseJson(ctx: Koa.Context, response: any) { 12 | ctx.body = response; 13 | } 14 | 15 | async responseHtml(ctx: Koa.Context, response: any, view: string) { 16 | await ctx.render(view, response); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/fold/foldgutter.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-foldmarker { 2 | color: blue; 3 | text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px; 4 | font-family: arial; 5 | line-height: .3; 6 | cursor: pointer; 7 | } 8 | .CodeMirror-foldgutter { 9 | width: .7em; 10 | } 11 | .CodeMirror-foldgutter-open, 12 | .CodeMirror-foldgutter-folded { 13 | cursor: pointer; 14 | } 15 | .CodeMirror-foldgutter-open:after { 16 | content: "\25BE"; 17 | } 18 | .CodeMirror-foldgutter-folded:after { 19 | content: "\25B8"; 20 | } 21 | -------------------------------------------------------------------------------- /web-control/server/src/common/soul-orm/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": false, 5 | "noImplicitAny": false, 6 | "noUnusedLocals": false, 7 | "removeComments": true, 8 | "noLib": false, 9 | "emitDecoratorMetadata": true, 10 | "experimentalDecorators": true, 11 | "target": "es6", 12 | "sourceMap": true, 13 | "allowJs": true, 14 | "outDir": "dist", 15 | "lib": [ 16 | "es7" 17 | ] 18 | }, 19 | "include": [ 20 | "lib/**/*" 21 | ], 22 | "exclude": ["node_modules"] 23 | } 24 | 25 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": false, 5 | "noImplicitAny": false, 6 | "noUnusedLocals": false, 7 | "removeComments": true, 8 | "noLib": false, 9 | "emitDecoratorMetadata": true, 10 | "experimentalDecorators": true, 11 | "target": "es6", 12 | "sourceMap": true, 13 | "allowJs": true, 14 | "outDir": "dist", 15 | "lib": [ 16 | "es7" 17 | ] 18 | }, 19 | "include": [ 20 | "lib/**/*" 21 | ], 22 | "exclude": ["node_modules"] 23 | } 24 | 25 | -------------------------------------------------------------------------------- /web-control/server/src/utils/redis.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @Author: kun 3 | * @Date: 2019-10 4 | */ 5 | 6 | import * as Redis from 'ioredis'; 7 | import getLogger from './log4js'; 8 | 9 | const logger = getLogger('redis.ts'); 10 | 11 | export const redis = new Redis({ 12 | host: '127.0.0.1', 13 | port: 6379, 14 | db: 1, 15 | retryStrategy: times => Math.min(times * 500, 2000), 16 | }); 17 | 18 | redis.on('ready', () => { 19 | logger.info('redis connection is established'); 20 | }); 21 | 22 | redis.on('error', (error: Error) => { 23 | logger.error('redis error: ', error.message); 24 | }); 25 | -------------------------------------------------------------------------------- /web-control/update.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `t_admin` ( 2 | `admin_id` int(11) NOT NULL AUTO_INCREMENT, 3 | `uname` varchar(255) NOT NULL, 4 | `password` varchar(255) NOT NULL, 5 | PRIMARY KEY (`admin_id`) 6 | ) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4; 7 | 8 | 9 | INSERT INTO `t_admin` (`uname`, `password`) VALUES ('admin', '123456'); 10 | 11 | ALTER TABLE `t_device` 12 | MODIFY COLUMN `create_time` datetime NULL DEFAULT NULL AFTER `ip`, 13 | MODIFY COLUMN `connect_time` datetime NULL DEFAULT NULL AFTER `create_time`, 14 | ADD COLUMN `category` varchar(255) NULL DEFAULT 'default' AFTER `connect_time` -------------------------------------------------------------------------------- /web-control/web/src/icons/svg/table.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/decorators/cron-job.ts: -------------------------------------------------------------------------------- 1 | import 'reflect-metadata'; 2 | import { METADATA_CRON } from '../constants'; 3 | 4 | interface IOptions { 5 | onlyRunMaster?: boolean; 6 | } 7 | 8 | /** 9 | * 10 | * @param cronTime The time to fire off your job, This can be in the form of cron syntax 11 | * @param options @IOptions 12 | */ 13 | export const CronJob = (cronTime: string, options: IOptions = { onlyRunMaster: true }) => { 14 | return (target: any, propertyKey?: string) => { 15 | Reflect.defineMetadata(METADATA_CRON, { cronTime, options }, target, propertyKey); 16 | }; 17 | }; 18 | -------------------------------------------------------------------------------- /web-control/server/tslint.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "error", 3 | "extends": ["tslint:recommended"], 4 | "jsRules": { 5 | "no-unused-expression": true 6 | }, 7 | "rules": { 8 | "no-var-requires": false, 9 | "quotemark": [true, "single"], 10 | "member-access": [false], 11 | "ordered-imports": [false], 12 | "max-line-length": [true, 250], 13 | "member-ordering": [false], 14 | "interface-name": [false], 15 | "arrow-parens": false, 16 | "variable-name": false, 17 | "no-console": false, 18 | "object-literal-sort-keys": false 19 | }, 20 | "rulesDirectory": [] 21 | } 22 | -------------------------------------------------------------------------------- /web-control/web/src/icons/svg/password.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web-control/server/README.md: -------------------------------------------------------------------------------- 1 | ## Installation 2 | 3 | ```bash 4 | $ npm install 5 | ``` 6 | 7 | ## Running the app 8 | 9 | ```bash 10 | # development 11 | $ npm run start 12 | ``` 13 | 14 | ## License 15 | 16 | application is [MIT licensed](LICENSE). 17 | 18 | 19 | ## 对外接口 20 | http://127.0.0.1:8889/api/hotel-start?img=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAAEsCAYAAAB5fY51AAAABHNCSVQICAgIfAhkiAAAIABJREFUeJzt3XmU1dWXfwPH/Xj4MGiH5QUUqlSpmmmkpx0VEWvp1AgGKYIFlVL/QTihFEcu/lRUCqi6hE9zQIFQEVAhQRokRy653KpUrVK5atWrfm0zR9//bd167zfNu+7dfz/tv7HTZ0zczM3P8 PLS... 21 | 22 | 23 | ## 更新记录 24 | * 脚本新增内部变量: args,可获取脚本中植入的数据 25 | * 新增方法获取设备Id 26 | * 新增API接口 -------------------------------------------------------------------------------- /web-control/web/src/layout/components/Sidebar/Item.vue: -------------------------------------------------------------------------------- 1 | 30 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/utils/load-modules.ts: -------------------------------------------------------------------------------- 1 | import * as Path from 'path'; 2 | import * as glob from 'glob'; 3 | 4 | export async function globs(root: string, globsRex: string, options?: glob.IOptions): Promise { 5 | return new Promise((resolve, reject) => { 6 | glob(Path.join(root, globsRex), options, (er, files) => { 7 | if (er) { 8 | reject(er); 9 | } else { 10 | resolve(files); 11 | } 12 | }); 13 | }); 14 | } 15 | 16 | export function loadPackage(packageName: string) { 17 | try { 18 | return require(packageName); 19 | } catch (e) { 20 | process.exit(1); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /web-control/web/mock/table.js: -------------------------------------------------------------------------------- 1 | import Mock from 'mockjs' 2 | 3 | const data = Mock.mock({ 4 | 'items|30': [{ 5 | id: '@id', 6 | title: '@sentence(10, 20)', 7 | 'status|1': ['published', 'draft', 'deleted'], 8 | author: 'name', 9 | display_time: '@datetime', 10 | pageviews: '@integer(300, 5000)' 11 | }] 12 | }) 13 | 14 | export default [ 15 | { 16 | url: '/table/list', 17 | type: 'get', 18 | response: config => { 19 | const items = data.items 20 | return { 21 | code: 20000, 22 | data: { 23 | total: items.length, 24 | items: items 25 | } 26 | } 27 | } 28 | } 29 | ] 30 | -------------------------------------------------------------------------------- /web-control/web/.env.development: -------------------------------------------------------------------------------- 1 | # just a flag 2 | ENV = 'development' 3 | 4 | # base api 5 | VUE_APP_BASE_API = 'http://127.0.0.1:8889' 6 | VUE_APP_WS_HOST = 'ws://127.0.0.1:8889' 7 | 8 | 9 | # vue-cli uses the VUE_CLI_BABEL_TRANSPILE_MODULES environment variable, 10 | # to control whether the babel-plugin-dynamic-import-node plugin is enabled. 11 | # It only does one thing by converting all import() to require(). 12 | # This configuration can significantly increase the speed of hot updates, 13 | # when you have a large number of pages. 14 | # Detail: https://github.com/vuejs/vue-cli/blob/dev/packages/@vue/babel-preset-app/index.js 15 | 16 | VUE_CLI_BABEL_TRANSPILE_MODULES = true 17 | -------------------------------------------------------------------------------- /web-control/server/src/service/LogcatManager.ts: -------------------------------------------------------------------------------- 1 | import * as querystring from "querystring"; 2 | import * as http from "http"; 3 | import getLogger from "../utils/log4js"; 4 | import { WebSocketManager, WebSocketExt } from "./WebSocketManager"; 5 | 6 | const logger = getLogger("LogcatManager"); 7 | 8 | export class LogcatManager { 9 | static instance: LogcatManager; 10 | 11 | public static getInstance() { 12 | if (!LogcatManager.instance) { 13 | logger.info("LogcatManager Not initialized!"); 14 | } 15 | return LogcatManager.instance; 16 | } 17 | 18 | public static init() {} 19 | 20 | public log() {} 21 | 22 | public addListener(listener: any) {} 23 | } 24 | -------------------------------------------------------------------------------- /web-control/web/src/views/dashboard/index.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 21 | 22 | 35 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/decorators/swagger-api.ts: -------------------------------------------------------------------------------- 1 | import 'reflect-metadata'; 2 | import { METADATA_API_TAG, METADATA_API_DESCRIPTION } from '../constants'; 3 | 4 | export const Tag = (tag: string) => { 5 | return (target: object, propertyKey?: string) => { 6 | Reflect.defineMetadata(METADATA_API_TAG, tag, target, propertyKey); 7 | }; 8 | }; 9 | 10 | export const Description = (description: string) => { 11 | return (target: object, propertyKey?: string) => { 12 | const des: string = Reflect.getMetadata(METADATA_API_DESCRIPTION, target, propertyKey) || ''; 13 | Reflect.defineMetadata(METADATA_API_DESCRIPTION, description + ' ' + des, target, propertyKey); 14 | }; 15 | }; 16 | -------------------------------------------------------------------------------- /web-control/server/src/utils/db.ts: -------------------------------------------------------------------------------- 1 | import { DBM } from "../common/dbm"; 2 | import getLogger from "./log4js"; 3 | import { resolve } from "path"; 4 | const ROOT = resolve(__dirname, "../../"); 5 | require("dotenv").config({ path: `${ROOT}/.env.${process.env.USE_ENV}` }); 6 | 7 | const logger = getLogger("db.ts"); 8 | 9 | console.log("db:", process.env.MYSQL_HOST, process.env.MYSQL_PORT); 10 | 11 | const orm = new DBM({ 12 | connectionLimit: 10, 13 | host: process.env.MYSQL_HOST, 14 | port: Number(process.env.MYSQL_PORT), 15 | user: "root", 16 | password: "root", 17 | database: "cloud_auto", 18 | isDebug: true, 19 | }); 20 | 21 | orm.setLogger(logger as any); 22 | 23 | export default orm; 24 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/dialog/dialog.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-dialog { 2 | position: absolute; 3 | left: 0; right: 0; 4 | background: inherit; 5 | z-index: 15; 6 | padding: .1em .8em; 7 | overflow: hidden; 8 | color: inherit; 9 | } 10 | 11 | .CodeMirror-dialog-top { 12 | border-bottom: 1px solid #eee; 13 | top: 0; 14 | } 15 | 16 | .CodeMirror-dialog-bottom { 17 | border-top: 1px solid #eee; 18 | bottom: 0; 19 | } 20 | 21 | .CodeMirror-dialog input { 22 | border: none; 23 | outline: none; 24 | background: transparent; 25 | width: 20em; 26 | color: inherit; 27 | font-family: monospace; 28 | } 29 | 30 | .CodeMirror-dialog button { 31 | font-size: 70%; 32 | } 33 | -------------------------------------------------------------------------------- /web-control/web/src/store/modules/settings.js: -------------------------------------------------------------------------------- 1 | import defaultSettings from '@/settings'; 2 | 3 | const { showSettings, fixedHeader, sidebarLogo } = defaultSettings; 4 | 5 | const state = { 6 | showSettings: showSettings, 7 | fixedHeader: fixedHeader, 8 | sidebarLogo: sidebarLogo 9 | }; 10 | 11 | const mutations = { 12 | CHANGE_SETTING: (state, { key, value }) => { 13 | if (state.hasOwnProperty(key)) { 14 | state[key] = value; 15 | } 16 | } 17 | }; 18 | 19 | const actions = { 20 | changeSetting({ commit }, data) { 21 | commit('CHANGE_SETTING', data); 22 | } 23 | }; 24 | 25 | export default { 26 | namespaced: true, 27 | state, 28 | mutations, 29 | actions 30 | }; 31 | 32 | -------------------------------------------------------------------------------- /web-control/server/src/model/log.model.ts: -------------------------------------------------------------------------------- 1 | import BaseModel from './base.model'; 2 | 3 | export const tableName = 't_divice'; 4 | export interface ITableStructure { 5 | task_id?: number, 6 | task_name?: string, // 任务名 7 | device_id?: number, // 设备 8 | script_id?: number, // 脚本 9 | script_args?: string, // 运行参数 10 | create_time?: string, 11 | start_time?: string, 12 | finish_time?: string, 13 | status?: string, 14 | task_result?: string, // 运行结果 15 | batch_number?: string, // 任务批次号 16 | }; 17 | 18 | export class DeviceModel extends BaseModel { 19 | 20 | constructor() { 21 | super({ tableName }); 22 | } 23 | 24 | } 25 | 26 | export default new DeviceModel(); 27 | 28 | -------------------------------------------------------------------------------- /web-control/server/src/model/task.model.ts: -------------------------------------------------------------------------------- 1 | import BaseModel from './base.model'; 2 | 3 | export const tableName = 't_divice'; 4 | export interface ITableStructure { 5 | task_id?: number, 6 | task_name?: string, // 任务名 7 | device_id?: number, // 设备 8 | script_id?: number, // 脚本 9 | script_args?: string, // 运行参数 10 | create_time?: string, 11 | start_time?: string, 12 | finish_time?: string, 13 | status?: string, 14 | task_result?: string, // 运行结果 15 | batch_number?: string, // 任务批次号 16 | }; 17 | 18 | export class DeviceModel extends BaseModel { 19 | 20 | constructor() { 21 | super({ tableName }); 22 | } 23 | 24 | } 25 | 26 | export default new DeviceModel(); 27 | 28 | -------------------------------------------------------------------------------- /autox-ts/types/autox/modules/sensors.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace sensors { 2 | interface SensorEventEmitter { 3 | on(eventName: 'change', callback: (...args: number[]) => void): void; 4 | on(eventName: 'accuracy_change', callback: (accuracy: number) => void): void; 5 | } 6 | function on(eventName: 'unsupported_sensor', callback: (sensorName: string) => void): void; 7 | function register(sensorName: string, delay?: delay): SensorEventEmitter; 8 | function unregister(emitter: SensorEventEmitter); 9 | function unregisterAll(): void; 10 | var ignoresUnsupportedSensor: boolean; 11 | enum delay { 12 | normal, 13 | ui, 14 | game, 15 | fastest 16 | } 17 | } -------------------------------------------------------------------------------- /ref-log/main.js: -------------------------------------------------------------------------------- 1 | "ui"; 2 | 3 | ui.layout( 4 | 5 | 8 | 9 | ); 10 | console.show(true); //程序结束自动 隐藏控制台 11 | ui.get_qr.on("click", () => { 12 | toast("点我啦"); 13 | const action = require("./actions.js"); 14 | const record = require("./adb-record.js"); 15 | 16 | if (!device.isScreenOn()) { 17 | device.wakeUp(); // 点亮屏幕 18 | } 19 | 20 | if (!action.checkIsWx()) { 21 | toast("微信未安装, 请安装微信后再试~"); 22 | exit(); 23 | } 24 | 25 | const res = action.openWxSys(); 26 | console.log("0--", res); 27 | // var res = record(); // 录制 28 | }); 29 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/decorators/middleware.ts: -------------------------------------------------------------------------------- 1 | import 'reflect-metadata'; 2 | import * as Koa from 'koa'; 3 | import { METADATA_ROUTER_MIDDLEWARE } from '../constants'; 4 | 5 | export function Use(mid: Koa.Middleware) { 6 | return (target: any, propertyKey?: string) => { 7 | if (!Reflect.hasMetadata(METADATA_ROUTER_MIDDLEWARE, target, propertyKey)) { 8 | Reflect.defineMetadata(METADATA_ROUTER_MIDDLEWARE, [], target, propertyKey); 9 | } 10 | 11 | const middlewares: any[] = Reflect.getMetadata(METADATA_ROUTER_MIDDLEWARE, target, propertyKey); 12 | 13 | middlewares.push(mid); 14 | 15 | Reflect.defineMetadata(METADATA_ROUTER_MIDDLEWARE, middlewares, target, propertyKey); 16 | }; 17 | } 18 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/decorators/request-params.ts: -------------------------------------------------------------------------------- 1 | import { createParamDecorator } from './param-decorator-tool'; 2 | 3 | export const Ctx = createParamDecorator(ctx => { 4 | return ctx; 5 | }); 6 | 7 | export const Request = createParamDecorator(ctx => { 8 | return ctx.request; 9 | }); 10 | 11 | export const Response = createParamDecorator(ctx => { 12 | return ctx.response; 13 | }); 14 | 15 | export const Query = createParamDecorator((ctx, data) => { 16 | return data && ctx.request.query ? ctx.request.query[data] : ctx.request.query; 17 | }); 18 | 19 | export const Body = createParamDecorator((ctx, data) => { 20 | const body = ctx.request.body; 21 | return data && body ? body[data] : body; 22 | }); 23 | -------------------------------------------------------------------------------- /web-control/server/src/utils/result-utils.ts: -------------------------------------------------------------------------------- 1 | export class ResultUtils { 2 | static success(msgOrData?: string | any, data?: object | string): object { 3 | if (data !== undefined || typeof msgOrData === 'string') { 4 | return { code: 200, message: msgOrData || '操作成功!', data: data || null }; 5 | } 6 | return { code: 200, message: '操作成功!', data: msgOrData || null }; 7 | } 8 | 9 | static badRequest(message: string, data?: any) { 10 | return { code: 400, message, data }; 11 | } 12 | 13 | static forbidden(message: string, data?: any) { 14 | return { code: 403, message, data }; 15 | } 16 | 17 | static internalServerError(message: string, data?: any) { 18 | return { code: 500, message, data }; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /web-control/web/src/styles/variables.scss: -------------------------------------------------------------------------------- 1 | // sidebar 2 | $menuText:#bfcbd9; 3 | $menuActiveText:#409EFF; 4 | $subMenuActiveText:#f4f4f5; //https://github.com/ElemeFE/element/issues/12951 5 | 6 | $menuBg:#304156; 7 | $menuHover:#263445; 8 | 9 | $subMenuBg:#1f2d3d; 10 | $subMenuHover:#001528; 11 | 12 | $sideBarWidth: 210px; 13 | 14 | // the :export directive is the magic sauce for webpack 15 | // https://www.bluematador.com/blog/how-to-share-variables-between-js-and-sass 16 | :export { 17 | menuText: $menuText; 18 | menuActiveText: $menuActiveText; 19 | subMenuActiveText: $subMenuActiveText; 20 | menuBg: $menuBg; 21 | menuHover: $menuHover; 22 | subMenuBg: $subMenuBg; 23 | subMenuHover: $subMenuHover; 24 | sideBarWidth: $sideBarWidth; 25 | } 26 | -------------------------------------------------------------------------------- /web-control/web/tests/unit/components/Hamburger.spec.js: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import Hamburger from '@/components/Hamburger/index.vue' 3 | describe('Hamburger.vue', () => { 4 | it('toggle click', () => { 5 | const wrapper = shallowMount(Hamburger) 6 | const mockFn = jest.fn() 7 | wrapper.vm.$on('toggleClick', mockFn) 8 | wrapper.find('.hamburger').trigger('click') 9 | expect(mockFn).toBeCalled() 10 | }) 11 | it('prop isActive', () => { 12 | const wrapper = shallowMount(Hamburger) 13 | wrapper.setProps({ isActive: true }) 14 | expect(wrapper.contains('.is-active')).toBe(true) 15 | wrapper.setProps({ isActive: false }) 16 | expect(wrapper.contains('.is-active')).toBe(false) 17 | }) 18 | }) 19 | -------------------------------------------------------------------------------- /web-control/web/tests/unit/components/SvgIcon.spec.js: -------------------------------------------------------------------------------- 1 | import { shallowMount } from '@vue/test-utils' 2 | import SvgIcon from '@/components/SvgIcon/index.vue' 3 | describe('SvgIcon.vue', () => { 4 | it('iconClass', () => { 5 | const wrapper = shallowMount(SvgIcon, { 6 | propsData: { 7 | iconClass: 'test' 8 | } 9 | }) 10 | expect(wrapper.find('use').attributes().href).toBe('#icon-test') 11 | }) 12 | it('className', () => { 13 | const wrapper = shallowMount(SvgIcon, { 14 | propsData: { 15 | iconClass: 'test' 16 | } 17 | }) 18 | expect(wrapper.classes().length).toBe(1) 19 | wrapper.setProps({ className: 'test' }) 20 | expect(wrapper.classes().includes('test')).toBe(true) 21 | }) 22 | }) 23 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/decorators/param-decorator-tool.ts: -------------------------------------------------------------------------------- 1 | import 'reflect-metadata'; 2 | import { METADATA_ROUTER_PARAMS } from '../constants'; 3 | import { IParamConvertFunc } from '../interfaces'; 4 | 5 | export function createParamDecorator(convertFunc: IParamConvertFunc) { 6 | return (data?: any) => { 7 | return (target: object, propertyKey: string | symbol, parameterIndex: number) => { 8 | const routerParams: any[] = Reflect.getMetadata(METADATA_ROUTER_PARAMS, target, propertyKey) || []; 9 | 10 | routerParams.push({ 11 | index: parameterIndex, 12 | convertFunc, 13 | data, 14 | }); 15 | 16 | Reflect.defineMetadata(METADATA_ROUTER_PARAMS, routerParams, target, propertyKey); 17 | }; 18 | }; 19 | } 20 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/neat.css: -------------------------------------------------------------------------------- 1 | .cm-s-neat span.cm-comment { color: #a86; } 2 | .cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; } 3 | .cm-s-neat span.cm-string { color: #a22; } 4 | .cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; } 5 | .cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; } 6 | .cm-s-neat span.cm-variable { color: black; } 7 | .cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; } 8 | .cm-s-neat span.cm-meta { color: #555; } 9 | .cm-s-neat span.cm-link { color: #3a3; } 10 | 11 | .cm-s-neat .CodeMirror-activeline-background { background: #e8f2ff; } 12 | .cm-s-neat .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; } 13 | -------------------------------------------------------------------------------- /web-control/web/src/layout/components/Sidebar/Link.vue: -------------------------------------------------------------------------------- 1 | 2 | 8 | 9 | 37 | -------------------------------------------------------------------------------- /autox-ts/types/autox/modules/colors.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace colors { 2 | function toString(color: number): string; 3 | function red(color: number | string): number; 4 | function green(color: number | string): number; 5 | function blue(color: number | string): number; 6 | function alpha(color: number | string): number; 7 | function rgb(red: number, green: number, blue: number): number; 8 | function argb(alpha: number, red: number, green: number, blue: number): number; 9 | function parseColor(colorStr: string): number; 10 | function isSimilar(color1: number | string, color2: number | string, threshold: number, algorithm: 'diff' | 'rgb' | 'rgb+' | 'hs'): boolean; 11 | function equals(color1: number | string, color2: number | string): boolean; 12 | } 13 | 14 | -------------------------------------------------------------------------------- /web-control/server/src/model/admin.model.ts: -------------------------------------------------------------------------------- 1 | import BaseModel from './base.model'; 2 | 3 | export const tableName = 'admin'; 4 | export interface ITableStructure { 5 | admin_id?: number, 6 | uname?: string, 7 | password?: string, 8 | }; 9 | 10 | export class DeviceModel extends BaseModel { 11 | 12 | constructor() { 13 | super({ tableName }); 14 | } 15 | 16 | async getByName(uname: string): Promise { 17 | return this.$db.table(tableName).where({ uname }).findOrEmpty(); 18 | } 19 | 20 | async changePassword(admin_id: number, newPassword: string) { 21 | return this.$db.table(tableName).where({ admin_id }).update({ 22 | password: newPassword 23 | });; 24 | } 25 | 26 | } 27 | 28 | export default new DeviceModel(); 29 | 30 | -------------------------------------------------------------------------------- /autox-ts/types/autox/modules/global.d.ts: -------------------------------------------------------------------------------- 1 | interface Point { 2 | x: number; 3 | y: number; 4 | } 5 | 6 | declare function sleep(n: number): void; 7 | 8 | declare function currentPackage(): string; 9 | 10 | declare function currentActivity(): string; 11 | 12 | declare function setClip(test: string): void; 13 | 14 | declare function getClip(): string; 15 | 16 | declare function toast(message: string): void; 17 | 18 | declare function toastLog(message: string): void; 19 | 20 | declare function waitForActivity(activity: string, period?: number): void; 21 | 22 | declare function waitForPackage(packageName: string, period?: number): void; 23 | 24 | declare function exit(): void; 25 | 26 | declare function random(): number; 27 | declare function random(min: number, max: number): number; 28 | 29 | -------------------------------------------------------------------------------- /web-control/server/src/model/device.model.ts: -------------------------------------------------------------------------------- 1 | import BaseModel from './base.model'; 2 | 3 | export const tableName = 'device'; 4 | export interface ITableStructure { 5 | device_id?: number, 6 | name?: string, 7 | category?: string, 8 | ip?: string, 9 | create_time?: string, 10 | connect_time?: string, 11 | [propname: string]: any 12 | }; 13 | 14 | export class DeviceModel extends BaseModel { 15 | 16 | constructor() { 17 | super({ tableName }); 18 | } 19 | 20 | async getByDeviceName(name: string) { 21 | return this.$db.table(tableName).where({ name }).findOrEmpty(); 22 | } 23 | 24 | async getByIp(ip: string) { 25 | return this.$db.table(tableName).where({ ip }).findOrEmpty(); 26 | } 27 | 28 | } 29 | 30 | export default new DeviceModel(); 31 | 32 | -------------------------------------------------------------------------------- /web-control/server/src/model/scheduler.model.ts: -------------------------------------------------------------------------------- 1 | import BaseModel from './base.model'; 2 | 3 | export const tableName = 'scheduler'; 4 | export interface ITableStructure { 5 | scheduler_id?: number, 6 | scheduler_name?: string, // 任务名 7 | cron_time?: string, // 运行参数 8 | last_execute_time?: string, 9 | script_id?: string, 10 | device_ids?: string, 11 | active: number, // 是否执行 12 | }; 13 | 14 | export class DeviceModel extends BaseModel { 15 | 16 | constructor() { 17 | super({ tableName }); 18 | } 19 | 20 | getSchedulerList() { 21 | const sql = ` 22 | SELECT * FROM t_scheduler sd 23 | LEFT JOIN t_script sc ON sc.script_id = sd.script_id`; 24 | return this.$db.query(sql); 25 | } 26 | 27 | } 28 | 29 | export default new DeviceModel(); 30 | 31 | -------------------------------------------------------------------------------- /web-control/web/src/layout/components/Sidebar/FixiOSBug.js: -------------------------------------------------------------------------------- 1 | export default { 2 | computed: { 3 | device() { 4 | return this.$store.state.app.device; 5 | } 6 | }, 7 | mounted() { 8 | // In order to fix the click on menu on the ios device will trigger the mouseleave bug 9 | // https://github.com/PanJiaChen/vue-element-admin/issues/1135 10 | this.fixBugIniOS(); 11 | }, 12 | methods: { 13 | fixBugIniOS() { 14 | const $subMenu = this.$refs.subMenu; 15 | if ($subMenu) { 16 | const handleMouseleave = $subMenu.handleMouseleave; 17 | $subMenu.handleMouseleave = (e) => { 18 | if (this.device === 'mobile') { 19 | return; 20 | } 21 | handleMouseleave(e); 22 | }; 23 | } 24 | } 25 | } 26 | }; 27 | -------------------------------------------------------------------------------- /web-control/web/tests/unit/utils/validate.spec.js: -------------------------------------------------------------------------------- 1 | import { validUsername, isExternal } from '@/utils/validate.js' 2 | 3 | describe('Utils:validate', () => { 4 | it('validUsername', () => { 5 | expect(validUsername('admin')).toBe(true) 6 | expect(validUsername('editor')).toBe(true) 7 | expect(validUsername('xxxx')).toBe(false) 8 | }) 9 | it('isExternal', () => { 10 | expect(isExternal('https://github.com/PanJiaChen/vue-element-admin')).toBe(true) 11 | expect(isExternal('http://github.com/PanJiaChen/vue-element-admin')).toBe(true) 12 | expect(isExternal('github.com/PanJiaChen/vue-element-admin')).toBe(false) 13 | expect(isExternal('/dashboard')).toBe(false) 14 | expect(isExternal('./dashboard')).toBe(false) 15 | expect(isExternal('dashboard')).toBe(false) 16 | }) 17 | }) 18 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // 使用 IntelliSense 了解相关属性。 3 | // 悬停以查看现有属性的描述。 4 | // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "Current TS File", 9 | "type": "node", 10 | "request": "launch", 11 | "env": { "DEBUG": "app*" }, 12 | "args": [ 13 | "${workspaceRoot}/sample/src/main.ts" // 入口文件 14 | ], 15 | "runtimeArgs": [ 16 | "--nolazy", 17 | "-r", 18 | "ts-node/register" 19 | ], 20 | "sourceMaps": true, 21 | "cwd": "${workspaceRoot}", 22 | "protocol": "inspector", 23 | "console": "integratedTerminal", 24 | "internalConsoleOptions": "neverOpen" 25 | } 26 | ] 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/decorators/request-mapping.ts: -------------------------------------------------------------------------------- 1 | import 'reflect-metadata'; 2 | 3 | import { METADATA_ROUTER_METHOD, METADATA_ROUTER_PATH } from '../constants'; 4 | 5 | function createRequestMapping(method: string) { 6 | return (path?: string) => { 7 | return (target: any, propertyKey: string) => { 8 | Reflect.defineMetadata(METADATA_ROUTER_PATH, path || '', target, propertyKey); 9 | Reflect.defineMetadata(METADATA_ROUTER_METHOD, method, target, propertyKey); 10 | }; 11 | }; 12 | } 13 | 14 | export const Get = createRequestMapping('GET'); 15 | 16 | export const Post = createRequestMapping('POST'); 17 | 18 | export const Controller = (path?: string) => { 19 | return (target: any) => { 20 | Reflect.defineMetadata(METADATA_ROUTER_PATH, path || '/', target); 21 | }; 22 | }; 23 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/decorators/joi-schema.ts: -------------------------------------------------------------------------------- 1 | import 'reflect-metadata'; 2 | import * as joi from 'joi'; 3 | import { METADATA_ROUTER_BODY_SCHAME, METADATA_ROUTER_QUERY_SCHAME } from '../constants'; 4 | 5 | function create(type: symbol) { 6 | return (schemaMap: joi.SchemaMap) => { 7 | Object.keys(schemaMap).forEach(k => { 8 | const v: any = schemaMap[k]; 9 | if (v._flags.presence !== 'required') { 10 | schemaMap[k] = v.allow.call(v, '', null); 11 | } 12 | }); 13 | return (target: any, propertyKey?: string) => { 14 | Reflect.defineMetadata(type, joi.object().keys(schemaMap), target, propertyKey); 15 | }; 16 | }; 17 | } 18 | 19 | export const BodySchame = create(METADATA_ROUTER_BODY_SCHAME); 20 | 21 | export const QuerySchame = create(METADATA_ROUTER_QUERY_SCHAME); 22 | -------------------------------------------------------------------------------- /web-control/web/src/icons/svg/nested.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/hint/show-hint.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-hints { 2 | position: absolute; 3 | z-index: 10; 4 | overflow: hidden; 5 | list-style: none; 6 | 7 | margin: 0; 8 | padding: 2px; 9 | 10 | -webkit-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 11 | -moz-box-shadow: 2px 3px 5px rgba(0,0,0,.2); 12 | box-shadow: 2px 3px 5px rgba(0,0,0,.2); 13 | border-radius: 3px; 14 | border: 1px solid silver; 15 | 16 | background: white; 17 | font-size: 90%; 18 | font-family: monospace; 19 | 20 | max-height: 20em; 21 | overflow-y: auto; 22 | } 23 | 24 | .CodeMirror-hint { 25 | margin: 0; 26 | padding: 0 4px; 27 | border-radius: 2px; 28 | white-space: pre; 29 | color: black; 30 | cursor: pointer; 31 | } 32 | 33 | li.CodeMirror-hint-active { 34 | background: #08f; 35 | color: white; 36 | } 37 | -------------------------------------------------------------------------------- /web-control/web/src/store/modules/device.js: -------------------------------------------------------------------------------- 1 | import request from '@/utils/request'; 2 | 3 | const state = { 4 | list: [], 5 | category: [] 6 | }; 7 | 8 | const mutations = { 9 | UPDATE_ONLINES: (state, devices) => { 10 | state.list = devices; 11 | state.category = []; 12 | state.list.forEach((it) => { 13 | if (!state.category.includes(it.category)) { 14 | state.category.push(it.category); 15 | } 16 | }); 17 | } 18 | }; 19 | 20 | const actions = { 21 | updateOnlineDevices({ commit }) { 22 | request({ 23 | url: "/device/get_device_list", 24 | method: "get", 25 | params: {} 26 | }).then(res => { 27 | commit('UPDATE_ONLINES', res.data.devices); 28 | }); 29 | }, 30 | }; 31 | 32 | export default { 33 | namespaced: true, 34 | state, 35 | mutations, 36 | actions 37 | }; 38 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/ssms.css: -------------------------------------------------------------------------------- 1 | .cm-s-ssms span.cm-keyword { color: blue; } 2 | .cm-s-ssms span.cm-comment { color: darkgreen; } 3 | .cm-s-ssms span.cm-string { color: red; } 4 | .cm-s-ssms span.cm-def { color: black; } 5 | .cm-s-ssms span.cm-variable { color: black; } 6 | .cm-s-ssms span.cm-variable-2 { color: black; } 7 | .cm-s-ssms span.cm-atom { color: darkgray; } 8 | .cm-s-ssms .CodeMirror-linenumber { color: teal; } 9 | .cm-s-ssms .CodeMirror-activeline-background { background: #ffffff; } 10 | .cm-s-ssms span.cm-string-2 { color: #FF00FF; } 11 | .cm-s-ssms span.cm-operator, 12 | .cm-s-ssms span.cm-bracket, 13 | .cm-s-ssms span.cm-punctuation { color: darkgray; } 14 | .cm-s-ssms .CodeMirror-gutters { border-right: 3px solid #ffee62; background-color: #ffffff; } 15 | .cm-s-ssms div.CodeMirror-selected { background: #ADD6FF; } 16 | 17 | -------------------------------------------------------------------------------- /web-control/server/.vscode/launch.json: -------------------------------------------------------------------------------- 1 | { 2 | // 使用 IntelliSense 了解相关属性。 3 | // 悬停以查看现有属性的描述。 4 | // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 5 | "version": "0.2.0", 6 | "configurations": [ 7 | { 8 | "name": "default", 9 | "type": "node", 10 | "request": "launch", 11 | "env": { "NODE_ENV":"development" }, 12 | "args": [ 13 | "${workspaceRoot}/src/modules/default/main.ts" // 入口文件 14 | ], 15 | "runtimeArgs": [ 16 | "--nolazy", 17 | "-r", 18 | "ts-node/register" 19 | ], 20 | "sourceMaps": true, 21 | "cwd": "${workspaceRoot}", 22 | "protocol": "inspector", 23 | "console": "integratedTerminal", 24 | "internalConsoleOptions": "neverOpen" 25 | } 26 | ] 27 | } 28 | 29 | 30 | -------------------------------------------------------------------------------- /web-control/web/src/layout/components/AppMain.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 19 | 20 | 32 | 33 | 41 | -------------------------------------------------------------------------------- /autox-ts/types/autox/modules/keys.d.ts: -------------------------------------------------------------------------------- 1 | declare function back(): boolean; 2 | declare function home(): boolean; 3 | declare function powerDialog(): boolean; 4 | declare function notifications(): boolean; 5 | declare function quickSettings(): boolean; 6 | declare function recents(): boolean; 7 | declare function splitScreen(): boolean; 8 | declare function Home(): void; 9 | declare function Back(): void; 10 | declare function Power(): void; 11 | declare function Menu(): void; 12 | declare function VolumeUp(): void; 13 | declare function VolumeDown(): void; 14 | declare function Camera(): void; 15 | declare function Up(): void; 16 | declare function Down(): void; 17 | declare function Left(): void; 18 | declare function Right(): void; 19 | declare function OK(): void; 20 | declare function Text(text: string): void; 21 | declare function KeyCode(code: number | string): void; 22 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/elegant.css: -------------------------------------------------------------------------------- 1 | .cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom { color: #762; } 2 | .cm-s-elegant span.cm-comment { color: #262; font-style: italic; line-height: 1em; } 3 | .cm-s-elegant span.cm-meta { color: #555; font-style: italic; line-height: 1em; } 4 | .cm-s-elegant span.cm-variable { color: black; } 5 | .cm-s-elegant span.cm-variable-2 { color: #b11; } 6 | .cm-s-elegant span.cm-qualifier { color: #555; } 7 | .cm-s-elegant span.cm-keyword { color: #730; } 8 | .cm-s-elegant span.cm-builtin { color: #30a; } 9 | .cm-s-elegant span.cm-link { color: #762; } 10 | .cm-s-elegant span.cm-error { background-color: #fdd; } 11 | 12 | .cm-s-elegant .CodeMirror-activeline-background { background: #e8f2ff; } 13 | .cm-s-elegant .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; } 14 | -------------------------------------------------------------------------------- /web-control/web/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | moduleFileExtensions: ['js', 'jsx', 'json', 'vue'], 3 | transform: { 4 | '^.+\\.vue$': 'vue-jest', 5 | '.+\\.(css|styl|less|sass|scss|svg|png|jpg|ttf|woff|woff2)$': 6 | 'jest-transform-stub', 7 | '^.+\\.jsx?$': 'babel-jest' 8 | }, 9 | moduleNameMapper: { 10 | '^@/(.*)$': '/src/$1' 11 | }, 12 | snapshotSerializers: ['jest-serializer-vue'], 13 | testMatch: [ 14 | '**/tests/unit/**/*.spec.(js|jsx|ts|tsx)|**/__tests__/*.(js|jsx|ts|tsx)' 15 | ], 16 | collectCoverageFrom: ['src/utils/**/*.{js,vue}', '!src/utils/auth.js', '!src/utils/request.js', 'src/components/**/*.{js,vue}'], 17 | coverageDirectory: '/tests/unit/coverage', 18 | // 'collectCoverage': true, 19 | 'coverageReporters': [ 20 | 'lcov', 21 | 'text-summary' 22 | ], 23 | testURL: 'http://localhost/' 24 | } 25 | -------------------------------------------------------------------------------- /web-control/server/src/middleware/error-handle.ts: -------------------------------------------------------------------------------- 1 | import * as Koa from "koa"; 2 | import { PARAM_VALIDATIONE_RROR } from "../common/application"; 3 | import getLogger from "../utils/log4js"; 4 | import { ResultUtils } from "../utils/result-utils"; 5 | 6 | const logger = getLogger("error-handle.ts"); 7 | 8 | export default () => { 9 | return async (ctx: Koa.Context, next: () => Promise) => { 10 | try { 11 | await next(); 12 | } catch (error) { 13 | if (error.name === PARAM_VALIDATIONE_RROR) { 14 | return (ctx.body = ResultUtils.badRequest(error.message)); 15 | } 16 | 17 | if (error.name === "TokenExpiredError") { 18 | return (ctx.body = ResultUtils.forbidden("登陆过期,请重新登陆!")); 19 | } 20 | 21 | ctx.body = ResultUtils.internalServerError(error.message); 22 | logger.error("server error:", error); 23 | } 24 | }; 25 | }; 26 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/constants.ts: -------------------------------------------------------------------------------- 1 | export const METADATA_ROUTER_PATH = Symbol('METADATA_ROUTER_PATH'); 2 | export const METADATA_ROUTER_METHOD = Symbol('METADATA_ROUTER_METHOD'); 3 | export const METADATA_ROUTER_RENDER_VIEW = Symbol('METADATA_ROUTER_RENDER_VIEW'); 4 | 5 | export const METADATA_ROUTER_BODY_SCHAME = Symbol('METADATA_ROUTER_BODY_SCHAME'); 6 | export const METADATA_ROUTER_QUERY_SCHAME = Symbol('METADATA_ROUTER_QUERY_SCHAME'); 7 | 8 | export const METADATA_ROUTER_PARAMS = Symbol('METADATA_ROUTER_PARAMS'); 9 | 10 | export const METADATA_ROUTER_MIDDLEWARE = Symbol('METADATA_ROUTER_MIDDLEWARE'); 11 | 12 | export const METADATA_API_TAG = Symbol('METADATA_API_TAG'); 13 | export const METADATA_API_DESCRIPTION = Symbol('METADATA_API_DESCRIPTION'); 14 | 15 | export const METADATA_CRON = Symbol('METADATA_CRON'); 16 | 17 | export const PARAM_VALIDATIONE_RROR = 'PARAM_VALIDATIONE_RROR'; 18 | -------------------------------------------------------------------------------- /autox-ts/types/autox/adbkit.d.ts: -------------------------------------------------------------------------------- 1 | 2 | // import * as a from "adbkit"; 3 | 4 | declare module "adbkit" { 5 | import { ReadStream } from "fs"; 6 | 7 | export interface TcpUsbServer { } 8 | 9 | export interface Connection { } 10 | 11 | export interface Device { 12 | id: string; 13 | type: string; 14 | } 15 | 16 | export interface Client { 17 | createTcpUsbBridge(serial: string): TcpUsbServer; 18 | connection(): Promise; 19 | version(): any; 20 | listDevices(): Promise; 21 | screencap(serial: string): Promise; 22 | } 23 | 24 | export interface ClientOptions { 25 | host?: string; 26 | port?: number; 27 | bin?: string; 28 | } 29 | 30 | export function createClient(options?: ClientOptions): Client; 31 | 32 | export var KeyCode: any; 33 | 34 | export var util: any; 35 | } -------------------------------------------------------------------------------- /web-control/web/src/styles/element-ui.scss: -------------------------------------------------------------------------------- 1 | // cover some element-ui styles 2 | 3 | .el-breadcrumb__inner, 4 | .el-breadcrumb__inner a { 5 | font-weight: 400 !important; 6 | } 7 | 8 | .el-upload { 9 | input[type="file"] { 10 | display: none !important; 11 | } 12 | } 13 | 14 | .el-upload__input { 15 | display: none; 16 | } 17 | 18 | 19 | // to fixed https://github.com/ElemeFE/element/issues/2461 20 | .el-dialog { 21 | transform: none; 22 | left: 0; 23 | position: relative; 24 | margin: 0 auto; 25 | } 26 | 27 | // refine element ui upload 28 | .upload-container { 29 | .el-upload { 30 | width: 100%; 31 | 32 | .el-upload-dragger { 33 | width: 100%; 34 | height: 200px; 35 | } 36 | } 37 | } 38 | 39 | // dropdown 40 | .el-dropdown-menu { 41 | a { 42 | display: block 43 | } 44 | } 45 | 46 | // to fix el-date-picker css style 47 | .el-range-separator { 48 | box-sizing: content-box; 49 | } 50 | -------------------------------------------------------------------------------- /web-control/web/src/icons/svg/eye.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web-control/web/src/styles/transition.scss: -------------------------------------------------------------------------------- 1 | // global transition css 2 | 3 | /* fade */ 4 | .fade-enter-active, 5 | .fade-leave-active { 6 | transition: opacity 0.28s; 7 | } 8 | 9 | .fade-enter, 10 | .fade-leave-active { 11 | opacity: 0; 12 | } 13 | 14 | /* fade-transform */ 15 | .fade-transform-leave-active, 16 | .fade-transform-enter-active { 17 | transition: all .5s; 18 | } 19 | 20 | .fade-transform-enter { 21 | opacity: 0; 22 | transform: translateX(-30px); 23 | } 24 | 25 | .fade-transform-leave-to { 26 | opacity: 0; 27 | transform: translateX(30px); 28 | } 29 | 30 | /* breadcrumb transition */ 31 | .breadcrumb-enter-active, 32 | .breadcrumb-leave-active { 33 | transition: all .5s; 34 | } 35 | 36 | .breadcrumb-enter, 37 | .breadcrumb-leave-active { 38 | opacity: 0; 39 | transform: translateX(20px); 40 | } 41 | 42 | .breadcrumb-move { 43 | transition: all .5s; 44 | } 45 | 46 | .breadcrumb-leave-active { 47 | position: absolute; 48 | } 49 | -------------------------------------------------------------------------------- /autox-ts/types/autox/modules/threads.d.ts: -------------------------------------------------------------------------------- 1 | declare namespace threads { 2 | 3 | type ThreadTimerID = number; 4 | 5 | interface Thread { 6 | interrupt(): void; 7 | join(timeout?: number); 8 | isAlive(): boolean; 9 | waitFor(): void; 10 | setTimeout(callback: (...args: any[]) => void, delay: number, ...args: any[]): ThreadTimerID; 11 | setInterval(callback: (...args: any[]) => void, delay: number, ...args: any[]): ThreadTimerID; 12 | setImmediate(callback: (...args: any[]) => void, ...args: any[]): ThreadTimerID; 13 | clearInterval(id: ThreadTimerID): void; 14 | clearTimeout(id: ThreadTimerID): void; 15 | clearImmediate(id: ThreadTimerID): void; 16 | } 17 | 18 | function start(action): Thread; 19 | function shutDownAll(): void; 20 | function currentThread(): Thread; 21 | function disposable(): any; 22 | function atomic(initialValue?: number): any; 23 | function lock(): any; 24 | 25 | 26 | } -------------------------------------------------------------------------------- /web-control/web/src/utils/auto-height.js: -------------------------------------------------------------------------------- 1 | export default { 2 | componentUpdated(el, binding, vnode) { 3 | const ctx = vnode.context; 4 | if (!ctx || typeof ctx[binding.arg] === 'undefined' || ctx.autoHeightResizeListener) return; 5 | 6 | ctx.autoHeightResizeListener = () => { 7 | let top = el.offsetTop; 8 | let cur = el.offsetParent; 9 | while (cur !== null) { 10 | top += cur.offsetTop; 11 | cur = cur.offsetParent; 12 | } 13 | const h = (window.innerHeight - top) + binding.value; 14 | ctx[binding.arg] = Math.max(h, 100); 15 | }; 16 | 17 | window.addEventListener('resize', ctx.autoHeightResizeListener, false); 18 | setTimeout(ctx.autoHeightResizeListener, 50); 19 | }, 20 | unbind(el, binding, vnode) { 21 | const ctx = vnode.context; 22 | if (ctx && ctx.autoHeightResizeListener) { 23 | window.removeEventListener('resize', ctx.autoHeightResizeListener, false); 24 | ctx.autoHeightResizeListener = null; 25 | } 26 | }, 27 | }; 28 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "end-auto", 3 | "version": "1.0.0", 4 | "description": "", 5 | "main": "index.js", 6 | "scripts": { 7 | "start": "concurrently \"npm run watch:server\" \"npm run watch:web\"", 8 | "dev": "cd autojs-web-control-docker/server && npm run dev && cd ../web && npm run dev", 9 | "test": "echo \"Error: no test specified\" && exit 1", 10 | "watch:server": "cd autojs-web-control-docker/server && npm run dev", 11 | "watch:web": "cd autojs-web-control-docker/web && npm run dev" 12 | }, 13 | "engines": { 14 | "node": "16.13.0", 15 | "npm": "8.1.0" 16 | }, 17 | "repository": { 18 | "type": "git", 19 | "url": "git+https://github.com/debug-null/autojs-web.git" 20 | }, 21 | "keywords": [], 22 | "author": "", 23 | "license": "ISC", 24 | "bugs": { 25 | "url": "https://github.com/debug-null/autojs-web/issues" 26 | }, 27 | "homepage": "https://github.com/debug-null/autojs-web#readme", 28 | "devDependencies": { 29 | "concurrently": "^8.2.0" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/mode/multiplex_test.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function() { 5 | CodeMirror.defineMode("markdown_with_stex", function(){ 6 | var inner = CodeMirror.getMode({}, "stex"); 7 | var outer = CodeMirror.getMode({}, "markdown"); 8 | 9 | var innerOptions = { 10 | open: '$', 11 | close: '$', 12 | mode: inner, 13 | delimStyle: 'delim', 14 | innerStyle: 'inner' 15 | }; 16 | 17 | return CodeMirror.multiplexingMode(outer, innerOptions); 18 | }); 19 | 20 | var mode = CodeMirror.getMode({}, "markdown_with_stex"); 21 | 22 | function MT(name) { 23 | test.mode( 24 | name, 25 | mode, 26 | Array.prototype.slice.call(arguments, 1), 27 | 'multiplexing'); 28 | } 29 | 30 | MT( 31 | "stexInsideMarkdown", 32 | "[strong **Equation:**] [delim&delim-open $][inner&tag \\pi][delim&delim-close $]"); 33 | })(); 34 | -------------------------------------------------------------------------------- /web-control/server/src/common/soul-orm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "soul-orm", 3 | "version": "1.5.0", 4 | "description": "soul-orm", 5 | "main": "dist/index.js", 6 | "types": "lib/index.ts", 7 | "scripts": { 8 | "publish": "npm run build && npm publish", 9 | "build": "tsc -p tsconfig.json" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/test/soul-orm.git" 14 | }, 15 | "keywords": [ 16 | "soul-orm" 17 | ], 18 | "author": "renkun", 19 | "license": "ISC", 20 | "bugs": { 21 | "url": "https://github.com/test/soul-orm/issues" 22 | }, 23 | "homepage": "https://github.com/test/soul-orm#readme", 24 | "dependencies": { 25 | "mysql": "^2.17.1", 26 | "sqlstring": "^2.3.1" 27 | }, 28 | "devDependencies": { 29 | "@types/mysql": "^2.15.5", 30 | "@types/sqlstring": "^2.2.1", 31 | "@types/node": "^10.12.19", 32 | "prettier": "1.15.3", 33 | "ts-node": "^7.0.1", 34 | "tslint": "5.12.1", 35 | "typescript": "^3.3.1" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /web-control/web/build/index.js: -------------------------------------------------------------------------------- 1 | const { run } = require('runjs') 2 | const chalk = require('chalk') 3 | const config = require('../vue.config.js') 4 | const rawArgv = process.argv.slice(2) 5 | const args = rawArgv.join(' ') 6 | 7 | if (process.env.npm_config_preview || rawArgv.includes('--preview')) { 8 | const report = rawArgv.includes('--report') 9 | 10 | run(`vue-cli-service build ${args}`) 11 | 12 | const port = 9526 13 | const publicPath = config.publicPath 14 | 15 | var connect = require('connect') 16 | var serveStatic = require('serve-static') 17 | const app = connect() 18 | 19 | app.use( 20 | publicPath, 21 | serveStatic('./dist', { 22 | index: ['index.html', '/'] 23 | }) 24 | ) 25 | 26 | app.listen(port, function () { 27 | console.log(chalk.green(`> Preview at http://localhost:${port}${publicPath}`)) 28 | if (report) { 29 | console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`)) 30 | } 31 | 32 | }) 33 | } else { 34 | run(`vue-cli-service build ${args}`) 35 | } 36 | -------------------------------------------------------------------------------- /ref-log/service/utils/log4js.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | const {configure, getLogger } = require('log4js'); 4 | 5 | const config = { 6 | replaceConsole: true, 7 | appenders: { 8 | stdout: { type: "stdout" }, 9 | access: { 10 | type: "dateFile", 11 | filename: "./log/access.log", 12 | pattern: "-yyyy-MM-dd", 13 | category: "http", 14 | }, 15 | app: { 16 | type: "file", 17 | filename: "./log/app.log", 18 | maxLogSize: 10485760, 19 | numBackups: 3, 20 | }, 21 | errorFile: { 22 | type: "file", 23 | filename: "./log/errors.log", 24 | }, 25 | errors: { 26 | type: "logLevelFilter", 27 | level: "ERROR", 28 | appender: "errorFile", 29 | }, 30 | }, 31 | categories: { 32 | default: { appenders: ["stdout", "app", "errors"], level: "DEBUG" }, 33 | http: { appenders: ["stdout", "access"], level: "DEBUG" }, 34 | }, 35 | pm2: true, // https://log4js-node.github.io/log4js-node/clustering.html 36 | pm2InstanceVar: "INSTANCE_ID", 37 | }; 38 | 39 | configure(config); 40 | 41 | 42 | 43 | exports.default = getLogger; 44 | -------------------------------------------------------------------------------- /web-control/web/tests/unit/utils/parseTime.spec.js: -------------------------------------------------------------------------------- 1 | import { parseTime } from '@/utils/index.js' 2 | 3 | describe('Utils:parseTime', () => { 4 | const d = new Date('2018-07-13 17:54:01') // "2018-07-13 17:54:01" 5 | it('timestamp', () => { 6 | expect(parseTime(d)).toBe('2018-07-13 17:54:01') 7 | }) 8 | it('ten digits timestamp', () => { 9 | expect(parseTime((d / 1000).toFixed(0))).toBe('2018-07-13 17:54:01') 10 | }) 11 | it('new Date', () => { 12 | expect(parseTime(new Date(d))).toBe('2018-07-13 17:54:01') 13 | }) 14 | it('format', () => { 15 | expect(parseTime(d, '{y}-{m}-{d} {h}:{i}')).toBe('2018-07-13 17:54') 16 | expect(parseTime(d, '{y}-{m}-{d}')).toBe('2018-07-13') 17 | expect(parseTime(d, '{y}/{m}/{d} {h}-{i}')).toBe('2018/07/13 17-54') 18 | }) 19 | it('get the day of the week', () => { 20 | expect(parseTime(d, '{a}')).toBe('五') // 星期五 21 | }) 22 | it('get the day of the week', () => { 23 | expect(parseTime(+d + 1000 * 60 * 60 * 24 * 2, '{a}')).toBe('日') // 星期日 24 | }) 25 | it('empty argument', () => { 26 | expect(parseTime()).toBeNull() 27 | }) 28 | }) 29 | -------------------------------------------------------------------------------- /web-control/server/src/utils/log4js.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @Author: kun 3 | */ 4 | 5 | import { configure, getLogger } from "log4js"; 6 | const config = { 7 | replaceConsole: true, 8 | appenders: { 9 | stdout: { type: "stdout" }, 10 | access: { 11 | type: "dateFile", 12 | filename: "log/access.log", 13 | pattern: "-yyyy-MM-dd", 14 | category: "http", 15 | }, 16 | app: { 17 | type: "file", 18 | filename: "log/app.log", 19 | maxLogSize: 10485760, 20 | numBackups: 3, 21 | }, 22 | errorFile: { 23 | type: "file", 24 | filename: "log/errors.log", 25 | }, 26 | errors: { 27 | type: "logLevelFilter", 28 | level: "ERROR", 29 | appender: "errorFile", 30 | }, 31 | }, 32 | categories: { 33 | default: { appenders: ["stdout", "app", "errors"], level: "DEBUG" }, 34 | http: { appenders: ["stdout", "access"], level: "DEBUG" }, 35 | }, 36 | pm2: true, // https://log4js-node.github.io/log4js-node/clustering.html 37 | pm2InstanceVar: "INSTANCE_ID", 38 | }; 39 | 40 | configure(config); 41 | 42 | export default getLogger; 43 | -------------------------------------------------------------------------------- /autox-ts/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "lib": [ 4 | "es2015" 5 | ], 6 | "allowJs": true, 7 | "checkJs": false, 8 | "importHelpers": true, 9 | "strict": true, 10 | "noImplicitAny": false, 11 | "strictNullChecks": true, 12 | "noImplicitThis": true, 13 | "alwaysStrict": true, 14 | "noImplicitReturns": true, 15 | "allowUmdGlobalAccess": true, 16 | "baseUrl": ".", 17 | "paths": {}, 18 | "types": [ 19 | "node", 20 | "./types/autox/adbkit.d.ts", 21 | "./types/autox/auto.d.ts", 22 | "./types/autox/autojs.d.ts", 23 | "./types/project/global.d.ts", 24 | "./types/project/module.d.ts" 25 | ], 26 | "experimentalDecorators": false, 27 | "emitDecoratorMetadata": false, 28 | "resolveJsonModule": true 29 | }, 30 | "include": [ 31 | "./src/**/*", 32 | "./lib/**/*" 33 | ], 34 | "exclude": [ 35 | "./.vscode/", 36 | "./build/", 37 | "./dist/", 38 | "./types/", 39 | "./src/assets/", 40 | "./src/static/" 41 | ], 42 | "extends": "@tsconfig/recommended/tsconfig.json", 43 | "compileOnSave": true 44 | } 45 | -------------------------------------------------------------------------------- /autox-ts/types/autox/auto.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | /// 3 | /// 4 | /// 5 | /// 6 | /// 7 | /// 8 | /// 9 | /// 10 | /// 11 | /// 12 | /// 13 | /// 14 | /// 15 | /// 16 | /// 17 | /// 18 | /// 19 | /// 20 | /// 21 | /// 22 | 23 | 24 | declare global { 25 | 26 | } 27 | 28 | export { }; -------------------------------------------------------------------------------- /web-control/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-present PanJiaChen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /web-control/server/src/decorators/role.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @Author: kun 3 | * @Date: 2019-10 4 | */ 5 | 6 | import { Use, Description } from "../common/application"; 7 | import * as Koa from "koa"; 8 | import { verify } from "../middleware/app-jwt"; 9 | import db from "../utils/db"; 10 | 11 | export default function Role(...roles: string[]) { 12 | const role = Use(async (ctx: Koa.Context, next: () => Promise) => { 13 | const signData = await verify(ctx); 14 | ctx.state.curUser = signData; 15 | // const sql = ` 16 | // SELECT R.code FROM role R 17 | // LEFT JOIN user_roles UR ON UR.role_id = R.id 18 | // WHERE UR.user_id = ? 19 | // `; 20 | // const userRoles = await db.query(sql, [signData.id]); 21 | // if (roles.some(r => userRoles.find(ur => ur.code === r))) { 22 | // next(); 23 | // } else { 24 | // throw new Error('no authorization!'); 25 | // } 26 | 27 | await next(); 28 | }); 29 | 30 | const description = Description(`【${roles.join()}】`); 31 | 32 | return (target: any, propertyKey?: string) => { 33 | role(target, propertyKey); 34 | description(target, propertyKey); 35 | }; 36 | } 37 | -------------------------------------------------------------------------------- /web-control/web/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017-present PanJiaChen 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/edit/trailingspace.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | CodeMirror.defineOption("showTrailingSpace", false, function(cm, val, prev) { 13 | if (prev == CodeMirror.Init) prev = false; 14 | if (prev && !val) 15 | cm.removeOverlay("trailingspace"); 16 | else if (!prev && val) 17 | cm.addOverlay({ 18 | token: function(stream) { 19 | for (var l = stream.string.length, i = l; i && /\s/.test(stream.string.charAt(i - 1)); --i) {} 20 | if (i > stream.pos) { stream.pos = i; return null; } 21 | stream.pos = l; 22 | return "trailingspace"; 23 | }, 24 | name: "trailingspace" 25 | }); 26 | }); 27 | }); 28 | -------------------------------------------------------------------------------- /web-control/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | # 数据库 5 | yk-mysql: 6 | build: ./mysql 7 | container_name: yk-mysql 8 | environment: 9 | MYSQL_ROOT_PASSWORD: examplepassword 10 | ports: 11 | - "3306:3306" 12 | volumes: 13 | - "./mysql/data:/var/lib/mysql" 14 | command: --default-authentication-plugin=mysql_native_password 15 | networks: 16 | - app-net 17 | 18 | # 数据库管理工具 19 | yk-mysql-admin: 20 | image: phpmyadmin 21 | container_name: yk-mysql-admin 22 | links: 23 | - yk-mysql 24 | environment: 25 | PMA_HOST: yk-mysql 26 | ports: 27 | - "9999:80" 28 | networks: 29 | - app-net 30 | 31 | # api服务器 32 | yk-server: 33 | build: ./server 34 | container_name: yk-server 35 | links: 36 | - yk-mysql 37 | ports: 38 | - "8889:8889" 39 | networks: 40 | - app-net 41 | 42 | # 后台页面 43 | yk-web: 44 | build: ./web 45 | container_name: yk-web 46 | ports: 47 | - "8888:80" 48 | links: 49 | - yk-server 50 | networks: 51 | - app-net 52 | 53 | networks: 54 | app-net: 55 | driver: bridge 56 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/neo.css: -------------------------------------------------------------------------------- 1 | /* neo theme for codemirror */ 2 | 3 | /* Color scheme */ 4 | 5 | .cm-s-neo.CodeMirror { 6 | background-color:#ffffff; 7 | color:#2e383c; 8 | line-height:1.4375; 9 | } 10 | .cm-s-neo .cm-comment { color:#75787b; } 11 | .cm-s-neo .cm-keyword, .cm-s-neo .cm-property { color:#1d75b3; } 12 | .cm-s-neo .cm-atom,.cm-s-neo .cm-number { color:#75438a; } 13 | .cm-s-neo .cm-node,.cm-s-neo .cm-tag { color:#9c3328; } 14 | .cm-s-neo .cm-string { color:#b35e14; } 15 | .cm-s-neo .cm-variable,.cm-s-neo .cm-qualifier { color:#047d65; } 16 | 17 | 18 | /* Editor styling */ 19 | 20 | .cm-s-neo pre { 21 | padding:0; 22 | } 23 | 24 | .cm-s-neo .CodeMirror-gutters { 25 | border:none; 26 | border-right:10px solid transparent; 27 | background-color:transparent; 28 | } 29 | 30 | .cm-s-neo .CodeMirror-linenumber { 31 | padding:0; 32 | color:#e0e2e5; 33 | } 34 | 35 | .cm-s-neo .CodeMirror-guttermarker { color: #1d75b3; } 36 | .cm-s-neo .CodeMirror-guttermarker-subtle { color: #e0e2e5; } 37 | 38 | .cm-s-neo .CodeMirror-cursor { 39 | width: auto; 40 | border: 0; 41 | background: rgba(155,157,162,0.37); 42 | z-index: 1; 43 | } 44 | -------------------------------------------------------------------------------- /web-control/web/tests/unit/utils/formatTime.spec.js: -------------------------------------------------------------------------------- 1 | import { formatTime } from '@/utils/index.js' 2 | 3 | describe('Utils:formatTime', () => { 4 | const d = new Date('2018-07-13 17:54:01') // "2018-07-13 17:54:01" 5 | const retrofit = 5 * 1000 6 | 7 | it('ten digits timestamp', () => { 8 | expect(formatTime((d / 1000).toFixed(0))).toBe('7月13日17时54分') 9 | }) 10 | it('test now', () => { 11 | expect(formatTime(+new Date() - 1)).toBe('刚刚') 12 | }) 13 | it('less two minute', () => { 14 | expect(formatTime(+new Date() - 60 * 2 * 1000 + retrofit)).toBe('2分钟前') 15 | }) 16 | it('less two hour', () => { 17 | expect(formatTime(+new Date() - 60 * 60 * 2 * 1000 + retrofit)).toBe('2小时前') 18 | }) 19 | it('less one day', () => { 20 | expect(formatTime(+new Date() - 60 * 60 * 24 * 1 * 1000)).toBe('1天前') 21 | }) 22 | it('more than one day', () => { 23 | expect(formatTime(d)).toBe('7月13日17时54分') 24 | }) 25 | it('format', () => { 26 | expect(formatTime(d, '{y}-{m}-{d} {h}:{i}')).toBe('2018-07-13 17:54') 27 | expect(formatTime(d, '{y}-{m}-{d}')).toBe('2018-07-13') 28 | expect(formatTime(d, '{y}/{m}/{d} {h}-{i}')).toBe('2018/07/13 17-54') 29 | }) 30 | }) 31 | -------------------------------------------------------------------------------- /web-control/server/src/common/soul-orm/lib/tx.ts: -------------------------------------------------------------------------------- 1 | import { QueryBuilder, IQueryFunction } from './query-builder'; 2 | 3 | export interface IConnection { 4 | query: IQueryFunction; 5 | commit: () => Promise; 6 | rollback: () => Promise; 7 | } 8 | 9 | export class Tx { 10 | private conn: IConnection; 11 | 12 | constructor(conn: IConnection) { 13 | this.conn = conn; 14 | } 15 | 16 | public table(tb: string): QueryBuilder { 17 | return QueryBuilder.table(tb, { queryFunction: this.conn.query }); 18 | } 19 | 20 | async query(sql: string, values?: any, options?: any): Promise { 21 | let opt = null; 22 | if (arguments.length === 3) { 23 | opt = Object.assign(options, { sql, values }); 24 | } else if (arguments.length === 2) { 25 | if (Array.isArray(values)) { 26 | opt = { sql, values }; 27 | } else { 28 | opt = Object.assign(values, { sql }); 29 | } 30 | } else { 31 | opt = { sql }; 32 | } 33 | return this.conn.query(opt); 34 | } 35 | 36 | public async commit() { 37 | await this.conn.commit(); 38 | } 39 | 40 | public async rollback() { 41 | await this.conn.rollback(); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /autox-ts/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "hotel-xcx-prview", 3 | "version": "0.0.1", 4 | "scripts": { 5 | "build:dev": "tsup --env.NODE_ENV=development", 6 | "build:prod": "tsup --env.NODE_ENV=production", 7 | "rerun:dev": "tsup --env.NODE_ENV=development --env.DEPLOY_ACTION=rerun", 8 | "rerun:prod": "tsup --env.NODE_ENV=production --env.DEPLOY_ACTION=rerun", 9 | "save:dev": "tsup --env.NODE_ENV=development --env.DEPLOY_ACTION=save", 10 | "save:prod": "tsup --env.NODE_ENV=production --env.DEPLOY_ACTION=save", 11 | "deploy:dev": "tsup --env.NODE_ENV=development --env.DEPLOY_ACTION=both", 12 | "deploy:prod": "tsup --env.NODE_ENV=production --env.DEPLOY_ACTION=both", 13 | "watch:dev": "tsup --env.NODE_ENV=development --env.DEPLOY_ACTION=rerun --env.IS_WATCH=true", 14 | "watch:prod": "tsup --env.NODE_ENV=production --env.DEPLOY_ACTION=rerun --env.IS_WATCH=true" 15 | }, 16 | "dependencies": { 17 | "common-tags": "^1.8.2" 18 | }, 19 | "devDependencies": { 20 | "@swc/core": "^1.3.56", 21 | "tsup": "^6.7.0", 22 | "tslib": "^2.5.0", 23 | "typescript": "^5.0.4", 24 | "@types/node": "^18.16.5", 25 | "@tsconfig/recommended": "^1.0.2" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/middlewares/param-validate.ts: -------------------------------------------------------------------------------- 1 | import * as joi from 'joi'; 2 | import * as Koa from 'koa'; 3 | import { PARAM_VALIDATIONE_RROR } from '../constants'; 4 | 5 | /** 6 | * Return middleware that handle exceptions in Koa. 7 | * Dispose to the first middleware. 8 | * 9 | * @return {function} Koa middleware. 10 | */ 11 | 12 | const joiOptions = { 13 | allowUnknown: true, // 允许出现未声明的字段 14 | stripUnknown: true, // 移除未声明的字段 15 | skipFunctions: true, // ignores unknown keys with a function value 16 | }; 17 | export function ParamValidate(schema: joi.AnySchema, option: { type: string }): Koa.Middleware { 18 | return async (ctx: Koa.Context | any, next) => { 19 | const data = option.type === 'query' ? ctx.request.query : ctx.request.body; 20 | const result = joi.validate(data, schema, joiOptions); 21 | if (result.error === null) { 22 | ctx.reqData = result.value; 23 | if (option.type === 'query') { 24 | ctx.request.query = result.value; 25 | } else { 26 | ctx.request.body = result.value; 27 | } 28 | await next(); 29 | } else { 30 | result.error.name = PARAM_VALIDATIONE_RROR; 31 | throw result.error; 32 | } 33 | }; 34 | } 35 | -------------------------------------------------------------------------------- /web-control/web/src/styles/index.scss: -------------------------------------------------------------------------------- 1 | @import './variables.scss'; 2 | @import './mixin.scss'; 3 | @import './transition.scss'; 4 | @import './element-ui.scss'; 5 | @import './sidebar.scss'; 6 | @import './base.scss'; 7 | body { 8 | height: 100%; 9 | -moz-osx-font-smoothing: grayscale; 10 | -webkit-font-smoothing: antialiased; 11 | text-rendering: optimizeLegibility; 12 | font-family: Helvetica Neue, Helvetica, PingFang SC, Hiragino Sans GB, Microsoft YaHei, Arial, sans-serif; 13 | } 14 | 15 | label { 16 | font-weight: 700; 17 | } 18 | 19 | html { 20 | height: 100%; 21 | box-sizing: border-box; 22 | } 23 | 24 | #app { 25 | height: 100%; 26 | } 27 | 28 | *, 29 | *:before, 30 | *:after { 31 | box-sizing: inherit; 32 | } 33 | 34 | a:focus, 35 | a:active { 36 | outline: none; 37 | } 38 | 39 | a, 40 | a:focus, 41 | a:hover { 42 | cursor: pointer; 43 | color: inherit; 44 | text-decoration: none; 45 | } 46 | 47 | div:focus { 48 | outline: none; 49 | } 50 | 51 | .clearfix { 52 | &:after { 53 | visibility: hidden; 54 | display: block; 55 | font-size: 0; 56 | content: " "; 57 | clear: both; 58 | height: 0; 59 | } 60 | } 61 | 62 | // main-container global css 63 | .app-container { 64 | padding: 20px; 65 | } 66 | -------------------------------------------------------------------------------- /web-control/web/src/icons/svg/eye-open.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web-control/server/src/common/soul-orm/lib/re-cartesian.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * k 3 | * 2019-02-13 4 | */ 5 | 6 | interface IStructure { 7 | id: string; 8 | [k: string]: IStructure | IStructure[] | string; 9 | } 10 | 11 | /** 12 | * 反笛卡尔积 13 | * @param dataList sql查询结果集 14 | * @param structure 结构描述 15 | * @param results - 递归需要 16 | */ 17 | export function reCartesian(dataList: any[], structure: IStructure, results: any[] = []): any[] { 18 | const keyMap = {}; 19 | 20 | dataList.forEach(row => { 21 | const [table, id] = structure.id.split('.'); 22 | const key = row[table][id]; 23 | if (key === null) return; 24 | if (!keyMap[key]) { 25 | keyMap[key] = []; 26 | row[table].groups = () => keyMap[key]; 27 | results.push(row[table]); 28 | } 29 | keyMap[key].push(row); 30 | }); 31 | 32 | Object.keys(structure) 33 | .filter(k => !['id'].find(it => k === it)) 34 | .forEach((key) => { 35 | const value = structure[key]; 36 | const stru: any = Array.isArray(value) ? value[0] : value; 37 | results.forEach(row => { 38 | const data = reCartesian(row.groups(), typeof stru === 'string' ? { id: stru } : stru); 39 | row[key] = Array.isArray(value) ? data : data[0]; 40 | }); 41 | }); 42 | 43 | return results; 44 | } 45 | -------------------------------------------------------------------------------- /ref-log/websocket.js: -------------------------------------------------------------------------------- 1 | importPackage(Packages["okhttp3"]); //导入包 2 | var client = new OkHttpClient.Builder().retryOnConnectionFailure(true).build(); 3 | var request = new Request.Builder().url("ws://192.168.2.194:7002/socket.io/?EIO=3&transport=websocket").build(); //vscode 插件的ip地址, 4 | client.dispatcher().cancelAll(); //清理一次 5 | 6 | //创建链接 7 | var webSocket = client.newWebSocket( 8 | request, 9 | new WebSocketListener({ 10 | onOpen: function (webSocket, response) { 11 | print("onOpen"); 12 | }, 13 | onMessage: function (webSocket, msg) { 14 | try { 15 | console.log("🚀 ~ file: websocket.js:33 ~ msg:", msg) 16 | 17 | // var obj = JSON.parse(msg); 18 | // console.log("🚀 ~ file: websocket.js:14 ~ obj:", obj); 19 | } catch (error) { 20 | console.log("🚀 ~ file: websocket.js:17 ~ error:", error); 21 | } 22 | }, 23 | onClosing: function (webSocket, code, response) { 24 | print("正在关闭"); 25 | }, 26 | onClosed: function (webSocket, code, response) { 27 | print("已关闭"); 28 | }, 29 | onFailure: function (webSocket, t, response) { 30 | print("错误"); 31 | print(t); 32 | exit(); 33 | } 34 | }) 35 | ); 36 | 37 | webSocket.send('init') 38 | 39 | // 设置定时器, 目的是不让脚本停止 40 | setInterval(function () {}, 1000); 41 | -------------------------------------------------------------------------------- /web-control/web/src/store/modules/app.js: -------------------------------------------------------------------------------- 1 | import Cookies from 'js-cookie'; 2 | 3 | const state = { 4 | sidebar: { 5 | opened: Cookies.get('sidebarStatus') ? !!+Cookies.get('sidebarStatus') : true, 6 | withoutAnimation: false 7 | }, 8 | device: 'desktop' 9 | }; 10 | 11 | const mutations = { 12 | TOGGLE_SIDEBAR: state => { 13 | state.sidebar.opened = !state.sidebar.opened; 14 | state.sidebar.withoutAnimation = false; 15 | if (state.sidebar.opened) { 16 | Cookies.set('sidebarStatus', 1); 17 | } else { 18 | Cookies.set('sidebarStatus', 0); 19 | } 20 | }, 21 | CLOSE_SIDEBAR: (state, withoutAnimation) => { 22 | Cookies.set('sidebarStatus', 0); 23 | state.sidebar.opened = false; 24 | state.sidebar.withoutAnimation = withoutAnimation; 25 | }, 26 | TOGGLE_DEVICE: (state, device) => { 27 | state.device = device; 28 | } 29 | }; 30 | 31 | const actions = { 32 | toggleSideBar({ commit }) { 33 | commit('TOGGLE_SIDEBAR'); 34 | }, 35 | closeSideBar({ commit }, { withoutAnimation }) { 36 | commit('CLOSE_SIDEBAR', withoutAnimation); 37 | }, 38 | toggleDevice({ commit }, device) { 39 | commit('TOGGLE_DEVICE', device); 40 | } 41 | }; 42 | 43 | export default { 44 | namespaced: true, 45 | state, 46 | mutations, 47 | actions 48 | }; 49 | -------------------------------------------------------------------------------- /web-control/server/src/common/soul-orm/README.md: -------------------------------------------------------------------------------- 1 | npm install soul-orm 2 | ``` typescript 3 | const users = await db.table('user').where({ name: 'jake' }).order('age', 'desc').select(); 4 | const users = await db.table('user').where('name = ?', ['jake']).limit(10, 20).select(); 5 | const user = await db.table('user').where({ name: 'jake' }).field('name', 'age').find(); 6 | const user = await db.table('user').where({ name: 'jake' }).findOrEmpty(); 7 | // insert 8 | await db.table('user').insert({ name: 'jake', age: '22' }); 9 | await db.table('user').insert([{ name: 'jake', age: '22' }, { name: 'jake', age: '22' }]); 10 | // update 11 | await db.table('user').where({ name: 'jake' }).update({ name: 'new name' }); 12 | // delete 13 | await db.table('user').where({ name: 'jake' }).delete(); 14 | // transaction 15 | const tx = await db.beginTx(); 16 | try { 17 | await tx.table('user').insert({ name: 'jake' }); 18 | await tx.table('user').where({ name: 'jake' }).update({ name: 'new name' }); 19 | await tx.commit(); 20 | } catch (error) { 21 | await tx.rollback(); 22 | } 23 | // row query 24 | const result = await db.query(`SELECT * FROM user U LEFT JOIN user_roles UR ON UR.user_id = U.id WHERE U.type = ?`, ['type']); 25 | 26 | ``` 27 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/eclipse.css: -------------------------------------------------------------------------------- 1 | .cm-s-eclipse span.cm-meta { color: #FF1717; } 2 | .cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; } 3 | .cm-s-eclipse span.cm-atom { color: #219; } 4 | .cm-s-eclipse span.cm-number { color: #164; } 5 | .cm-s-eclipse span.cm-def { color: #00f; } 6 | .cm-s-eclipse span.cm-variable { color: black; } 7 | .cm-s-eclipse span.cm-variable-2 { color: #0000C0; } 8 | .cm-s-eclipse span.cm-variable-3, .cm-s-eclipse span.cm-type { color: #0000C0; } 9 | .cm-s-eclipse span.cm-property { color: black; } 10 | .cm-s-eclipse span.cm-operator { color: black; } 11 | .cm-s-eclipse span.cm-comment { color: #3F7F5F; } 12 | .cm-s-eclipse span.cm-string { color: #2A00FF; } 13 | .cm-s-eclipse span.cm-string-2 { color: #f50; } 14 | .cm-s-eclipse span.cm-qualifier { color: #555; } 15 | .cm-s-eclipse span.cm-builtin { color: #30a; } 16 | .cm-s-eclipse span.cm-bracket { color: #cc7; } 17 | .cm-s-eclipse span.cm-tag { color: #170; } 18 | .cm-s-eclipse span.cm-attribute { color: #00c; } 19 | .cm-s-eclipse span.cm-link { color: #219; } 20 | .cm-s-eclipse span.cm-error { color: #f00; } 21 | 22 | .cm-s-eclipse .CodeMirror-activeline-background { background: #e8f2ff; } 23 | .cm-s-eclipse .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; } 24 | -------------------------------------------------------------------------------- /web-control/server/src/utils/re-cartesian.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * mysql关联查询的结果,可能是个笛卡尔积的形式,这种数据格式并不友好。 3 | * 这是个辅助工具,来改变这种状况, 要配合{ nestTables: true }使用 4 | * kun 5 | * 2019-02-13 6 | */ 7 | 8 | interface IStructure { 9 | table: string; 10 | id: string; 11 | [k: string]: IStructure | IStructure[] | string; 12 | } 13 | 14 | /** 15 | * 反笛卡尔积 16 | * @param dataList sql查询结果集 17 | * @param structure 结构描述 18 | * @param results - 递归需要 19 | */ 20 | export default function reCartesian(dataList: any[], structure: IStructure, results: any[] = []): any[] { 21 | const keyMap = {}; 22 | 23 | dataList.forEach(row => { 24 | const key = row[structure.table][structure.id]; 25 | if (!keyMap[key]) { 26 | keyMap[key] = []; 27 | row[structure.table].groups = () => keyMap[key]; 28 | results.push(row[structure.table]); 29 | } 30 | keyMap[key].push(row); 31 | }); 32 | 33 | Object.keys(structure) 34 | .filter(k => !['table', 'id'].find(it => k === it)) 35 | .forEach(key => { 36 | const value = structure[key]; 37 | const stru: any = Array.isArray(value) ? value[0] : value; 38 | results.forEach(row => { 39 | const data = reCartesian(row.groups(), stru); 40 | row[key] = Array.isArray(value) ? data : data[0]; 41 | }); 42 | }); 43 | 44 | return results; 45 | } 46 | -------------------------------------------------------------------------------- /web-control/web/src/components/Hamburger/index.vue: -------------------------------------------------------------------------------- 1 | 15 | 16 | 32 | 33 | 45 | -------------------------------------------------------------------------------- /upload/index.js: -------------------------------------------------------------------------------- 1 | const http = require('http'); 2 | const formidable = require('formidable'); 3 | const fs = require('fs'); 4 | 5 | const server = http.createServer((req, res) => { 6 | console.log("🚀 ~ file: index.js:7 ~ server ~ req.url :", req.url ) 7 | 8 | if (req.url === '/fileupload' && req.method === 'POST') { 9 | const form = new formidable.IncomingForm(); 10 | form.parse(req, (err, fields, files) => { 11 | console.log("🚀 ~ file: index.js:11 ~ form.parse ~ files:", files.upload) 12 | if (err) { 13 | res.statusCode = 500; 14 | res.end('Internal server error'); 15 | return; 16 | } 17 | const oldpath = files.upload.filepath; 18 | const ext = files.upload.originalFilename.split('.').pop(); 19 | const newpath = `./temp/${Date.now()}.${ext}`; 20 | console.log("🚀 ~ file: index.js:18 ~ form.parse ~ newpath:", newpath) 21 | 22 | fs.rename(oldpath, newpath, (err) => { 23 | if (err) { 24 | res.statusCode = 500; 25 | res.end('Internal server error'); 26 | return; 27 | } 28 | res.statusCode = 200; 29 | res.end(`File uploaded to: ${newpath}`); 30 | }); 31 | }); 32 | } else { 33 | res.statusCode = 404; 34 | res.end('Resource not found'); 35 | } 36 | }); 37 | 38 | server.listen(8080, () => { 39 | console.log('Server is listening on port 8080'); 40 | }); 41 | -------------------------------------------------------------------------------- /web-control/server/src/model/base.model.ts: -------------------------------------------------------------------------------- 1 | import db from "../utils/db"; 2 | 3 | export default class BaseService { 4 | $db = db; 5 | $tableName: string; 6 | $primaryKey: string; 7 | $tableStructure: T; 8 | 9 | constructor(args: { tableName: string; primaryKey?: string }) { 10 | this.$tableName = args.tableName; 11 | this.$primaryKey = args.primaryKey || `${args.tableName}_id`; 12 | } 13 | 14 | async getById(id: string | number): Promise { 15 | return await db 16 | .table(this.$tableName) 17 | .where({ [this.$primaryKey]: id }) 18 | .findOrEmpty(); 19 | } 20 | 21 | async getAll(): Promise { 22 | return await db.table(this.$tableName).select(); 23 | } 24 | 25 | async getPage(): Promise { 26 | return await db.table(this.$tableName).select(); 27 | } 28 | 29 | async deleteById(id: string | number) { 30 | return await db 31 | .table(this.$tableName) 32 | .where({ [this.$primaryKey]: id }) 33 | .delete(); 34 | } 35 | 36 | async insert(data: T): Promise; 37 | async insert(data: T[]): Promise; 38 | async insert(data: T | T[]): Promise { 39 | return await db.table(this.$tableName).insert(data); 40 | } 41 | 42 | async updateById(id: string | number, data: T) { 43 | return await db 44 | .table(this.$tableName) 45 | .where({ [this.$primaryKey]: id }) 46 | .update(data); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ref-log/adb-record.js: -------------------------------------------------------------------------------- 1 | module.exports = function record(timeLimit) { 2 | const defaultOption = { 3 | timeLimit: 10 4 | }; 5 | if(!timeLimit){ 6 | timeLimit = defaultOption.timeLimit; 7 | } 8 | 9 | //adb 录屏 10 | const IS_ROOT = files.exists("/sbin/su") || files.exists("/system/xbin/su") || files.exists("/system/bin/su"); 11 | if (!IS_ROOT) { 12 | toast("没有root权限,无法执行"); 13 | exit; 14 | } 15 | 16 | // 推流: https://shu1shu2.com/article/2022/4/22/38.html 17 | // adb -s 9305ac03 shell screenrecord --bit-rate 8000000 --size 1280x720 --time-limit 30 /sdcard/download/demo.mp4 --verbose 18 | // https://blog.csdn.net/shenfengchen/article/details/111364422 19 | var resolute = "375x820"; 20 | var savePath = "/sdcard/download/demoddd222.mp4"; // 保存路径 21 | var bitRate = "8000000"; 22 | var cmd = `screenrecord --bit-rate ${bitRate} --size ${resolute} --time-limit ${timeLimit} ${savePath}`; 23 | try { 24 | toast(`开始录制,录制时间${timeLimit}秒,保存目录:${savePath}`); 25 | var result = shell(cmd, true); //第二个参数: 是否以root权限运行,默认为false。 26 | if (result.code == 0) { 27 | sleep(3000); 28 | var killCmd = "pkill -l SIGINT -f screenrecord"; // 停止录屏的命令 29 | shell(killCmd, true); // 异步执行命令 30 | toast("录屏结束,保存在Download目录" + savePath); 31 | return savePath; 32 | } else { 33 | toast("执行失败~: " + result.error); 34 | } 35 | } catch (error) { 36 | log(error); 37 | } 38 | }; 39 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/tern/worker.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | // declare global: tern, server 5 | 6 | var server; 7 | 8 | this.onmessage = function(e) { 9 | var data = e.data; 10 | switch (data.type) { 11 | case "init": return startServer(data.defs, data.plugins, data.scripts); 12 | case "add": return server.addFile(data.name, data.text); 13 | case "del": return server.delFile(data.name); 14 | case "req": return server.request(data.body, function(err, reqData) { 15 | postMessage({id: data.id, body: reqData, err: err && String(err)}); 16 | }); 17 | case "getFile": 18 | var c = pending[data.id]; 19 | delete pending[data.id]; 20 | return c(data.err, data.text); 21 | default: throw new Error("Unknown message type: " + data.type); 22 | } 23 | }; 24 | 25 | var nextId = 0, pending = {}; 26 | function getFile(file, c) { 27 | postMessage({type: "getFile", name: file, id: ++nextId}); 28 | pending[nextId] = c; 29 | } 30 | 31 | function startServer(defs, plugins, scripts) { 32 | if (scripts) importScripts.apply(null, scripts); 33 | 34 | server = new tern.Server({ 35 | getFile: getFile, 36 | async: true, 37 | defs: defs, 38 | plugins: plugins 39 | }); 40 | } 41 | 42 | this.console = { 43 | log: function(v) { postMessage({type: "debug", message: v}); } 44 | }; 45 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/demo/closetag.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Close-Tag Demo 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 30 | 31 |
32 |

Close-Tag Demo

33 |
34 | 35 | 41 |
42 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/lint/yaml-lint.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | // Depends on js-yaml.js from https://github.com/nodeca/js-yaml 15 | 16 | // declare global: jsyaml 17 | 18 | CodeMirror.registerHelper("lint", "yaml", function(text) { 19 | var found = []; 20 | if (!window.jsyaml) { 21 | if (window.console) { 22 | window.console.error("Error: window.jsyaml not defined, CodeMirror YAML linting cannot run."); 23 | } 24 | return found; 25 | } 26 | try { jsyaml.loadAll(text); } 27 | catch(e) { 28 | var loc = e.mark, 29 | // js-yaml YAMLException doesn't always provide an accurate lineno 30 | // e.g., when there are multiple yaml docs 31 | // --- 32 | // --- 33 | // foo:bar 34 | from = loc ? CodeMirror.Pos(loc.line, loc.column) : CodeMirror.Pos(0, 0), 35 | to = from; 36 | found.push({ from: from, to: to, message: e.message }); 37 | } 38 | return found; 39 | }); 40 | 41 | }); 42 | -------------------------------------------------------------------------------- /web-control/web/src/layout/mixin/ResizeHandler.js: -------------------------------------------------------------------------------- 1 | import store from '@/store'; 2 | 3 | const { body } = document; 4 | const WIDTH = 992; // refer to Bootstrap's responsive design 5 | 6 | export default { 7 | watch: { 8 | $route(route) { 9 | if (this.device === 'mobile' && this.sidebar.opened) { 10 | store.dispatch('app/closeSideBar', { withoutAnimation: false }); 11 | } 12 | } 13 | }, 14 | beforeMount() { 15 | window.addEventListener('resize', this.$_resizeHandler); 16 | }, 17 | beforeDestroy() { 18 | window.removeEventListener('resize', this.$_resizeHandler); 19 | }, 20 | mounted() { 21 | const isMobile = this.$_isMobile(); 22 | if (isMobile) { 23 | store.dispatch('app/toggleDevice', 'mobile'); 24 | store.dispatch('app/closeSideBar', { withoutAnimation: true }); 25 | } 26 | }, 27 | methods: { 28 | // use $_ for mixins properties 29 | // https://vuejs.org/v2/style-guide/index.html#Private-property-names-essential 30 | $_isMobile() { 31 | const rect = body.getBoundingClientRect(); 32 | return rect.width - 1 < WIDTH; 33 | }, 34 | $_resizeHandler() { 35 | if (!document.hidden) { 36 | const isMobile = this.$_isMobile(); 37 | store.dispatch('app/toggleDevice', isMobile ? 'mobile' : 'desktop'); 38 | 39 | if (isMobile) { 40 | store.dispatch('app/closeSideBar', { withoutAnimation: true }); 41 | } 42 | } 43 | } 44 | } 45 | }; 46 | -------------------------------------------------------------------------------- /web-control/server/src/common/souljs/lib/application.ts: -------------------------------------------------------------------------------- 1 | import * as http from 'http'; 2 | import * as Koa from 'koa'; 3 | import { RouterResolver } from './router/router-resolver'; 4 | import { ILogger } from './interfaces'; 5 | 6 | export class Application { 7 | private readonly httpServer: http.Server; 8 | private readonly koaInstance: Koa; 9 | private readonly routers: any[]; 10 | private readonly logger: ILogger; 11 | 12 | constructor(routers: any[], options: { logger: ILogger }) { 13 | this.routers = routers; 14 | this.logger = options.logger; 15 | this.koaInstance = new Koa(); 16 | this.httpServer = this.createHttpServer(); 17 | } 18 | 19 | private createHttpServer(): http.Server { 20 | return http.createServer(this.koaInstance.callback()); 21 | } 22 | 23 | private registerRouter() { 24 | const routerResolver = new RouterResolver(this.routers, this); 25 | routerResolver.resolve(); 26 | } 27 | 28 | use(mid: Koa.Middleware) { 29 | this.koaInstance.use(mid); 30 | } 31 | 32 | listen(port: number) { 33 | this.registerRouter(); 34 | this.httpServer.listen(port); 35 | this.logger.info('Listening at %d', port); 36 | } 37 | 38 | getKoaInstance(): Koa { 39 | return this.koaInstance; 40 | } 41 | 42 | getHttpServer(): http.Server { 43 | return this.httpServer; 44 | } 45 | 46 | getRouters(): any[] { 47 | return this.routers; 48 | } 49 | 50 | getLogger(): ILogger { 51 | return this.logger; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /autox-ts/types/autox/modules/root.d.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * RootAutomator是一个使用root权限来模拟触摸的对象,用它可以完成触摸与多点触摸,并且这些动作的执行没有延迟。 3 | * 4 | * 一个脚本中最好只存在一个RootAutomator,并且保证脚本结束退出他。 5 | */ 6 | declare class RootAutomator { 7 | /** 8 | * 点击位置(x, y)。其中id是一个整数值,用于区分多点触摸,不同的id表示不同的"手指"。 9 | */ 10 | tap(x: number, y: number, id?: number): void; 11 | 12 | /** 13 | * 模拟一次从(x1, y1)到(x2, y2)的时间为duration毫秒的滑动。 14 | */ 15 | swipe(x1: number, x2: number, y1: number, y2: number, duration?: number): void; 16 | 17 | /** 18 | * 模拟按下位置(x, y),时长为duration毫秒。 19 | */ 20 | press(x: number, y: number, duration: number, id?: number): void; 21 | 22 | /** 23 | * 模拟长按位置(x, y)。 24 | */ 25 | longPress(x: number, y: number, duration?: number, id?: number): void; 26 | 27 | /** 28 | * 模拟手指按下位置(x, y)。 29 | */ 30 | touchDown(x: number, y: number, id?: number): void; 31 | 32 | /** 33 | * 模拟移动手指到位置(x, y)。 34 | */ 35 | touchMove(x: number, y: number, id?: number): void; 36 | 37 | /** 38 | * 模拟手指弹起。 39 | */ 40 | touchUp(id?: number): void; 41 | 42 | } 43 | 44 | /** 45 | * 需要Root权限 46 | * 47 | * 实验API,请勿过度依赖 48 | * 49 | * 点击位置(x, y), 您可以通过"开发者选项"开启指针位置来确定点击坐标。 50 | */ 51 | declare function Tap(x: number, y: number): void; 52 | 53 | /** 54 | * 需要Root权限 55 | * 56 | * 实验API,请勿过度依赖 57 | * 58 | * 滑动。从(x1, y1)位置滑动到(x2, y2)位置。 59 | */ 60 | declare function Swipe(x1: number, x2: number, y1: number, y2: number, duration?: number): void; 61 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/runmode/colorize.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("./runmode")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror", "./runmode"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | var isBlock = /^(p|li|div|h\\d|pre|blockquote|td)$/; 15 | 16 | function textContent(node, out) { 17 | if (node.nodeType == 3) return out.push(node.nodeValue); 18 | for (var ch = node.firstChild; ch; ch = ch.nextSibling) { 19 | textContent(ch, out); 20 | if (isBlock.test(node.nodeType)) out.push("\n"); 21 | } 22 | } 23 | 24 | CodeMirror.colorize = function(collection, defaultMode) { 25 | if (!collection) collection = document.body.getElementsByTagName("pre"); 26 | 27 | for (var i = 0; i < collection.length; ++i) { 28 | var node = collection[i]; 29 | var mode = node.getAttribute("data-lang") || defaultMode; 30 | if (!mode) continue; 31 | 32 | var text = []; 33 | textContent(node, text); 34 | node.innerHTML = ""; 35 | CodeMirror.runMode(text.join(""), mode, node); 36 | 37 | node.className += " cm-s-default"; 38 | } 39 | }; 40 | }); 41 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/lint/css-lint.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | // Depends on csslint.js from https://github.com/stubbornella/csslint 5 | 6 | // declare global: CSSLint 7 | 8 | (function(mod) { 9 | if (typeof exports == "object" && typeof module == "object") // CommonJS 10 | mod(require("../../lib/codemirror")); 11 | else if (typeof define == "function" && define.amd) // AMD 12 | define(["../../lib/codemirror"], mod); 13 | else // Plain browser env 14 | mod(CodeMirror); 15 | })(function(CodeMirror) { 16 | "use strict"; 17 | 18 | CodeMirror.registerHelper("lint", "css", function(text, options) { 19 | var found = []; 20 | if (!window.CSSLint) { 21 | if (window.console) { 22 | window.console.error("Error: window.CSSLint not defined, CodeMirror CSS linting cannot run."); 23 | } 24 | return found; 25 | } 26 | var results = CSSLint.verify(text, options), messages = results.messages, message = null; 27 | for ( var i = 0; i < messages.length; i++) { 28 | message = messages[i]; 29 | var startLine = message.line -1, endLine = message.line -1, startCol = message.col -1, endCol = message.col; 30 | found.push({ 31 | from: CodeMirror.Pos(startLine, startCol), 32 | to: CodeMirror.Pos(endLine, endCol), 33 | message: message.message, 34 | severity : message.type 35 | }); 36 | } 37 | return found; 38 | }); 39 | 40 | }); 41 | -------------------------------------------------------------------------------- /web-control/server/src/common/soul-orm/lib/test.ts: -------------------------------------------------------------------------------- 1 | import { DBM } from './dbm'; 2 | 3 | export const db = new DBM({ 4 | connectionLimit: 10, 5 | host: 'localhost', 6 | user: 'root', 7 | password: 'Mysql@123qwer', 8 | database: 'souljs', 9 | isDebug: true, 10 | }); 11 | 12 | (async () => { 13 | 14 | db.reCartesian([], { id: '' }); 15 | 16 | const users2 = await db.table('user').where({ name: 'jake' }).order('age', 'desc').select(); 17 | const users3 = await db.table('user').where('name = ?', ['jake']).limit(10, 20).select(); 18 | const user4 = await db.table('user').where({ name: 'jake' }).field('name', 'age').find(); 19 | const user5 = await db.table('user').where({ name: 'jake' }).findOrEmpty(); 20 | // insert 21 | await db.table('user').insert({ name: 'jake', age: '22' }); 22 | await db.table('user').insert([{ name: 'jake', age: '22' }, { name: 'jake', age: '22' }]); 23 | // update 24 | await db.table('user').where({ name: 'jake' }).update({ name: 'new name' }); 25 | // delete 26 | await db.table('user').where({ name: 'jake' }).delete(); 27 | // transaction 28 | const tx = await db.beginTx(); 29 | try { 30 | await tx.table('user').insert({ name: 'jake' }); 31 | await tx.table('user').where({ name: 'jake' }).update({ name: 'new name' }); 32 | await tx.commit(); 33 | } catch (error) { 34 | await tx.rollback(); 35 | } 36 | // row query 37 | const result = await db.query(`SELECT * FROM user U LEFT JOIN user_roles UR ON UR.user_id = U.id WHERE U.type = ?`, ['type']); 38 | }); 39 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/lint/json-lint.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | // Depends on jsonlint.js from https://github.com/zaach/jsonlint 5 | 6 | // declare global: jsonlint 7 | 8 | (function(mod) { 9 | if (typeof exports == "object" && typeof module == "object") // CommonJS 10 | mod(require("../../lib/codemirror")); 11 | else if (typeof define == "function" && define.amd) // AMD 12 | define(["../../lib/codemirror"], mod); 13 | else // Plain browser env 14 | mod(CodeMirror); 15 | })(function(CodeMirror) { 16 | "use strict"; 17 | 18 | CodeMirror.registerHelper("lint", "json", function(text) { 19 | var found = []; 20 | if (!window.jsonlint) { 21 | if (window.console) { 22 | window.console.error("Error: window.jsonlint not defined, CodeMirror JSON linting cannot run."); 23 | } 24 | return found; 25 | } 26 | // for jsonlint's web dist jsonlint is exported as an object with a single property parser, of which parseError 27 | // is a subproperty 28 | var jsonlint = window.jsonlint.parser || window.jsonlint 29 | jsonlint.parseError = function(str, hash) { 30 | var loc = hash.loc; 31 | found.push({from: CodeMirror.Pos(loc.first_line - 1, loc.first_column), 32 | to: CodeMirror.Pos(loc.last_line - 1, loc.last_column), 33 | message: str}); 34 | }; 35 | try { jsonlint.parse(text); } 36 | catch(e) {} 37 | return found; 38 | }); 39 | 40 | }); 41 | -------------------------------------------------------------------------------- /web-control/server/src/modules/default/main.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * @Author: kun 3 | * 2019-10-25 4 | */ 5 | require("module-alias/register"); 6 | import * as koaLogger from "koa-logger"; 7 | import { createApplication } from "../../common/souljs/lib/index"; 8 | import { NODE_ENV } from "../../utils/enums"; 9 | import getLogger from "../../utils/log4js"; 10 | import errorHandle from "../../middleware/error-handle"; 11 | import { WebSocketManager } from "../../service/WebSocketManager"; 12 | import { DeviceManager } from "../../service/DeviceManager"; 13 | import { AdminSocketManager } from "../../service/AdminSocketManager"; 14 | import { SchedulerManager } from "../../service/SchedulerManager"; 15 | import config from "./config"; 16 | import * as router from "./router"; 17 | 18 | const logger = getLogger("main.ts"); 19 | 20 | async function main() { 21 | const app = await createApplication( 22 | __dirname, 23 | Object.keys(router).map((k) => router[k]), 24 | { 25 | logger: getLogger("app"), 26 | } 27 | ); 28 | 29 | if (config.env === NODE_ENV.dev) { 30 | // @ts-ignore 31 | app.use(koaLogger()); 32 | } 33 | 34 | app.use(errorHandle()); 35 | 36 | app.listen(config.port); 37 | 38 | WebSocketManager.init(app.getHttpServer()); 39 | DeviceManager.init(); 40 | AdminSocketManager.init(); 41 | await SchedulerManager.init(); 42 | } 43 | 44 | process.on("rejectionHandled", logger.error.bind(logger)); 45 | process.on("uncaughtException", logger.error.bind(logger)); 46 | process.on("warning", logger.warn.bind(logger)); 47 | 48 | main(); 49 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/bespin.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: Bespin 4 | Author: Mozilla / Jan T. Sott 5 | 6 | CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) 7 | Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) 8 | 9 | */ 10 | 11 | .cm-s-bespin.CodeMirror {background: #28211c; color: #9d9b97;} 12 | .cm-s-bespin div.CodeMirror-selected {background: #36312e !important;} 13 | .cm-s-bespin .CodeMirror-gutters {background: #28211c; border-right: 0px;} 14 | .cm-s-bespin .CodeMirror-linenumber {color: #666666;} 15 | .cm-s-bespin .CodeMirror-cursor {border-left: 1px solid #797977 !important;} 16 | 17 | .cm-s-bespin span.cm-comment {color: #937121;} 18 | .cm-s-bespin span.cm-atom {color: #9b859d;} 19 | .cm-s-bespin span.cm-number {color: #9b859d;} 20 | 21 | .cm-s-bespin span.cm-property, .cm-s-bespin span.cm-attribute {color: #54be0d;} 22 | .cm-s-bespin span.cm-keyword {color: #cf6a4c;} 23 | .cm-s-bespin span.cm-string {color: #f9ee98;} 24 | 25 | .cm-s-bespin span.cm-variable {color: #54be0d;} 26 | .cm-s-bespin span.cm-variable-2 {color: #5ea6ea;} 27 | .cm-s-bespin span.cm-def {color: #cf7d34;} 28 | .cm-s-bespin span.cm-error {background: #cf6a4c; color: #797977;} 29 | .cm-s-bespin span.cm-bracket {color: #9d9b97;} 30 | .cm-s-bespin span.cm-tag {color: #cf6a4c;} 31 | .cm-s-bespin span.cm-link {color: #9b859d;} 32 | 33 | .cm-s-bespin .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} 34 | .cm-s-bespin .CodeMirror-activeline-background { background: #404040; } 35 | -------------------------------------------------------------------------------- /autox-ts/types/autox/modules/coordinate.d.ts: -------------------------------------------------------------------------------- 1 | /* 基于坐标的触摸模拟 */ 2 | 3 | /** 4 | * 设置脚本坐标点击所适合的屏幕宽高。如果脚本运行时,屏幕宽度不一致会自动放缩坐标。 5 | */ 6 | declare function setScreenMetrics(width: number, height: number): void; 7 | 8 | /* 安卓7.0以上的触摸和手势模拟 */ 9 | 10 | /** 11 | * Android7.0以上 12 | * 13 | * 模拟点击坐标(x, y)大约150毫秒,并返回是否点击成功。只有在点击执行完成后脚本才继续执行。 14 | */ 15 | declare function click(x: number, y: number): void; 16 | 17 | /** 18 | * Android7.0以上 19 | * 20 | * 模拟长按坐标(x, y), 并返回是否成功。只有在长按执行完成(大约600毫秒)时脚本才会继续执行。 21 | */ 22 | declare function longClick(x: number, y: number): void; 23 | 24 | /** 25 | * Android7.0以上 26 | * 27 | * 模拟按住坐标(x, y), 并返回是否成功。只有按住操作执行完成时脚本才会继续执行。 28 | * 29 | * 如果按住时间过短,那么会被系统认为是点击;如果时长超过500毫秒,则认为是长按。 30 | */ 31 | declare function press(x: number, y: number, duration: number): void; 32 | 33 | /** 34 | * 模拟从坐标(x1, y1)滑动到坐标(x2, y2),并返回是否成功。只有滑动操作执行完成时脚本才会继续执行。 35 | */ 36 | declare function swipe(x1: number, y1: number, x2: number, y2: number, duration: number): boolean; 37 | 38 | type GesturePoint = [number, number]; 39 | /** 40 | * 模拟手势操作。例如gesture(1000, [0, 0], [500, 500], [500, 1000])为模拟一个从(0, 0)到(500, 500)到(500, 100)的手势操作,时长为2秒。 41 | */ 42 | declare function gesture(duration: number, point1: GesturePoint, point2: GesturePoint, ...points: GesturePoint[]): void; 43 | 44 | type Gesture = [number, number, GesturePoint, GesturePoint] | [number, GesturePoint, GesturePoint]; 45 | /** 46 | * 同时模拟多个手势。每个手势的参数为[delay, duration, 坐标], delay为延迟多久(毫秒)才执行该手势;duration为手势执行时长;坐标为手势经过的点的坐标。其中delay参数可以省略,默认为0。 47 | */ 48 | declare function gestures(gesture: Gesture, ...gestures: Gesture[]): void; 49 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/demo/resize.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Autoresize Demo 4 | 5 | 6 | 7 | 8 | 9 | 10 | 16 | 28 | 29 |
30 |

Autoresize Demo

31 |
37 | 38 |

By setting an editor's height style 39 | to auto and giving 40 | the viewportMargin 41 | a value of Infinity, CodeMirror can be made to 42 | automatically resize to fit its content.

43 | 44 | 50 | 51 |
52 | -------------------------------------------------------------------------------- /web-control/server/src/middleware/app-session.ts: -------------------------------------------------------------------------------- 1 | import * as Koa from "koa"; 2 | import * as session from "koa-session"; 3 | 4 | import { redis } from "../utils/redis"; 5 | 6 | const store: session.stores = { 7 | /** 8 | * get session object by key 9 | */ 10 | async get(key: string) { 11 | const sess = await redis.get(key); 12 | return JSON.parse(sess); 13 | }, 14 | 15 | /** 16 | * set session object for key, with a maxAge (in ms) 17 | */ 18 | async set(key: string, sess: any, maxAge: number) { 19 | await redis.set(key, JSON.stringify(sess), "PX", maxAge); 20 | }, 21 | 22 | /** 23 | * destroy session for key 24 | */ 25 | async destroy(key: string) { 26 | await redis.del(key); 27 | }, 28 | }; 29 | 30 | const CONFIG = { 31 | key: "j:sess" /** (string) cookie key (default is koa:sess) */, 32 | /** (number || 'session') maxAge in ms (default is 1 days) */ 33 | /** 'session' will result in a cookie that expires when session/browser is closed */ 34 | /** Warning: If a session cookie is stolen, this cookie will never expire */ 35 | maxAge: 1000 * 60 * 60 * 2, 36 | autoCommit: true /** (boolean) automatically commit headers (default true) */, 37 | overwrite: true /** (boolean) can overwrite or not (default true) */, 38 | httpOnly: true /** (boolean) httpOnly or not (default true) */, 39 | signed: true /** (boolean) signed or not (default true) */, 40 | rolling: false, 41 | renew: false, 42 | store, 43 | }; 44 | 45 | export default (koaInstance: Koa) => { 46 | koaInstance.keys = [CONFIG.key]; 47 | return session(CONFIG, koaInstance); 48 | }; 49 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/demo/matchtags.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Tag Matcher Demo 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 27 | 28 |
29 |

Tag Matcher Demo

30 | 31 | 32 |
33 | 34 | 44 | 45 |

Put the cursor on or inside a pair of tags to highlight them. 46 | Press Ctrl-J to jump to the tag that matches the one under the 47 | cursor.

48 |
49 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/isotope.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: Isotope 4 | Author: David Desandro / Jan T. Sott 5 | 6 | CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) 7 | Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) 8 | 9 | */ 10 | 11 | .cm-s-isotope.CodeMirror {background: #000000; color: #e0e0e0;} 12 | .cm-s-isotope div.CodeMirror-selected {background: #404040 !important;} 13 | .cm-s-isotope .CodeMirror-gutters {background: #000000; border-right: 0px;} 14 | .cm-s-isotope .CodeMirror-linenumber {color: #808080;} 15 | .cm-s-isotope .CodeMirror-cursor {border-left: 1px solid #c0c0c0 !important;} 16 | 17 | .cm-s-isotope span.cm-comment {color: #3300ff;} 18 | .cm-s-isotope span.cm-atom {color: #cc00ff;} 19 | .cm-s-isotope span.cm-number {color: #cc00ff;} 20 | 21 | .cm-s-isotope span.cm-property, .cm-s-isotope span.cm-attribute {color: #33ff00;} 22 | .cm-s-isotope span.cm-keyword {color: #ff0000;} 23 | .cm-s-isotope span.cm-string {color: #ff0099;} 24 | 25 | .cm-s-isotope span.cm-variable {color: #33ff00;} 26 | .cm-s-isotope span.cm-variable-2 {color: #0066ff;} 27 | .cm-s-isotope span.cm-def {color: #ff9900;} 28 | .cm-s-isotope span.cm-error {background: #ff0000; color: #c0c0c0;} 29 | .cm-s-isotope span.cm-bracket {color: #e0e0e0;} 30 | .cm-s-isotope span.cm-tag {color: #ff0000;} 31 | .cm-s-isotope span.cm-link {color: #cc00ff;} 32 | 33 | .cm-s-isotope .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} 34 | .cm-s-isotope .CodeMirror-activeline-background { background: #202020; } 35 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/mode/http/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: HTTP mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 24 | 25 |
26 |

HTTP mode

27 | 28 | 29 |
39 | 40 | 43 | 44 |

MIME types defined: message/http.

45 |
46 | -------------------------------------------------------------------------------- /web-control/web/src/components/SvgIcon/index.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 47 | 48 | 63 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/demo/rulers.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Ruler Demo 4 | 5 | 6 | 7 | 8 | 9 | 10 | 13 | 25 | 26 |
27 |

Ruler Demo

28 | 29 | 44 | 45 |

Demonstration of 46 | the rulers addon, which 47 | displays vertical lines at given column offsets.

48 | 49 |
50 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/hopscotch.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: Hopscotch 4 | Author: Jan T. Sott 5 | 6 | CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) 7 | Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) 8 | 9 | */ 10 | 11 | .cm-s-hopscotch.CodeMirror {background: #322931; color: #d5d3d5;} 12 | .cm-s-hopscotch div.CodeMirror-selected {background: #433b42 !important;} 13 | .cm-s-hopscotch .CodeMirror-gutters {background: #322931; border-right: 0px;} 14 | .cm-s-hopscotch .CodeMirror-linenumber {color: #797379;} 15 | .cm-s-hopscotch .CodeMirror-cursor {border-left: 1px solid #989498 !important;} 16 | 17 | .cm-s-hopscotch span.cm-comment {color: #b33508;} 18 | .cm-s-hopscotch span.cm-atom {color: #c85e7c;} 19 | .cm-s-hopscotch span.cm-number {color: #c85e7c;} 20 | 21 | .cm-s-hopscotch span.cm-property, .cm-s-hopscotch span.cm-attribute {color: #8fc13e;} 22 | .cm-s-hopscotch span.cm-keyword {color: #dd464c;} 23 | .cm-s-hopscotch span.cm-string {color: #fdcc59;} 24 | 25 | .cm-s-hopscotch span.cm-variable {color: #8fc13e;} 26 | .cm-s-hopscotch span.cm-variable-2 {color: #1290bf;} 27 | .cm-s-hopscotch span.cm-def {color: #fd8b19;} 28 | .cm-s-hopscotch span.cm-error {background: #dd464c; color: #989498;} 29 | .cm-s-hopscotch span.cm-bracket {color: #d5d3d5;} 30 | .cm-s-hopscotch span.cm-tag {color: #dd464c;} 31 | .cm-s-hopscotch span.cm-link {color: #c85e7c;} 32 | 33 | .cm-s-hopscotch .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} 34 | .cm-s-hopscotch .CodeMirror-activeline-background { background: #302020; } 35 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/railscasts.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: Railscasts 4 | Author: Ryan Bates (http://railscasts.com) 5 | 6 | CodeMirror template by Jan T. Sott (https://github.com/idleberg/base16-codemirror) 7 | Original Base16 color scheme by Chris Kempson (https://github.com/chriskempson/base16) 8 | 9 | */ 10 | 11 | .cm-s-railscasts.CodeMirror {background: #2b2b2b; color: #f4f1ed;} 12 | .cm-s-railscasts div.CodeMirror-selected {background: #272935 !important;} 13 | .cm-s-railscasts .CodeMirror-gutters {background: #2b2b2b; border-right: 0px;} 14 | .cm-s-railscasts .CodeMirror-linenumber {color: #5a647e;} 15 | .cm-s-railscasts .CodeMirror-cursor {border-left: 1px solid #d4cfc9 !important;} 16 | 17 | .cm-s-railscasts span.cm-comment {color: #bc9458;} 18 | .cm-s-railscasts span.cm-atom {color: #b6b3eb;} 19 | .cm-s-railscasts span.cm-number {color: #b6b3eb;} 20 | 21 | .cm-s-railscasts span.cm-property, .cm-s-railscasts span.cm-attribute {color: #a5c261;} 22 | .cm-s-railscasts span.cm-keyword {color: #da4939;} 23 | .cm-s-railscasts span.cm-string {color: #ffc66d;} 24 | 25 | .cm-s-railscasts span.cm-variable {color: #a5c261;} 26 | .cm-s-railscasts span.cm-variable-2 {color: #6d9cbe;} 27 | .cm-s-railscasts span.cm-def {color: #cc7833;} 28 | .cm-s-railscasts span.cm-error {background: #da4939; color: #d4cfc9;} 29 | .cm-s-railscasts span.cm-bracket {color: #f4f1ed;} 30 | .cm-s-railscasts span.cm-tag {color: #da4939;} 31 | .cm-s-railscasts span.cm-link {color: #b6b3eb;} 32 | 33 | .cm-s-railscasts .CodeMirror-matchingbracket { text-decoration: underline; color: white !important;} 34 | .cm-s-railscasts .CodeMirror-activeline-background { background: #303040; } 35 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/scroll/simplescrollbars.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-simplescroll-horizontal div, .CodeMirror-simplescroll-vertical div { 2 | position: absolute; 3 | background: #ccc; 4 | -moz-box-sizing: border-box; 5 | box-sizing: border-box; 6 | border: 1px solid #bbb; 7 | border-radius: 2px; 8 | } 9 | 10 | .CodeMirror-simplescroll-horizontal, .CodeMirror-simplescroll-vertical { 11 | position: absolute; 12 | z-index: 6; 13 | background: #eee; 14 | } 15 | 16 | .CodeMirror-simplescroll-horizontal { 17 | bottom: 0; left: 0; 18 | height: 8px; 19 | } 20 | .CodeMirror-simplescroll-horizontal div { 21 | bottom: 0; 22 | height: 100%; 23 | } 24 | 25 | .CodeMirror-simplescroll-vertical { 26 | right: 0; top: 0; 27 | width: 8px; 28 | } 29 | .CodeMirror-simplescroll-vertical div { 30 | right: 0; 31 | width: 100%; 32 | } 33 | 34 | 35 | .CodeMirror-overlayscroll .CodeMirror-scrollbar-filler, .CodeMirror-overlayscroll .CodeMirror-gutter-filler { 36 | display: none; 37 | } 38 | 39 | .CodeMirror-overlayscroll-horizontal div, .CodeMirror-overlayscroll-vertical div { 40 | position: absolute; 41 | background: #bcd; 42 | border-radius: 3px; 43 | } 44 | 45 | .CodeMirror-overlayscroll-horizontal, .CodeMirror-overlayscroll-vertical { 46 | position: absolute; 47 | z-index: 6; 48 | } 49 | 50 | .CodeMirror-overlayscroll-horizontal { 51 | bottom: 0; left: 0; 52 | height: 6px; 53 | } 54 | .CodeMirror-overlayscroll-horizontal div { 55 | bottom: 0; 56 | height: 100%; 57 | } 58 | 59 | .CodeMirror-overlayscroll-vertical { 60 | right: 0; top: 0; 61 | width: 6px; 62 | } 63 | .CodeMirror-overlayscroll-vertical div { 64 | right: 0; 65 | width: 100%; 66 | } 67 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/display/fullscreen.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineOption("fullScreen", false, function(cm, val, old) { 15 | if (old == CodeMirror.Init) old = false; 16 | if (!old == !val) return; 17 | if (val) setFullscreen(cm); 18 | else setNormal(cm); 19 | }); 20 | 21 | function setFullscreen(cm) { 22 | var wrap = cm.getWrapperElement(); 23 | cm.state.fullScreenRestore = {scrollTop: window.pageYOffset, scrollLeft: window.pageXOffset, 24 | width: wrap.style.width, height: wrap.style.height}; 25 | wrap.style.width = ""; 26 | wrap.style.height = "auto"; 27 | wrap.className += " CodeMirror-fullscreen"; 28 | document.documentElement.style.overflow = "hidden"; 29 | cm.refresh(); 30 | } 31 | 32 | function setNormal(cm) { 33 | var wrap = cm.getWrapperElement(); 34 | wrap.className = wrap.className.replace(/\s*CodeMirror-fullscreen\b/, ""); 35 | document.documentElement.style.overflow = ""; 36 | var info = cm.state.fullScreenRestore; 37 | wrap.style.width = info.width; wrap.style.height = info.height; 38 | window.scrollTo(info.scrollLeft, info.scrollTop); 39 | cm.refresh(); 40 | } 41 | }); 42 | -------------------------------------------------------------------------------- /web-control/web/src/layout/components/Sidebar/index.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 57 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/lint/coffeescript-lint.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | // Depends on coffeelint.js from http://www.coffeelint.org/js/coffeelint.js 5 | 6 | // declare global: coffeelint 7 | 8 | (function(mod) { 9 | if (typeof exports == "object" && typeof module == "object") // CommonJS 10 | mod(require("../../lib/codemirror")); 11 | else if (typeof define == "function" && define.amd) // AMD 12 | define(["../../lib/codemirror"], mod); 13 | else // Plain browser env 14 | mod(CodeMirror); 15 | })(function(CodeMirror) { 16 | "use strict"; 17 | 18 | CodeMirror.registerHelper("lint", "coffeescript", function(text) { 19 | var found = []; 20 | if (!window.coffeelint) { 21 | if (window.console) { 22 | window.console.error("Error: window.coffeelint not defined, CodeMirror CoffeeScript linting cannot run."); 23 | } 24 | return found; 25 | } 26 | var parseError = function(err) { 27 | var loc = err.lineNumber; 28 | found.push({from: CodeMirror.Pos(loc-1, 0), 29 | to: CodeMirror.Pos(loc, 0), 30 | severity: err.level, 31 | message: err.message}); 32 | }; 33 | try { 34 | var res = coffeelint.lint(text); 35 | for(var i = 0; i < res.length; i++) { 36 | parseError(res[i]); 37 | } 38 | } catch(e) { 39 | found.push({from: CodeMirror.Pos(e.location.first_line, 0), 40 | to: CodeMirror.Pos(e.location.last_line, e.location.last_column), 41 | severity: 'error', 42 | message: e.message}); 43 | } 44 | return found; 45 | }); 46 | 47 | }); 48 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/demo/placeholder.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Placeholder demo 4 | 5 | 6 | 7 | 8 | 9 | 10 | 16 | 28 | 29 |
30 |

Placeholder demo

31 |
32 | 33 |

The placeholder 34 | plug-in adds an option placeholder that can be set to 35 | make text appear in the editor when it is empty and not focused. 36 | If the source textarea has a placeholder attribute, 37 | it will automatically be inherited.

38 | 39 | 44 | 45 |
46 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/demo/marker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Breakpoint Demo 4 | 5 | 6 | 7 | 8 | 9 | 10 | 15 | 27 | 28 |
29 |

Breakpoint Demo

30 |
47 | 48 |

Click the line-number gutter to add or remove 'breakpoints'.

49 | 50 | 51 | 52 |
53 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/display/autorefresh.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")) 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod) 9 | else // Plain browser env 10 | mod(CodeMirror) 11 | })(function(CodeMirror) { 12 | "use strict" 13 | 14 | CodeMirror.defineOption("autoRefresh", false, function(cm, val) { 15 | if (cm.state.autoRefresh) { 16 | stopListening(cm, cm.state.autoRefresh) 17 | cm.state.autoRefresh = null 18 | } 19 | if (val && cm.display.wrapper.offsetHeight == 0) 20 | startListening(cm, cm.state.autoRefresh = {delay: val.delay || 250}) 21 | }) 22 | 23 | function startListening(cm, state) { 24 | function check() { 25 | if (cm.display.wrapper.offsetHeight) { 26 | stopListening(cm, state) 27 | if (cm.display.lastWrapHeight != cm.display.wrapper.clientHeight) 28 | cm.refresh() 29 | } else { 30 | state.timeout = setTimeout(check, state.delay) 31 | } 32 | } 33 | state.timeout = setTimeout(check, state.delay) 34 | state.hurry = function() { 35 | clearTimeout(state.timeout) 36 | state.timeout = setTimeout(check, 50) 37 | } 38 | CodeMirror.on(window, "mouseup", state.hurry) 39 | CodeMirror.on(window, "keyup", state.hurry) 40 | } 41 | 42 | function stopListening(_cm, state) { 43 | clearTimeout(state.timeout) 44 | CodeMirror.off(window, "mouseup", state.hurry) 45 | CodeMirror.off(window, "keyup", state.hurry) 46 | } 47 | }); 48 | -------------------------------------------------------------------------------- /web-control/web/src/icons/svg/tree.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/demo/trailingspace.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Trailing Whitespace Demo 4 | 5 | 6 | 7 | 8 | 9 | 10 | 18 | 30 | 31 |
32 |

Trailing Whitespace Demo

33 |
36 | 37 | 43 | 44 |

Uses 45 | the trailingspace 46 | addon to highlight trailing whitespace.

47 | 48 |
49 | -------------------------------------------------------------------------------- /autox-ts/types/autox/modules/http.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | 3 | declare namespace http { 4 | interface HttpRequestOptions { 5 | header: { [key: string]: string }, 6 | method: 'GET' | 'POST' | 'PUT' | 'DELET' | 'PATCH'; 7 | contentType: string; 8 | body: string | string[] | files.byte[] 9 | } 10 | interface Request { 11 | 12 | } 13 | interface Response { 14 | statusCode: number; 15 | statusMessage: string; 16 | headers: { [key: string]: string }; 17 | body: ResponseBody; 18 | request: Request; 19 | url: string; 20 | method: 'GET' | 'POST' | 'PUT' | 'DELET' | 'PATCH'; 21 | } 22 | interface ResponseBody { 23 | bytes(): files.byte[]; 24 | string(): string; 25 | json(): object; 26 | contentType: string; 27 | } 28 | function get(url: string, options?: HttpRequestOptions, callback?: (resp: Response) => void): Response; 29 | function post(url: string, data: object, options?: HttpRequestOptions, callback?: (resp: Response) => void): Response; 30 | function postJson(url: string, data?: object, options?: HttpRequestOptions, callback?: (resp: Response) => void): Response; 31 | 32 | interface RequestMultipartBody { 33 | file: ReadableTextFile | [string, string] | [string, string, string]; 34 | } 35 | function postMultipart(url: string, files: RequestMultipartBody, options?: HttpRequestOptions, callback?: (resp: Response) => void): void; 36 | function postMultipart(url: string, files: { [key: string]: string } & RequestMultipartBody, options?: HttpRequestOptions, callback?: (resp: Response) => void): void; 37 | 38 | function request(url: string, options?: HttpRequestOptions, callback?: (resp: Response) => void): void; 39 | 40 | } 41 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/scroll/scrollpastend.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.defineOption("scrollPastEnd", false, function(cm, val, old) { 15 | if (old && old != CodeMirror.Init) { 16 | cm.off("change", onChange); 17 | cm.off("refresh", updateBottomMargin); 18 | cm.display.lineSpace.parentNode.style.paddingBottom = ""; 19 | cm.state.scrollPastEndPadding = null; 20 | } 21 | if (val) { 22 | cm.on("change", onChange); 23 | cm.on("refresh", updateBottomMargin); 24 | updateBottomMargin(cm); 25 | } 26 | }); 27 | 28 | function onChange(cm, change) { 29 | if (CodeMirror.changeEnd(change).line == cm.lastLine()) 30 | updateBottomMargin(cm); 31 | } 32 | 33 | function updateBottomMargin(cm) { 34 | var padding = ""; 35 | if (cm.lineCount() > 1) { 36 | var totalH = cm.display.scroller.clientHeight - 30, 37 | lastLineH = cm.getLineHandle(cm.lastLine()).height; 38 | padding = (totalH - lastLineH) + "px"; 39 | } 40 | if (cm.state.scrollPastEndPadding != padding) { 41 | cm.state.scrollPastEndPadding = padding; 42 | cm.display.lineSpace.parentNode.style.paddingBottom = padding; 43 | cm.off("refresh", updateBottomMargin); 44 | cm.setSize(); 45 | cm.on("refresh", updateBottomMargin); 46 | } 47 | } 48 | }); 49 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/colorforth.css: -------------------------------------------------------------------------------- 1 | .cm-s-colorforth.CodeMirror { background: #000000; color: #f8f8f8; } 2 | .cm-s-colorforth .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } 3 | .cm-s-colorforth .CodeMirror-guttermarker { color: #FFBD40; } 4 | .cm-s-colorforth .CodeMirror-guttermarker-subtle { color: #78846f; } 5 | .cm-s-colorforth .CodeMirror-linenumber { color: #bababa; } 6 | .cm-s-colorforth .CodeMirror-cursor { border-left: 1px solid white; } 7 | 8 | .cm-s-colorforth span.cm-comment { color: #ededed; } 9 | .cm-s-colorforth span.cm-def { color: #ff1c1c; font-weight:bold; } 10 | .cm-s-colorforth span.cm-keyword { color: #ffd900; } 11 | .cm-s-colorforth span.cm-builtin { color: #00d95a; } 12 | .cm-s-colorforth span.cm-variable { color: #73ff00; } 13 | .cm-s-colorforth span.cm-string { color: #007bff; } 14 | .cm-s-colorforth span.cm-number { color: #00c4ff; } 15 | .cm-s-colorforth span.cm-atom { color: #606060; } 16 | 17 | .cm-s-colorforth span.cm-variable-2 { color: #EEE; } 18 | .cm-s-colorforth span.cm-variable-3, .cm-s-colorforth span.cm-type { color: #DDD; } 19 | .cm-s-colorforth span.cm-property {} 20 | .cm-s-colorforth span.cm-operator {} 21 | 22 | .cm-s-colorforth span.cm-meta { color: yellow; } 23 | .cm-s-colorforth span.cm-qualifier { color: #FFF700; } 24 | .cm-s-colorforth span.cm-bracket { color: #cc7; } 25 | .cm-s-colorforth span.cm-tag { color: #FFBD40; } 26 | .cm-s-colorforth span.cm-attribute { color: #FFF700; } 27 | .cm-s-colorforth span.cm-error { color: #f00; } 28 | 29 | .cm-s-colorforth div.CodeMirror-selected { background: #333d53; } 30 | 31 | .cm-s-colorforth span.cm-compilation { background: rgba(255, 255, 255, 0.12); } 32 | 33 | .cm-s-colorforth .CodeMirror-activeline-background { background: #253540; } 34 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/cobalt.css: -------------------------------------------------------------------------------- 1 | .cm-s-cobalt.CodeMirror { background: #002240; color: white; } 2 | .cm-s-cobalt div.CodeMirror-selected { background: #b36539; } 3 | .cm-s-cobalt .CodeMirror-line::selection, .cm-s-cobalt .CodeMirror-line > span::selection, .cm-s-cobalt .CodeMirror-line > span > span::selection { background: rgba(179, 101, 57, .99); } 4 | .cm-s-cobalt .CodeMirror-line::-moz-selection, .cm-s-cobalt .CodeMirror-line > span::-moz-selection, .cm-s-cobalt .CodeMirror-line > span > span::-moz-selection { background: rgba(179, 101, 57, .99); } 5 | .cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } 6 | .cm-s-cobalt .CodeMirror-guttermarker { color: #ffee80; } 7 | .cm-s-cobalt .CodeMirror-guttermarker-subtle { color: #d0d0d0; } 8 | .cm-s-cobalt .CodeMirror-linenumber { color: #d0d0d0; } 9 | .cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white; } 10 | 11 | .cm-s-cobalt span.cm-comment { color: #08f; } 12 | .cm-s-cobalt span.cm-atom { color: #845dc4; } 13 | .cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; } 14 | .cm-s-cobalt span.cm-keyword { color: #ffee80; } 15 | .cm-s-cobalt span.cm-string { color: #3ad900; } 16 | .cm-s-cobalt span.cm-meta { color: #ff9d00; } 17 | .cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; } 18 | .cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def, .cm-s-cobalt .cm-type { color: white; } 19 | .cm-s-cobalt span.cm-bracket { color: #d8d8d8; } 20 | .cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; } 21 | .cm-s-cobalt span.cm-link { color: #845dc4; } 22 | .cm-s-cobalt span.cm-error { color: #9d1e15; } 23 | 24 | .cm-s-cobalt .CodeMirror-activeline-background { background: #002D57; } 25 | .cm-s-cobalt .CodeMirror-matchingbracket { outline:1px solid grey;color:white !important; } 26 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/fold/markdown-fold.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | CodeMirror.registerHelper("fold", "markdown", function(cm, start) { 15 | var maxDepth = 100; 16 | 17 | function isHeader(lineNo) { 18 | var tokentype = cm.getTokenTypeAt(CodeMirror.Pos(lineNo, 0)); 19 | return tokentype && /\bheader\b/.test(tokentype); 20 | } 21 | 22 | function headerLevel(lineNo, line, nextLine) { 23 | var match = line && line.match(/^#+/); 24 | if (match && isHeader(lineNo)) return match[0].length; 25 | match = nextLine && nextLine.match(/^[=\-]+\s*$/); 26 | if (match && isHeader(lineNo + 1)) return nextLine[0] == "=" ? 1 : 2; 27 | return maxDepth; 28 | } 29 | 30 | var firstLine = cm.getLine(start.line), nextLine = cm.getLine(start.line + 1); 31 | var level = headerLevel(start.line, firstLine, nextLine); 32 | if (level === maxDepth) return undefined; 33 | 34 | var lastLineNo = cm.lastLine(); 35 | var end = start.line, nextNextLine = cm.getLine(end + 2); 36 | while (end < lastLineNo) { 37 | if (headerLevel(end + 1, nextLine, nextNextLine) <= level) break; 38 | ++end; 39 | nextLine = nextNextLine; 40 | nextNextLine = cm.getLine(end + 2); 41 | } 42 | 43 | return { 44 | from: CodeMirror.Pos(start.line, firstLine.length), 45 | to: CodeMirror.Pos(end, cm.getLine(end).length) 46 | }; 47 | }); 48 | 49 | }); 50 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/idea.css: -------------------------------------------------------------------------------- 1 | /** 2 | Name: IDEA default theme 3 | From IntelliJ IDEA by JetBrains 4 | */ 5 | 6 | .cm-s-idea span.cm-meta { color: #808000; } 7 | .cm-s-idea span.cm-number { color: #0000FF; } 8 | .cm-s-idea span.cm-keyword { line-height: 1em; font-weight: bold; color: #000080; } 9 | .cm-s-idea span.cm-atom { font-weight: bold; color: #000080; } 10 | .cm-s-idea span.cm-def { color: #000000; } 11 | .cm-s-idea span.cm-variable { color: black; } 12 | .cm-s-idea span.cm-variable-2 { color: black; } 13 | .cm-s-idea span.cm-variable-3, .cm-s-idea span.cm-type { color: black; } 14 | .cm-s-idea span.cm-property { color: black; } 15 | .cm-s-idea span.cm-operator { color: black; } 16 | .cm-s-idea span.cm-comment { color: #808080; } 17 | .cm-s-idea span.cm-string { color: #008000; } 18 | .cm-s-idea span.cm-string-2 { color: #008000; } 19 | .cm-s-idea span.cm-qualifier { color: #555; } 20 | .cm-s-idea span.cm-error { color: #FF0000; } 21 | .cm-s-idea span.cm-attribute { color: #0000FF; } 22 | .cm-s-idea span.cm-tag { color: #000080; } 23 | .cm-s-idea span.cm-link { color: #0000FF; } 24 | .cm-s-idea .CodeMirror-activeline-background { background: #FFFAE3; } 25 | 26 | .cm-s-idea span.cm-builtin { color: #30a; } 27 | .cm-s-idea span.cm-bracket { color: #cc7; } 28 | .cm-s-idea { font-family: Consolas, Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace, serif;} 29 | 30 | 31 | .cm-s-idea .CodeMirror-matchingbracket { outline:1px solid grey; color:black !important; } 32 | 33 | .CodeMirror-hints.idea { 34 | font-family: Menlo, Monaco, Consolas, 'Courier New', monospace; 35 | color: #616569; 36 | background-color: #ebf3fd !important; 37 | } 38 | 39 | .CodeMirror-hints.idea .CodeMirror-hint-active { 40 | background-color: #a2b8c9 !important; 41 | color: #5c6065 !important; 42 | } -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/night.css: -------------------------------------------------------------------------------- 1 | /* Loosely based on the Midnight Textmate theme */ 2 | 3 | .cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; } 4 | .cm-s-night div.CodeMirror-selected { background: #447; } 5 | .cm-s-night .CodeMirror-line::selection, .cm-s-night .CodeMirror-line > span::selection, .cm-s-night .CodeMirror-line > span > span::selection { background: rgba(68, 68, 119, .99); } 6 | .cm-s-night .CodeMirror-line::-moz-selection, .cm-s-night .CodeMirror-line > span::-moz-selection, .cm-s-night .CodeMirror-line > span > span::-moz-selection { background: rgba(68, 68, 119, .99); } 7 | .cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } 8 | .cm-s-night .CodeMirror-guttermarker { color: white; } 9 | .cm-s-night .CodeMirror-guttermarker-subtle { color: #bbb; } 10 | .cm-s-night .CodeMirror-linenumber { color: #f8f8f8; } 11 | .cm-s-night .CodeMirror-cursor { border-left: 1px solid white; } 12 | 13 | .cm-s-night span.cm-comment { color: #8900d1; } 14 | .cm-s-night span.cm-atom { color: #845dc4; } 15 | .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; } 16 | .cm-s-night span.cm-keyword { color: #599eff; } 17 | .cm-s-night span.cm-string { color: #37f14a; } 18 | .cm-s-night span.cm-meta { color: #7678e2; } 19 | .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; } 20 | .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def, .cm-s-night span.cm-type { color: white; } 21 | .cm-s-night span.cm-bracket { color: #8da6ce; } 22 | .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; } 23 | .cm-s-night span.cm-link { color: #845dc4; } 24 | .cm-s-night span.cm-error { color: #9d1e15; } 25 | 26 | .cm-s-night .CodeMirror-activeline-background { background: #1C005A; } 27 | .cm-s-night .CodeMirror-matchingbracket { outline:1px solid grey; color:white !important; } 28 | -------------------------------------------------------------------------------- /web-control/web/mock/user.js: -------------------------------------------------------------------------------- 1 | 2 | const tokens = { 3 | admin: { 4 | token: 'admin-token' 5 | }, 6 | editor: { 7 | token: 'editor-token' 8 | } 9 | } 10 | 11 | const users = { 12 | 'admin-token': { 13 | roles: ['admin'], 14 | introduction: 'I am a super administrator', 15 | avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif', 16 | name: 'Super Admin' 17 | }, 18 | 'editor-token': { 19 | roles: ['editor'], 20 | introduction: 'I am an editor', 21 | avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif', 22 | name: 'Normal Editor' 23 | } 24 | } 25 | 26 | export default [ 27 | // user login 28 | { 29 | url: '/user/login', 30 | type: 'post', 31 | response: config => { 32 | const { username } = config.body 33 | const token = tokens[username] 34 | 35 | // mock error 36 | if (!token) { 37 | return { 38 | code: 60204, 39 | message: 'Account and password are incorrect.' 40 | } 41 | } 42 | 43 | return { 44 | code: 20000, 45 | data: token 46 | } 47 | } 48 | }, 49 | 50 | // get user info 51 | { 52 | url: '/user/info\.*', 53 | type: 'get', 54 | response: config => { 55 | const { token } = config.query 56 | const info = users[token] 57 | 58 | // mock error 59 | if (!info) { 60 | return { 61 | code: 50008, 62 | message: 'Login failed, unable to get user details.' 63 | } 64 | } 65 | 66 | return { 67 | code: 20000, 68 | data: info 69 | } 70 | } 71 | }, 72 | 73 | // user logout 74 | { 75 | url: '/user/logout', 76 | type: 'post', 77 | response: _ => { 78 | return { 79 | code: 20000, 80 | data: 'success' 81 | } 82 | } 83 | } 84 | ] 85 | -------------------------------------------------------------------------------- /web-control/server/src/utils/lock.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Lock Tool 3 | * kun 4 | * 2019-10-25 5 | */ 6 | 7 | const LOCKS: { 8 | [type: string]: { 9 | curLock: Lock; 10 | lockAt: number; 11 | queue: PromiseWrap[]; 12 | }; 13 | } = {}; 14 | 15 | export function getLock(type: string) { 16 | const pw = new PromiseWrap(); 17 | if (!LOCKS[type]) { 18 | LOCKS[type] = { curLock: null, lockAt: null, queue: [] }; 19 | } 20 | LOCKS[type].queue.push(pw); 21 | process.nextTick(() => { 22 | loop(type); 23 | }); 24 | return pw.promise; 25 | } 26 | 27 | function loop(type: string) { 28 | if (!LOCKS[type]) return; 29 | if (LOCKS[type].curLock) { 30 | if (LOCKS[type].lockAt + 12 * 1000 < Date.now()) { 31 | LOCKS[type].curLock.release(); 32 | console.error(`Lock ${type} Timeout Released`); 33 | } 34 | return; 35 | } 36 | 37 | const p = LOCKS[type].queue.shift(); 38 | if (!p) return; 39 | 40 | const lock = new Lock(type); 41 | LOCKS[type].curLock = lock; 42 | LOCKS[type].lockAt = Date.now(); 43 | p.resolve(lock); 44 | } 45 | 46 | function release(type: string) { 47 | LOCKS[type].curLock = null; 48 | LOCKS[type].lockAt = null; 49 | if (LOCKS[type].queue.length === 0) { 50 | delete LOCKS[type]; 51 | return; 52 | } 53 | loop(type); 54 | } 55 | 56 | class PromiseWrap{ 57 | promise: Promise; 58 | resolve: (v?: any) => void; 59 | reject: (v?: any) => void; 60 | constructor() { 61 | this.promise = new Promise((resolve, reject) => { 62 | this.resolve = resolve; 63 | this.reject = reject; 64 | }); 65 | } 66 | } 67 | 68 | class Lock { 69 | type: string; 70 | isReleased: boolean; 71 | constructor(type: string) { 72 | this.type = type; 73 | this.isReleased = false; 74 | } 75 | 76 | release() { 77 | if (this.isReleased) return; 78 | release(this.type); 79 | } 80 | } 81 | -------------------------------------------------------------------------------- /web-control/server/src/service/ScriptExecutor.ts: -------------------------------------------------------------------------------- 1 | import { WebSocketManager } from './WebSocketManager'; 2 | import { DeviceManager } from './DeviceManager'; 3 | 4 | export default class ScriptExecutor { 5 | private static instance: ScriptExecutor; 6 | static getInstance() { 7 | if (!ScriptExecutor.instance) { 8 | ScriptExecutor.instance = new ScriptExecutor(); 9 | } 10 | return ScriptExecutor.instance; 11 | } 12 | 13 | public run(devices: string, fileName: string, script: string) { 14 | console.log("🚀 ~ file: ScriptExecutor.ts:14 ~ ScriptExecutor ~ run ~ fileName:", fileName) 15 | const ol = DeviceManager.getInstance().getOnlineDevices(); 16 | 17 | if (ol.length === 0) { 18 | throw new Error('没有在线设备'); 19 | } 20 | 21 | const data = { 22 | type: 'command', 23 | data: { 24 | command: 'run', 25 | id: fileName, 26 | view_id: fileName, 27 | name: fileName, 28 | script: script, 29 | } 30 | }; 31 | 32 | WebSocketManager.getInstance().getClients().forEach((client) => { 33 | if (client.type === 'device' && (!devices || devices.includes(client.extData.device_id))) { 34 | WebSocketManager.getInstance().sendMessage(client, data); 35 | } 36 | }); 37 | } 38 | 39 | public stopAll(devices: string) { 40 | const ol = DeviceManager.getInstance().getOnlineDevices(); 41 | 42 | if (ol.length === 0) { 43 | throw new Error('没有在线设备'); 44 | } 45 | 46 | const data = { 47 | type: 'command', 48 | data: { 49 | command: 'stopAll' 50 | } 51 | }; 52 | 53 | WebSocketManager.getInstance().getClients().forEach((client) => { 54 | if (client.type === 'device' && (!devices || devices.includes(client.extData.device_id))) { 55 | WebSocketManager.getInstance().sendMessage(client, data); 56 | } 57 | }); 58 | } 59 | } -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/hint/anyword-hint.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | var WORD = /[\w$]+/, RANGE = 500; 15 | 16 | CodeMirror.registerHelper("hint", "anyword", function(editor, options) { 17 | var word = options && options.word || WORD; 18 | var range = options && options.range || RANGE; 19 | var cur = editor.getCursor(), curLine = editor.getLine(cur.line); 20 | var end = cur.ch, start = end; 21 | while (start && word.test(curLine.charAt(start - 1))) --start; 22 | var curWord = start != end && curLine.slice(start, end); 23 | 24 | var list = options && options.list || [], seen = {}; 25 | var re = new RegExp(word.source, "g"); 26 | for (var dir = -1; dir <= 1; dir += 2) { 27 | var line = cur.line, endLine = Math.min(Math.max(line + dir * range, editor.firstLine()), editor.lastLine()) + dir; 28 | for (; line != endLine; line += dir) { 29 | var text = editor.getLine(line), m; 30 | while (m = re.exec(text)) { 31 | if (line == cur.line && m[0] === curWord) continue; 32 | if ((!curWord || m[0].lastIndexOf(curWord, 0) == 0) && !Object.prototype.hasOwnProperty.call(seen, m[0])) { 33 | seen[m[0]] = true; 34 | list.push(m[0]); 35 | } 36 | } 37 | } 38 | } 39 | return {list: list, from: CodeMirror.Pos(cur.line, start), to: CodeMirror.Pos(cur.line, end)}; 40 | }); 41 | }); 42 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/demo/closebrackets.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: Closebrackets Demo 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | 26 | 27 |
28 |

Closebrackets Demo

29 |
48 | 49 | 52 |
53 | -------------------------------------------------------------------------------- /autox-ts/types/autox/modules/ui.d.ts: -------------------------------------------------------------------------------- 1 | // interface View { 2 | // w: 'auto' | '*' | number; 3 | // h: 'auto' | '*' | number; 4 | // id: string; 5 | // gravity: 'left' | 'right' | 'top' | 'bottom' | 'center' | 'center_vertical' | 'center_horizontal' | string; 6 | // layout_gravity: 'left' | 'right' | 'top' | 'bottom' | 'center' | 'center_vertical' | 'center_horizontal' | string; 7 | // margin: number | string; 8 | // marginLeft: number; 9 | // marginRight: number; 10 | // marginTop: number; 11 | // marginBottom: number; 12 | // padding 13 | // paddingLeft: number; 14 | // paddingRight: number; 15 | // paddingTop: number; 16 | // paddingBottom: number; 17 | // bg 18 | // alpha 19 | // foreground 20 | // minHeight 21 | // minWidth 22 | // visbility 23 | // rotation 24 | // transformPivotX 25 | // transformPivotY 26 | // style 27 | // } 28 | 29 | // interface UI { 30 | // [id: string]: View | ((...args: any[]) => any); 31 | // layout(xml: any): void; 32 | // inflate(xml: any, parent?: View): void; 33 | // findView(id: string): View; 34 | // finish() 35 | // setContentView(view: View) 36 | // run(callback) 37 | // post(callback, delay?: number): void; 38 | // statusBarColor(color) 39 | // showPopupMenu(view, menu) 40 | // } 41 | 42 | // declare const ui: UI; 43 | 44 | type View = any; 45 | 46 | interface UILike { 47 | toString(): string; 48 | } 49 | 50 | declare namespace ui { 51 | function layout(xml: UILike | any): void; 52 | function inflate(xml: UILike | any, parent?: View): void; 53 | function findView(id: string): View; 54 | function finish() 55 | function setContentView(view: View) 56 | function run(callback) 57 | function post(callback, delay?: number): void; 58 | function statusBarColor(color) 59 | function showPopupMenu(view, menu) 60 | } -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/addon/fold/indent-fold.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror")); 7 | else if (typeof define == "function" && define.amd) // AMD 8 | define(["../../lib/codemirror"], mod); 9 | else // Plain browser env 10 | mod(CodeMirror); 11 | })(function(CodeMirror) { 12 | "use strict"; 13 | 14 | function lineIndent(cm, lineNo) { 15 | var text = cm.getLine(lineNo) 16 | var spaceTo = text.search(/\S/) 17 | if (spaceTo == -1 || /\bcomment\b/.test(cm.getTokenTypeAt(CodeMirror.Pos(lineNo, spaceTo + 1)))) 18 | return -1 19 | return CodeMirror.countColumn(text, null, cm.getOption("tabSize")) 20 | } 21 | 22 | CodeMirror.registerHelper("fold", "indent", function(cm, start) { 23 | var myIndent = lineIndent(cm, start.line) 24 | if (myIndent < 0) return 25 | var lastLineInFold = null 26 | 27 | // Go through lines until we find a line that definitely doesn't belong in 28 | // the block we're folding, or to the end. 29 | for (var i = start.line + 1, end = cm.lastLine(); i <= end; ++i) { 30 | var indent = lineIndent(cm, i) 31 | if (indent == -1) { 32 | } else if (indent > myIndent) { 33 | // Lines with a greater indent are considered part of the block. 34 | lastLineInFold = i; 35 | } else { 36 | // If this line has non-space, non-comment content, and is 37 | // indented less or equal to the start line, it is the start of 38 | // another block. 39 | break; 40 | } 41 | } 42 | if (lastLineInFold) return { 43 | from: CodeMirror.Pos(start.line, cm.getLine(start.line).length), 44 | to: CodeMirror.Pos(lastLineInFold, cm.getLine(lastLineInFold).length) 45 | }; 46 | }); 47 | 48 | }); 49 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/mode/htmlembedded/htmlembedded.js: -------------------------------------------------------------------------------- 1 | // CodeMirror, copyright (c) by Marijn Haverbeke and others 2 | // Distributed under an MIT license: https://codemirror.net/LICENSE 3 | 4 | (function(mod) { 5 | if (typeof exports == "object" && typeof module == "object") // CommonJS 6 | mod(require("../../lib/codemirror"), require("../htmlmixed/htmlmixed"), 7 | require("../../addon/mode/multiplex")); 8 | else if (typeof define == "function" && define.amd) // AMD 9 | define(["../../lib/codemirror", "../htmlmixed/htmlmixed", 10 | "../../addon/mode/multiplex"], mod); 11 | else // Plain browser env 12 | mod(CodeMirror); 13 | })(function(CodeMirror) { 14 | "use strict"; 15 | 16 | CodeMirror.defineMode("htmlembedded", function(config, parserConfig) { 17 | var closeComment = parserConfig.closeComment || "--%>" 18 | return CodeMirror.multiplexingMode(CodeMirror.getMode(config, "htmlmixed"), { 19 | open: parserConfig.openComment || "<%--", 20 | close: closeComment, 21 | delimStyle: "comment", 22 | mode: {token: function(stream) { 23 | stream.skipTo(closeComment) || stream.skipToEnd() 24 | return "comment" 25 | }} 26 | }, { 27 | open: parserConfig.open || parserConfig.scriptStartRegex || "<%", 28 | close: parserConfig.close || parserConfig.scriptEndRegex || "%>", 29 | mode: CodeMirror.getMode(config, parserConfig.scriptingModeSpec) 30 | }); 31 | }, "htmlmixed"); 32 | 33 | CodeMirror.defineMIME("application/x-ejs", {name: "htmlembedded", scriptingModeSpec:"javascript"}); 34 | CodeMirror.defineMIME("application/x-aspx", {name: "htmlembedded", scriptingModeSpec:"text/x-csharp"}); 35 | CodeMirror.defineMIME("application/x-jsp", {name: "htmlembedded", scriptingModeSpec:"text/x-java"}); 36 | CodeMirror.defineMIME("application/x-erb", {name: "htmlembedded", scriptingModeSpec:"ruby"}); 37 | }); 38 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/gruvbox-dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: gruvbox-dark 4 | Author: kRkk (https://github.com/krkk) 5 | 6 | Original gruvbox color scheme by Pavel Pertsev (https://github.com/morhetz/gruvbox) 7 | 8 | */ 9 | 10 | .cm-s-gruvbox-dark.CodeMirror, .cm-s-gruvbox-dark .CodeMirror-gutters { background-color: #282828; color: #bdae93; } 11 | .cm-s-gruvbox-dark .CodeMirror-gutters {background: #282828; border-right: 0px;} 12 | .cm-s-gruvbox-dark .CodeMirror-linenumber {color: #7c6f64;} 13 | .cm-s-gruvbox-dark .CodeMirror-cursor { border-left: 1px solid #ebdbb2; } 14 | .cm-s-gruvbox-dark div.CodeMirror-selected { background: #928374; } 15 | .cm-s-gruvbox-dark span.cm-meta { color: #83a598; } 16 | 17 | .cm-s-gruvbox-dark span.cm-comment { color: #928374; } 18 | .cm-s-gruvbox-dark span.cm-number, span.cm-atom { color: #d3869b; } 19 | .cm-s-gruvbox-dark span.cm-keyword { color: #f84934; } 20 | 21 | .cm-s-gruvbox-dark span.cm-variable { color: #ebdbb2; } 22 | .cm-s-gruvbox-dark span.cm-variable-2 { color: #ebdbb2; } 23 | .cm-s-gruvbox-dark span.cm-variable-3, .cm-s-gruvbox-dark span.cm-type { color: #fabd2f; } 24 | .cm-s-gruvbox-dark span.cm-operator { color: #ebdbb2; } 25 | .cm-s-gruvbox-dark span.cm-callee { color: #ebdbb2; } 26 | .cm-s-gruvbox-dark span.cm-def { color: #ebdbb2; } 27 | .cm-s-gruvbox-dark span.cm-property { color: #ebdbb2; } 28 | .cm-s-gruvbox-dark span.cm-string { color: #b8bb26; } 29 | .cm-s-gruvbox-dark span.cm-string-2 { color: #8ec07c; } 30 | .cm-s-gruvbox-dark span.cm-qualifier { color: #8ec07c; } 31 | .cm-s-gruvbox-dark span.cm-attribute { color: #8ec07c; } 32 | 33 | .cm-s-gruvbox-dark .CodeMirror-activeline-background { background: #3c3836; } 34 | .cm-s-gruvbox-dark .CodeMirror-matchingbracket { background: #928374; color:#282828 !important; } 35 | 36 | .cm-s-gruvbox-dark span.cm-builtin { color: #fe8019; } 37 | .cm-s-gruvbox-dark span.cm-tag { color: #fe8019; } 38 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/rubyblue.css: -------------------------------------------------------------------------------- 1 | .cm-s-rubyblue.CodeMirror { background: #112435; color: white; } 2 | .cm-s-rubyblue div.CodeMirror-selected { background: #38566F; } 3 | .cm-s-rubyblue .CodeMirror-line::selection, .cm-s-rubyblue .CodeMirror-line > span::selection, .cm-s-rubyblue .CodeMirror-line > span > span::selection { background: rgba(56, 86, 111, 0.99); } 4 | .cm-s-rubyblue .CodeMirror-line::-moz-selection, .cm-s-rubyblue .CodeMirror-line > span::-moz-selection, .cm-s-rubyblue .CodeMirror-line > span > span::-moz-selection { background: rgba(56, 86, 111, 0.99); } 5 | .cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; } 6 | .cm-s-rubyblue .CodeMirror-guttermarker { color: white; } 7 | .cm-s-rubyblue .CodeMirror-guttermarker-subtle { color: #3E7087; } 8 | .cm-s-rubyblue .CodeMirror-linenumber { color: white; } 9 | .cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white; } 10 | 11 | .cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; } 12 | .cm-s-rubyblue span.cm-atom { color: #F4C20B; } 13 | .cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; } 14 | .cm-s-rubyblue span.cm-keyword { color: #F0F; } 15 | .cm-s-rubyblue span.cm-string { color: #F08047; } 16 | .cm-s-rubyblue span.cm-meta { color: #F0F; } 17 | .cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; } 18 | .cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def, .cm-s-rubyblue span.cm-type { color: white; } 19 | .cm-s-rubyblue span.cm-bracket { color: #F0F; } 20 | .cm-s-rubyblue span.cm-link { color: #F4C20B; } 21 | .cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; } 22 | .cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; } 23 | .cm-s-rubyblue span.cm-error { color: #AF2018; } 24 | 25 | .cm-s-rubyblue .CodeMirror-activeline-background { background: #173047; } 26 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/mode/javascript/typescript.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | CodeMirror: TypeScript mode 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 25 | 26 |
27 |

TypeScript mode

28 | 29 | 30 |
52 | 53 | 60 | 61 |

This is a specialization of the JavaScript mode.

62 |
63 | -------------------------------------------------------------------------------- /autox-ts/src/action.ts: -------------------------------------------------------------------------------- 1 | export function test() { 2 | toast("222"); 3 | } 4 | 5 | export function checkAccessibility(自动) { 6 | var 应用包名 = context.getPackageName(); 7 | var 应用名 = getAppName(应用包名); 8 | for (let a = 0; a < 11; a++) { 9 | try { 10 | let a = packageNameMatches(/.+/).findOnce(); 11 | log(a.packageName()); 12 | break; 13 | } catch (e) { 14 | try { 15 | auto(); 16 | } catch (e) {} 17 | sleep(1000); 18 | toastLog("请选择," + 应用名 + " 打开无障碍辅助功能"); 19 | let autojs = context.getPackageName() + "/com.stardust.autojs.core.accessibility.AccessibilityService"; 20 | if (自动) { 21 | try { 22 | 重启无障碍root(autojs); 23 | } catch (e) { 24 | toast("自动开启无障碍失败,请手动开始"); 25 | sleep(2000); 26 | } 27 | } 28 | sleep(3000); 29 | } 30 | if (a == 4) { 31 | exit(); 32 | } 33 | } 34 | 35 | function 重启无障碍root(参数) { 36 | toastLog("正在尝试使用root权限开启无障碍"); 37 | var s = shell("settings get secure enabled_accessibility_services", true).result.replace(/\n/, ""); 38 | if (s.indexOf(参数) > -1) { 39 | s = s.replace(参数, ""); 40 | var 结果 = shell("settings put secure enabled_accessibility_services :" + s, true); 41 | if (结果.code) { 42 | toastLog("尝试开启无障碍服务异常"); 43 | return; 44 | } 45 | } 46 | s += ":" + 参数; 47 | s = s.replace(/:+/gim, ":"); 48 | shell("settings put secure accessibility_enabled 1", true); 49 | var code = shell("settings put secure enabled_accessibility_services " + s, true).code; 50 | if (code) { 51 | toastLog("尝试开启无障碍服务异常"); 52 | return; 53 | } 54 | shell("settings put secure accessibility_enabled 1", true); 55 | } 56 | } 57 | 58 | // 获取唯一设备ID 59 | export function getUid() { 60 | const eName = "yanni"; 61 | var imei = device.getAndroidId(); 62 | var uniqueId = `${eName}_${imei}`; 63 | return uniqueId; 64 | } 65 | -------------------------------------------------------------------------------- /web-control/web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "vue-admin-template", 3 | "version": "4.2.1", 4 | "description": "A vue admin template with Element UI & axios & iconfont & permission control & lint", 5 | "author": "Pan ", 6 | "license": "MIT", 7 | "scripts": { 8 | "dev": "vue-cli-service serve", 9 | "build:prod": "vue-cli-service build", 10 | "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml" 11 | }, 12 | "dependencies": { 13 | "axios": "0.18.1", 14 | "cron-parser": "2.13.0", 15 | "element-ui": "2.13.0", 16 | "js-cookie": "2.2.0", 17 | "moment": "2.24.0", 18 | "normalize.css": "7.0.0", 19 | "nprogress": "0.2.0", 20 | "path-to-regexp": "2.4.0", 21 | "vue": "2.6.10", 22 | "vue-router": "3.0.6", 23 | "vuex": "3.1.0" 24 | }, 25 | "devDependencies": { 26 | "@babel/core": "7.0.0", 27 | "@babel/register": "7.0.0", 28 | "@vue/cli-plugin-babel": "3.6.0", 29 | "@vue/cli-plugin-eslint": "3.9.1", 30 | "@vue/cli-plugin-unit-jest": "3.6.3", 31 | "@vue/cli-service": "3.6.0", 32 | "@vue/test-utils": "1.0.0-beta.29", 33 | "autoprefixer": "9.5.1", 34 | "babel-core": "7.0.0-bridge.0", 35 | "babel-eslint": "10.0.1", 36 | "babel-jest": "23.6.0", 37 | "chalk": "2.4.2", 38 | "connect": "3.6.6", 39 | "eslint": "5.15.3", 40 | "eslint-plugin-vue": "5.2.2", 41 | "html-webpack-plugin": "3.2.0", 42 | "mockjs": "1.0.1-beta3", 43 | "node-sass": "4.14.1", 44 | "runjs": "4.3.2", 45 | "sass-loader": "7.1.0", 46 | "script-ext-html-webpack-plugin": "2.1.3", 47 | "script-loader": "0.7.2", 48 | "serve-static": "1.13.2", 49 | "svg-sprite-loader": "4.1.3", 50 | "svgo": "1.2.2", 51 | "vue-template-compiler": "2.6.10" 52 | }, 53 | "engines": { 54 | "node": ">=8.9", 55 | "npm": ">= 3.0.0" 56 | }, 57 | "browserslist": [ 58 | "> 1%", 59 | "last 2 versions" 60 | ] 61 | } 62 | -------------------------------------------------------------------------------- /web-control/web/public/lib/codemirror/theme/tomorrow-night-bright.css: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Name: Tomorrow Night - Bright 4 | Author: Chris Kempson 5 | 6 | Port done by Gerard Braad 7 | 8 | */ 9 | 10 | .cm-s-tomorrow-night-bright.CodeMirror { background: #000000; color: #eaeaea; } 11 | .cm-s-tomorrow-night-bright div.CodeMirror-selected { background: #424242; } 12 | .cm-s-tomorrow-night-bright .CodeMirror-gutters { background: #000000; border-right: 0px; } 13 | .cm-s-tomorrow-night-bright .CodeMirror-guttermarker { color: #e78c45; } 14 | .cm-s-tomorrow-night-bright .CodeMirror-guttermarker-subtle { color: #777; } 15 | .cm-s-tomorrow-night-bright .CodeMirror-linenumber { color: #424242; } 16 | .cm-s-tomorrow-night-bright .CodeMirror-cursor { border-left: 1px solid #6A6A6A; } 17 | 18 | .cm-s-tomorrow-night-bright span.cm-comment { color: #d27b53; } 19 | .cm-s-tomorrow-night-bright span.cm-atom { color: #a16a94; } 20 | .cm-s-tomorrow-night-bright span.cm-number { color: #a16a94; } 21 | 22 | .cm-s-tomorrow-night-bright span.cm-property, .cm-s-tomorrow-night-bright span.cm-attribute { color: #99cc99; } 23 | .cm-s-tomorrow-night-bright span.cm-keyword { color: #d54e53; } 24 | .cm-s-tomorrow-night-bright span.cm-string { color: #e7c547; } 25 | 26 | .cm-s-tomorrow-night-bright span.cm-variable { color: #b9ca4a; } 27 | .cm-s-tomorrow-night-bright span.cm-variable-2 { color: #7aa6da; } 28 | .cm-s-tomorrow-night-bright span.cm-def { color: #e78c45; } 29 | .cm-s-tomorrow-night-bright span.cm-bracket { color: #eaeaea; } 30 | .cm-s-tomorrow-night-bright span.cm-tag { color: #d54e53; } 31 | .cm-s-tomorrow-night-bright span.cm-link { color: #a16a94; } 32 | .cm-s-tomorrow-night-bright span.cm-error { background: #d54e53; color: #6A6A6A; } 33 | 34 | .cm-s-tomorrow-night-bright .CodeMirror-activeline-background { background: #2a2a2a; } 35 | .cm-s-tomorrow-night-bright .CodeMirror-matchingbracket { text-decoration: underline; color: white !important; } 36 | --------------------------------------------------------------------------------