├── .editorconfig ├── .github └── workflows │ ├── build.yml.bak │ ├── check.yml.bak │ └── release.yml.bak ├── .gitignore ├── .prettierignore ├── .prettierrc.json ├── LICENSE ├── PKGBUILD ├── PRIVACY ├── README.md ├── api └── proxy.ts ├── clear.cjs ├── dependence.sh ├── images ├── v1_1.jpg ├── v2.0.0.png └── v2_1.png ├── package.json ├── packages ├── ctool-adapter │ ├── base │ │ ├── .gitignore │ │ ├── package.json │ │ ├── src │ │ │ └── index.ts │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── chrome │ │ ├── .gitignore │ │ ├── package.json │ │ ├── resources │ │ │ ├── _locales │ │ │ │ ├── en │ │ │ │ │ └── messages.json │ │ │ │ └── zh_CN │ │ │ │ │ └── messages.json │ │ │ ├── background.js │ │ │ ├── manifest.json │ │ │ └── manifest_v3.json │ │ ├── src │ │ │ ├── index.ts │ │ │ └── release.ts │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── edge │ │ ├── .gitignore │ │ ├── package.json │ │ ├── resources │ │ │ ├── _locales │ │ │ │ ├── en │ │ │ │ │ └── messages.json │ │ │ │ └── zh_CN │ │ │ │ │ └── messages.json │ │ │ ├── background.js │ │ │ └── manifest.json │ │ ├── src │ │ │ ├── index.ts │ │ │ └── release.ts │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── firefox │ │ ├── .gitignore │ │ ├── package.json │ │ ├── resources │ │ │ ├── _locales │ │ │ │ ├── en │ │ │ │ │ └── messages.json │ │ │ │ └── zh_CN │ │ │ │ │ └── messages.json │ │ │ ├── background.js │ │ │ └── manifest.json │ │ ├── src │ │ │ ├── index.ts │ │ │ └── release.ts │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── tauri │ │ ├── .gitignore │ │ ├── .vscode │ │ │ └── extensions.json │ │ ├── README.md │ │ ├── index.html │ │ ├── package.json │ │ ├── src-tauri │ │ │ ├── .gitignore │ │ │ ├── Cargo.lock │ │ │ ├── Cargo.toml │ │ │ ├── build.rs │ │ │ ├── src │ │ │ │ └── main.rs │ │ │ └── tauri.conf.template.json5 │ │ ├── src │ │ │ ├── index.ts │ │ │ ├── init.ts │ │ │ └── release.ts │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ ├── utools │ │ ├── .gitignore │ │ ├── package.json │ │ ├── resources │ │ │ └── plugin.json │ │ ├── src │ │ │ ├── config.ts │ │ │ ├── index.ts │ │ │ ├── release.ts │ │ │ └── storage.ts │ │ ├── tsconfig.json │ │ └── tsup.config.ts │ └── web │ │ ├── .gitignore │ │ ├── package.json │ │ ├── src │ │ └── release.ts │ │ ├── tsconfig.json │ │ └── tsup.config.ts ├── ctool-config │ ├── .gitignore │ ├── package.json │ ├── src │ │ ├── category.ts │ │ ├── config.ts │ │ ├── feature.ts │ │ ├── generate.ts │ │ ├── generate │ │ │ ├── fileSystem.ts │ │ │ ├── i18n.ts │ │ │ ├── icon.ts │ │ │ ├── icon │ │ │ │ ├── ad.ts │ │ │ │ ├── checked.ts │ │ │ │ ├── clear.ts │ │ │ │ ├── clipboard.ts │ │ │ │ ├── close.ts │ │ │ │ ├── common.ts │ │ │ │ ├── copy.ts │ │ │ │ ├── devtools.ts │ │ │ │ ├── empty.ts │ │ │ │ ├── error.ts │ │ │ │ ├── full.ts │ │ │ │ ├── github.ts │ │ │ │ ├── history.ts │ │ │ │ ├── info.ts │ │ │ │ ├── location.ts │ │ │ │ ├── message.ts │ │ │ │ ├── moon.ts │ │ │ │ ├── question.ts │ │ │ │ ├── refresh.ts │ │ │ │ ├── right.ts │ │ │ │ ├── search.ts │ │ │ │ ├── selected.ts │ │ │ │ ├── setting.ts │ │ │ │ ├── success.ts │ │ │ │ ├── sun.ts │ │ │ │ ├── toggle.ts │ │ │ │ ├── unchecked.ts │ │ │ │ ├── up.ts │ │ │ │ └── upload.ts │ │ │ ├── keyword.ts │ │ │ └── router.ts │ │ ├── index.ts │ │ ├── proxy.ts │ │ └── tool.ts │ ├── tsconfig.json │ └── tsup.config.ts ├── ctool-core │ ├── .gitignore │ ├── CONTRIBUTING.md │ ├── index.html │ ├── package.json │ ├── public │ │ ├── favicon.ico │ │ ├── icon │ │ │ ├── icon_1024.png │ │ │ ├── icon_chrome.png │ │ │ └── icon_utools.png │ │ └── robots.txt │ ├── src │ │ ├── Tool.vue │ │ ├── block │ │ │ ├── Clipboard.vue │ │ │ ├── Common.vue │ │ │ ├── Content.vue │ │ │ ├── Github.vue │ │ │ ├── History.vue │ │ │ ├── Index.vue │ │ │ ├── Notice.vue │ │ │ ├── Search.vue │ │ │ ├── Setting.vue │ │ │ ├── Test.vue │ │ │ ├── Tools.vue │ │ │ ├── layout │ │ │ │ ├── complex │ │ │ │ │ ├── Bottom.vue │ │ │ │ │ └── Header.vue │ │ │ │ └── simple │ │ │ │ │ ├── Bottom.vue │ │ │ │ │ └── Header.vue │ │ │ └── utools │ │ │ │ └── Keyword.vue │ │ ├── components │ │ │ ├── Align.vue │ │ │ ├── Display.vue │ │ │ ├── Exception.vue │ │ │ ├── ExtendPage.vue │ │ │ ├── HeightResize.vue │ │ │ ├── HelpTip.vue │ │ │ ├── Message.vue │ │ │ ├── Modal.vue │ │ │ ├── editor │ │ │ │ ├── Diff.vue │ │ │ │ ├── Editor.vue │ │ │ │ ├── contextMenu.ts │ │ │ │ ├── lineInfo.ts │ │ │ │ ├── monaco.ts │ │ │ │ ├── placeholderContentWidget.ts │ │ │ │ └── style.css │ │ │ ├── register.ts │ │ │ ├── serialize │ │ │ │ ├── SerializeInput.vue │ │ │ │ ├── SerializeOutput.vue │ │ │ │ ├── index.ts │ │ │ │ ├── input.ts │ │ │ │ └── output.ts │ │ │ ├── text │ │ │ │ ├── TextInput.vue │ │ │ │ ├── TextOutput.vue │ │ │ │ ├── index.ts │ │ │ │ ├── input.ts │ │ │ │ └── output.ts │ │ │ ├── type.d.ts │ │ │ ├── ui │ │ │ │ ├── Bool.vue │ │ │ │ ├── Button.vue │ │ │ │ ├── Card.vue │ │ │ │ ├── Checkbox.vue │ │ │ │ ├── Color.vue │ │ │ │ ├── Dropdown.vue │ │ │ │ ├── Icon.vue │ │ │ │ ├── Input.vue │ │ │ │ ├── InputNumber.vue │ │ │ │ ├── Link.vue │ │ │ │ ├── Radio.vue │ │ │ │ ├── Select.vue │ │ │ │ ├── Table.vue │ │ │ │ ├── Tabs.vue │ │ │ │ ├── Textarea.vue │ │ │ │ ├── Tooltip.vue │ │ │ │ └── UploadFile.vue │ │ │ └── util.ts │ │ ├── config.ts │ │ ├── directive │ │ │ └── row.ts │ │ ├── event │ │ │ └── index.ts │ │ ├── helper │ │ │ ├── clipboard.ts │ │ │ ├── code.ts │ │ │ ├── helper.ts │ │ │ ├── history.ts │ │ │ ├── icon.ts │ │ │ ├── json │ │ │ │ └── index.ts │ │ │ ├── message.ts │ │ │ ├── nameConvert.ts │ │ │ ├── pinia.ts │ │ │ ├── platform │ │ │ │ ├── index.ts │ │ │ │ ├── platformRuntimeDefault.ts │ │ │ │ ├── runtime.ts │ │ │ │ └── storage.ts │ │ │ ├── plugin.ts │ │ │ ├── proxy.ts │ │ │ ├── radix.ts │ │ │ ├── router.ts │ │ │ ├── serialize │ │ │ │ ├── csv.ts │ │ │ │ ├── index.ts │ │ │ │ ├── phpArray.ts │ │ │ │ ├── phpSerialize │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── serialize.ts │ │ │ │ │ └── unserialize.ts │ │ │ │ ├── propertiesToJson.ts │ │ │ │ ├── table.ts │ │ │ │ ├── xml.ts │ │ │ │ └── yaml.ts │ │ │ ├── stat.ts │ │ │ ├── storage.ts │ │ │ ├── text │ │ │ │ ├── index.ts │ │ │ │ └── uint.ts │ │ │ └── util.ts │ │ ├── i18n │ │ │ ├── index.ts │ │ │ └── locales │ │ │ │ ├── en │ │ │ │ ├── component.i18n.json5 │ │ │ │ ├── main.i18n.json5 │ │ │ │ └── tool.i18n.json5 │ │ │ │ └── zh_CN │ │ │ │ ├── component.i18n.json5 │ │ │ │ ├── main.i18n.json5 │ │ │ │ └── tool.i18n.json5 │ │ ├── index.ts │ │ ├── statics │ │ │ ├── pico.css │ │ │ ├── pico.original.css │ │ │ ├── style.css │ │ │ └── tools │ │ │ │ ├── code │ │ │ │ └── run_api_config.png │ │ │ │ └── crontab │ │ │ │ └── crontab.png │ │ ├── store │ │ │ ├── action.ts │ │ │ ├── operate.ts │ │ │ ├── setting.ts │ │ │ └── user.ts │ │ ├── tool.ts │ │ ├── tools │ │ │ ├── arm │ │ │ │ ├── ArmToHex.vue │ │ │ │ ├── HexToArm.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ └── util.ts │ │ │ ├── ascii │ │ │ │ ├── Ascii.vue │ │ │ │ ├── Reference.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ └── util.ts │ │ │ ├── asn1 │ │ │ │ ├── Asn1.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ └── lib │ │ │ │ │ ├── asn1.js │ │ │ │ │ ├── asn1toxml.js │ │ │ │ │ ├── int10.js │ │ │ │ │ └── oids.js │ │ │ ├── barcode │ │ │ │ ├── Barcode.vue │ │ │ │ └── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ ├── base64 │ │ │ │ ├── Decoder.vue │ │ │ │ └── Encoder.vue │ │ │ ├── bcrypt │ │ │ │ ├── Bcrypt.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ └── worker.ts │ │ │ ├── binary │ │ │ │ ├── Binary.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ └── util.ts │ │ │ ├── code │ │ │ │ ├── Code.vue │ │ │ │ ├── Run.vue │ │ │ │ ├── formatter │ │ │ │ │ ├── angular.ts │ │ │ │ │ ├── base.ts │ │ │ │ │ ├── css.ts │ │ │ │ │ ├── graphql.ts │ │ │ │ │ ├── html.ts │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── java.ts │ │ │ │ │ ├── javascript.ts │ │ │ │ │ ├── json.ts │ │ │ │ │ ├── jsonMinify.ts │ │ │ │ │ ├── less.ts │ │ │ │ │ ├── markdown.ts │ │ │ │ │ ├── php.ts │ │ │ │ │ ├── scss.ts │ │ │ │ │ ├── sql.ts │ │ │ │ │ ├── types.ts │ │ │ │ │ ├── typescript.ts │ │ │ │ │ ├── vue.ts │ │ │ │ │ ├── xml.ts │ │ │ │ │ └── yaml.ts │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ └── runUtil.ts │ │ │ ├── color │ │ │ │ ├── Color.vue │ │ │ │ └── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ ├── crontab │ │ │ │ ├── Crontab.vue │ │ │ │ ├── generate │ │ │ │ │ ├── Generate.vue │ │ │ │ │ ├── Item.vue │ │ │ │ │ ├── Option.vue │ │ │ │ │ ├── style.css │ │ │ │ │ └── type.ts │ │ │ │ └── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ ├── dataValidation │ │ │ │ ├── Bcc.vue │ │ │ │ ├── Crc.vue │ │ │ │ ├── Lrc.vue │ │ │ │ └── util.ts │ │ │ ├── diffs │ │ │ │ ├── Diffs.vue │ │ │ │ └── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ ├── dockerCompose │ │ │ │ └── DockerCompose.vue │ │ │ ├── encrypt │ │ │ │ ├── aes │ │ │ │ │ ├── Decrypt.vue │ │ │ │ │ ├── Encrypt.vue │ │ │ │ │ └── i18n │ │ │ │ │ │ ├── en.json5 │ │ │ │ │ │ └── zh_CN.json5 │ │ │ │ ├── cryptoJS.ts │ │ │ │ ├── des │ │ │ │ │ ├── Decrypt.vue │ │ │ │ │ └── Encrypt.vue │ │ │ │ ├── rabbit │ │ │ │ │ ├── Decrypt.vue │ │ │ │ │ └── Encrypt.vue │ │ │ │ ├── rc4 │ │ │ │ │ ├── Decrypt.vue │ │ │ │ │ └── Encrypt.vue │ │ │ │ ├── rsa │ │ │ │ │ ├── Decrypt.vue │ │ │ │ │ ├── Encrypt.vue │ │ │ │ │ └── i18n │ │ │ │ │ │ ├── en.json5 │ │ │ │ │ │ └── zh_CN.json5 │ │ │ │ ├── sm2 │ │ │ │ │ ├── Decrypt.vue │ │ │ │ │ ├── Encrypt.vue │ │ │ │ │ ├── Sign.vue │ │ │ │ │ ├── Verify.vue │ │ │ │ │ └── i18n │ │ │ │ │ │ ├── en.json5 │ │ │ │ │ │ └── zh_CN.json5 │ │ │ │ ├── sm4 │ │ │ │ │ ├── Decrypt.vue │ │ │ │ │ └── Encrypt.vue │ │ │ │ └── tripleDes │ │ │ │ │ ├── Decrypt.vue │ │ │ │ │ └── Encrypt.vue │ │ │ ├── gzip │ │ │ │ ├── Decoder.vue │ │ │ │ └── Encoder.vue │ │ │ ├── hash │ │ │ │ ├── Hash.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ └── util.ts │ │ │ ├── hexString │ │ │ │ ├── HexToString.vue │ │ │ │ └── StringToHex.vue │ │ │ ├── hmac │ │ │ │ ├── Hmac.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ └── util.ts │ │ │ ├── html │ │ │ │ ├── Html.vue │ │ │ │ └── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ ├── httpSnippet │ │ │ │ ├── HttpSnippet.vue │ │ │ │ ├── curlToHar.ts │ │ │ │ └── util.ts │ │ │ ├── ip │ │ │ │ ├── Ip.vue │ │ │ │ └── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ ├── ipcalc │ │ │ │ ├── Ipv4.vue │ │ │ │ ├── Ipv6.vue │ │ │ │ ├── Item.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ ├── utilV4.ts │ │ │ │ └── utilV6.ts │ │ │ ├── json │ │ │ │ ├── Json.vue │ │ │ │ ├── Path.vue │ │ │ │ ├── Schema.vue │ │ │ │ ├── define.ts │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ ├── toObject │ │ │ │ │ ├── ToObject.vue │ │ │ │ │ ├── index.ts │ │ │ │ │ ├── php │ │ │ │ │ │ ├── class.ts │ │ │ │ │ │ ├── constructor.ts │ │ │ │ │ │ ├── deps.ts │ │ │ │ │ │ ├── getterSetter.ts │ │ │ │ │ │ ├── index.ts │ │ │ │ │ │ ├── property.ts │ │ │ │ │ │ ├── types.ts │ │ │ │ │ │ └── utils.ts │ │ │ │ │ ├── protobuf.ts │ │ │ │ │ ├── quickType.ts │ │ │ │ │ └── type.ts │ │ │ │ └── util.ts │ │ │ ├── jwt │ │ │ │ └── Jwt.vue │ │ │ ├── pinyin │ │ │ │ ├── Pinyin.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ └── util.ts │ │ │ ├── qrCode │ │ │ │ ├── Generate.vue │ │ │ │ ├── GenerateOptionColor.vue │ │ │ │ ├── Parse.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ ├── lib │ │ │ │ │ └── decoder.js │ │ │ │ └── util.ts │ │ │ ├── radix │ │ │ │ ├── Radix.vue │ │ │ │ └── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ ├── randomString │ │ │ │ ├── RandomString.vue │ │ │ │ └── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ ├── regex │ │ │ │ ├── Reference.vue │ │ │ │ ├── Regex.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ └── util.ts │ │ │ ├── serialize │ │ │ │ └── Serialize.vue │ │ │ ├── sign │ │ │ │ ├── Sign.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ └── worker.ts │ │ │ ├── sqlFillParameter │ │ │ │ ├── SqlFillParameter.vue │ │ │ │ └── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ ├── text │ │ │ │ ├── Text.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ └── util.ts │ │ │ ├── time │ │ │ │ ├── Calculator.vue │ │ │ │ ├── Timestamp.vue │ │ │ │ ├── Timezone.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ └── util │ │ │ │ │ ├── timestamp.ts │ │ │ │ │ └── timezone.ts │ │ │ ├── unicode │ │ │ │ ├── Decoder.vue │ │ │ │ ├── Encoder.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ └── util.ts │ │ │ ├── unit │ │ │ │ ├── Unit.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ └── util.ts │ │ │ ├── url │ │ │ │ ├── Decoder.vue │ │ │ │ └── Encoder.vue │ │ │ ├── urlParse │ │ │ │ └── UrlParse.vue │ │ │ ├── uuid │ │ │ │ ├── Uuid.vue │ │ │ │ ├── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ │ └── util.ts │ │ │ ├── variableConversion │ │ │ │ ├── VariableConversion.vue │ │ │ │ └── i18n │ │ │ │ │ ├── en.json5 │ │ │ │ │ └── zh_CN.json5 │ │ │ └── websocket │ │ │ │ ├── Websocket.vue │ │ │ │ ├── i18n │ │ │ │ ├── en.json5 │ │ │ │ └── zh_CN.json5 │ │ │ │ └── server.js │ │ ├── types.ts │ │ └── vite-env.d.ts │ ├── tool.html │ ├── tsconfig.json │ ├── tsconfig.node.json │ └── vite.config.ts └── ctool-site │ ├── .gitignore │ ├── head.html │ ├── index.html │ ├── manifest.webmanifest.json │ ├── package.json │ ├── public │ ├── _status.html │ └── icon │ │ ├── icon.svg │ │ ├── icon_180.png │ │ ├── icon_512.png │ │ ├── icon_60.png │ │ ├── icon_96.png │ │ ├── screenshot_dark.png │ │ └── screenshot_light.png │ ├── src │ ├── Index.vue │ ├── Tooltip.vue │ ├── helper.ts │ ├── index.ts │ ├── locale.json │ ├── statics │ │ ├── arc.svg │ │ ├── chrome.svg │ │ ├── edge.svg │ │ ├── firefox.svg │ │ ├── github.svg │ │ ├── lang.svg │ │ ├── linux.svg │ │ ├── logo.svg │ │ ├── mac.svg │ │ ├── search.svg │ │ ├── style.css │ │ ├── suggest.svg │ │ ├── theme.svg │ │ ├── utools.svg │ │ └── windows.svg │ └── vite-env.d.ts │ ├── tsconfig.json │ ├── tsconfig.node.json │ ├── vite.config.ts │ └── vitePlugin.ts ├── pnpm-lock.yaml ├── pnpm-workspace.yaml ├── release.cjs ├── tsconfig.json └── vercel.json /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | # Unix-style newlines with a newline ending every file 4 | [*] 5 | end_of_line = lf 6 | insert_final_newline = true 7 | indent_style = space 8 | indent_size = 4 9 | 10 | # Matches multiple files with brace expansion notation 11 | # Set default charset 12 | [*.{js,ts,vue,html,css,scss,md}] 13 | charset = utf-8 14 | -------------------------------------------------------------------------------- /.github/workflows/check.yml.bak: -------------------------------------------------------------------------------- 1 | # 代码检查 2 | name: Check Ctool 3 | on: 4 | pull_request: 5 | branches: 6 | - "master" 7 | paths: 8 | - "packages/**" 9 | - "package.json" 10 | - "pnpm-lock.yaml" 11 | - "pnpm-workspace.yaml" 12 | - "release.cjs" 13 | 14 | jobs: 15 | check: 16 | runs-on: ubuntu-latest 17 | 18 | steps: 19 | - name: Checkout 20 | uses: actions/checkout@v3 21 | 22 | - name: Use Node.js 23 | uses: actions/setup-node@v3 24 | with: 25 | node-version: 16 26 | 27 | - uses: pnpm/action-setup@v2 28 | name: Install pnpm 29 | id: pnpm-install 30 | with: 31 | version: 8 32 | run_install: false 33 | 34 | - name: Get pnpm store directory 35 | id: pnpm-cache 36 | shell: bash 37 | run: | 38 | echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT 39 | 40 | - uses: actions/cache@v3 41 | name: Setup pnpm cache 42 | with: 43 | path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} 44 | key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} 45 | restore-keys: | 46 | ${{ runner.os }}-pnpm-store- 47 | 48 | - name: Install dependencies 49 | run: pnpm install 50 | 51 | - name: Check 52 | run: pnpm run check 53 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | 26 | _release 27 | _release_files 28 | _temp 29 | .npmrc 30 | todo_list.md 31 | 32 | .vercel 33 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | **/dist/ 2 | **/node_modules/ 3 | -------------------------------------------------------------------------------- /.prettierrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "printWidth": 120, 3 | "tabWidth": 4, 4 | "useTabs": false, 5 | "semi": true, 6 | "proseWrap": "preserve", 7 | "arrowParens": "avoid", 8 | "bracketSpacing": true, 9 | "endOfLine": "auto", 10 | "eslintIntegration": false, 11 | "bracketSameLine": false, 12 | "jsxSingleQuote": false, 13 | "trailingComma": "all" 14 | } 15 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright 2017 baiy 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /PKGBUILD: -------------------------------------------------------------------------------- 1 | # Maintainer: asukaminato 2 | pkgname=ctool-bin 3 | pkgver="v2.0.0" 4 | _pkgname=${pkgname/-bin/} 5 | pkgrel=1 6 | pkgdesc='程序开发常用工具 chrome /edge/firefox /utools/windows /linux/mac' 7 | arch=('x86_64') 8 | url="https://github.com/baiy/Ctool" 9 | license=('MIT') 10 | makedepends=('jq') 11 | depends=('webkit2gtk-4.1' 12 | 'gtk3') 13 | source=("${url}/releases/latest/download/ctool_tauri_linux.deb") 14 | sha256sums=('SKIP') 15 | pkgver(){ 16 | curl --silent "https://api.github.com/repos/baiy/Ctool/releases/latest" | jq ".tag_name" 17 | } 18 | package() { 19 | cd $pkgdir 20 | tar -xpf ${srcdir}/data.tar.gz 21 | } 22 | -------------------------------------------------------------------------------- /PRIVACY: -------------------------------------------------------------------------------- 1 | 隐私条款 2 | 3 | 感谢您使用我们的开源项目。本隐私条款旨在向您说明我们如何收集、使用、共享和保护您的个人数据。如果您有任何问题或疑虑,请随时与我们联系。 4 | 5 | 1. 收集的个人数据 6 | 7 | 当您使用我们的开源项目时,我们可能会收集一些您的个人数据,包括但不限于: 8 | 9 | - 您的 IP 地址 10 | - 您的浏览器类型和版本 11 | - 您的操作系统类型和版本 12 | - 您访问我们的网站的日期和时间 13 | - 您使用我们的开源项目的日期和时间 14 | - 您的设备信息 15 | - 其他相关数据 16 | 17 | 我们收集这些个人数据的目的是为了更好地了解我们的用户,并提供更好的服务和体验。 18 | 19 | 2. 使用个人数据 20 | 21 | 我们仅会将您的个人数据用于以下用途: 22 | 23 | - 提供和维护我们的开源项目 24 | - 提供和改善我们的服务和体验 25 | - 分析数据和用户行为以改进我们的开源项目 26 | - 向您发送有关我们的开源项目和服务的通知和更新 27 | - 遵守法律法规和监管要求 28 | 29 | 我们不会将您的个人数据出售给任何第三方。我们会尽最大努力保护您的个人数据,但无法保证数据的绝对安全。 30 | 31 | 3. 数据共享 32 | 33 | 我们可能会与第三方共享您的个人数据,包括但不限于: 34 | 35 | - 为了提供服务和体验而向我们的服务提供商和合作伙伴提供数据 36 | - 遵守法律法规和监管要求 37 | - 其他相关事宜 38 | 39 | 我们会尽最大努力保护您的个人数据,并与第三方签订保密协议以确保他们也会尽力保护您的个人数据。 40 | 41 | 4. Cookie 和 跟踪技术 42 | 43 | 我们可能会使用 Cookie 和其他跟踪技术来收集和存储您的个人数据,以提供更好的服务和体验。 44 | 您可以选择在浏览器中禁用 Cookie,但这可能会影响您对我们开源项目的使用。 45 | 46 | 5. 第三方链接 47 | 48 | 我们的开源项目可能包含指向第三方网站的链接。我们无法控制这些网站的隐私政策和做法,因此不承担任何责任或义务。 49 | 50 | 6. 隐私权政策的变更 51 | 52 | 我们可能会随时更改本隐私条 53 | -------------------------------------------------------------------------------- /clear.cjs: -------------------------------------------------------------------------------- 1 | const { resolve } = require("path"); 2 | const { rmSync } = require("fs"); 3 | 4 | 5 | const lists = [ 6 | "packages/ctool-adapter/base", 7 | "packages/ctool-adapter/chrome", 8 | "packages/ctool-adapter/edge", 9 | "packages/ctool-adapter/electron", 10 | "packages/ctool-adapter/firefox", 11 | "packages/ctool-adapter/tauri", 12 | "packages/ctool-adapter/utools", 13 | "packages/ctool-adapter/web", 14 | "packages/ctool-config", 15 | "packages/ctool-core", 16 | "packages/ctool-site", 17 | ]; 18 | 19 | lists.forEach(item => { 20 | const removePath = resolve(__dirname, `${item}/dist/`); 21 | console.log(removePath) 22 | rmSync(removePath, { recursive: true, force: true }); 23 | }); 24 | -------------------------------------------------------------------------------- /dependence.sh: -------------------------------------------------------------------------------- 1 | pnpm -r update @types/lodash @vitejs/plugin-vue vite vue vue-tsc lodash @vue/runtime-core @types/node typescript tsup 2 | -------------------------------------------------------------------------------- /images/v1_1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baiy/Ctool/d1088f9dc31bbf71106acb0858a64941aec48da3/images/v1_1.jpg -------------------------------------------------------------------------------- /images/v2.0.0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baiy/Ctool/d1088f9dc31bbf71106acb0858a64941aec48da3/images/v2.0.0.png -------------------------------------------------------------------------------- /images/v2_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baiy/Ctool/d1088f9dc31bbf71106acb0858a64941aec48da3/images/v2_1.png -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ctool", 3 | "version": "2.3.0", 4 | "type": "module", 5 | "description": "程序开发常用工具 chrome / edge / firefox / utools / windows / linux / mac", 6 | "homepage": "https://ctool.dev", 7 | "repository": "https://github.com/baiy/Ctool", 8 | "author": "baiy", 9 | "license": "MIT", 10 | "scripts": { 11 | "initialize": "pnpm --filter ctool-config run build && pnpm --filter ctool-adapter-base run build && pnpm -r run adapter-build", 12 | "check": "pnpm run initialize && pnpm --filter ctool-core run check", 13 | "dev": "pnpm run initialize && pnpm --filter ctool-core run dev", 14 | "build": "pnpm run initialize && pnpm --filter ctool-core run build", 15 | "release": "node release.cjs && pnpm run build && pnpm -r run platform-release", 16 | "only-release": "node release.cjs && pnpm -r run platform-release", 17 | "vercel-build": "pnpm run build && pnpm --filter ctool-site run build", 18 | "clear": "node clear.cjs" 19 | }, 20 | "pnpm": { 21 | "peerDependencyRules": { 22 | "ignoreMissing": [ 23 | "buffer" 24 | ] 25 | } 26 | }, 27 | "devDependencies": { 28 | "@types/http-proxy": "^1.17.10", 29 | "@types/node": "^20.6.2", 30 | "@vercel/node": "^2.9.12", 31 | "typescript": "^5.2.2" 32 | }, 33 | "dependencies": { 34 | "ctool-config": "workspace:*", 35 | "http-proxy": "^1.18.1" 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/ctool-adapter/base/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | 26 | _temp 27 | -------------------------------------------------------------------------------- /packages/ctool-adapter/base/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ctool-adapter-base", 3 | "main": "./dist/index.js", 4 | "types": "./dist/index.d.ts", 5 | "scripts": { 6 | "build": "pnpm exec tsup-node" 7 | }, 8 | "devDependencies": { 9 | "@types/node": "^20.6.2", 10 | "tsup": "^7.2.0", 11 | "typescript": "^5.2.2" 12 | }, 13 | "dependencies": { 14 | "zip-a-folder": "^1.1.5" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /packages/ctool-adapter/base/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "module": "ESNext", 6 | "moduleResolution": "node", 7 | "strict": true, 8 | "jsx": "preserve", 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "isolatedModules": true, 12 | "esModuleInterop": true, 13 | "noImplicitAny": false, 14 | "lib": [ 15 | "ESNext", 16 | "DOM" 17 | ], 18 | "skipLibCheck": true, 19 | "types": [ 20 | "node" 21 | ], 22 | "paths": { 23 | "@/*": [ 24 | "./src/*" 25 | ] 26 | } 27 | }, 28 | "include": [ 29 | "src/**/*.ts" 30 | ] 31 | } 32 | 33 | -------------------------------------------------------------------------------- /packages/ctool-adapter/base/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import {defineConfig} from "tsup"; 2 | 3 | export default defineConfig({ 4 | entry: ["./src/index.ts"], 5 | outDir: "./dist/", 6 | legacyOutput: true, 7 | format: ["cjs"], 8 | platform: "node", 9 | target: "node16", 10 | splitting: false, 11 | dts: true, 12 | clean: true, 13 | }); 14 | -------------------------------------------------------------------------------- /packages/ctool-adapter/chrome/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | 26 | _temp 27 | -------------------------------------------------------------------------------- /packages/ctool-adapter/chrome/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ctool-adapter-chrome", 3 | "main": "./dist/index.js", 4 | "module": "./dist/esm/index.js", 5 | "types": "./dist/index.d.ts", 6 | "scripts": { 7 | "build": "pnpm exec tsup-node", 8 | "release": "node dist/release.js", 9 | "adapter-build": "pnpm run build", 10 | "platform-release": "pnpm run release" 11 | }, 12 | "dependencies": { 13 | "ctool-adapter-base": "workspace:*", 14 | "ctool-config": "workspace:*" 15 | }, 16 | "devDependencies": { 17 | "@types/chrome": "^0.0.193", 18 | "@types/node": "^20.6.2", 19 | "tsup": "^7.2.0", 20 | "typescript": "^5.2.2" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/ctool-adapter/chrome/resources/_locales/en/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "main_manifest_name": { 3 | "message": "Ctool Commonly Used Software Development Tools" 4 | }, 5 | "main_manifest_description": { 6 | "message": "Commonly Used Software Development Tools: Hash/Encrypt/Decrypt/Code Convert/Timestamp/Qrcode/IP Query/Code Formatter/Unicode/Regex/..." 7 | }, 8 | "main_manifest_default_title": { 9 | "message": "Commonly Used Software Development Tools" 10 | }, 11 | "main_manifest_commands_panel_description": { 12 | "message": "Open Popup Tool Windows" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/ctool-adapter/chrome/resources/_locales/zh_CN/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "main_manifest_name": { 3 | "message": "Ctool 程序开发常用工具" 4 | }, 5 | "main_manifest_description": { 6 | "message": "程序开发常用工具,哈希/加解密/编码转换/时间戳/二维码/拼音/IP查询/代码优化/Unicode/正则等..." 7 | }, 8 | "main_manifest_default_title": { 9 | "message": "常用开发工具" 10 | }, 11 | "main_manifest_commands_panel_description": { 12 | "message": "打开独立工具窗口" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/ctool-adapter/chrome/resources/background.js: -------------------------------------------------------------------------------- 1 | let windowId = null; 2 | // 打开独立窗口 3 | const panel = { 4 | create() { 5 | chrome.windows.create({ 6 | url: chrome.runtime.getURL("tool.html"), 7 | type: "popup", 8 | width: 810, 9 | left: 200, 10 | top: 200, 11 | height: 610, 12 | }, (w) => { 13 | windowId = w.id 14 | }) 15 | }, 16 | open() { 17 | if (windowId === null) { 18 | this.create() 19 | } else { 20 | chrome.windows.get(windowId, (w) => { 21 | if (!w) { 22 | this.create() 23 | } else { 24 | chrome.windows.update(windowId, {focused: true}) 25 | } 26 | }) 27 | } 28 | 29 | }, 30 | onRemoved(id) { 31 | if (id === windowId) { 32 | windowId = null; 33 | } 34 | } 35 | } 36 | 37 | // 注册快捷键 38 | chrome.commands.onCommand.addListener((command) => { 39 | switch (command) { 40 | case "panel": 41 | panel.open() 42 | 43 | break; 44 | default: 45 | return; 46 | } 47 | }) 48 | 49 | // 窗口关闭事件 50 | chrome.windows.onRemoved.addListener((id) => { 51 | panel.onRemoved(id); 52 | }) 53 | -------------------------------------------------------------------------------- /packages/ctool-adapter/chrome/resources/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "__MSG_main_manifest_name__", 3 | "description": "__MSG_main_manifest_description__", 4 | "version": "##version##", 5 | "author": "wo@baiy.org", 6 | "offline_enabled": true, 7 | "homepage_url": "https://github.com/baiy/Ctool", 8 | "manifest_version": 2, 9 | "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", 10 | "browser_action": { 11 | "default_icon": "icon/icon_chrome.png", 12 | "default_title": "__MSG_main_manifest_default_title__", 13 | "default_popup": "index.html" 14 | }, 15 | "default_locale": "zh_CN", 16 | "background": { 17 | "scripts": ["background.js"] 18 | }, 19 | "icons": { 20 | "16": "icon/icon_chrome.png", 21 | "48": "icon/icon_chrome.png", 22 | "128": "icon/icon_chrome.png" 23 | }, 24 | "permissions": [ 25 | "clipboardWrite", 26 | "clipboardRead", 27 | "##permissions##", 28 | "*://*.baiy.org/*", 29 | "*://ctool.dev/*", 30 | "*://*.ctool.dev/*" 31 | ], 32 | "commands": { 33 | "panel": { 34 | "description": "__MSG_main_manifest_commands_panel_description__", 35 | "global": true 36 | } 37 | }, 38 | "update_url": "http://clients2.google.com/service/update2/crx" 39 | } 40 | -------------------------------------------------------------------------------- /packages/ctool-adapter/chrome/resources/manifest_v3.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "__MSG_main_manifest_name__", 3 | "description": "__MSG_main_manifest_description__", 4 | "version": "##version##", 5 | "author": "wo@baiy.org", 6 | "offline_enabled": true, 7 | "homepage_url": "https://github.com/baiy/Ctool", 8 | "manifest_version": 3, 9 | "default_locale": "zh_CN", 10 | "action": { 11 | "default_icon": "icon/icon_chrome.png", 12 | "default_title": "___MSG_main_manifest_default_title__", 13 | "default_popup": "index.html" 14 | }, 15 | "background": { 16 | "service_worker": "background.js" 17 | }, 18 | "icons": { 19 | "16": "icon/icon_chrome.png", 20 | "48": "icon/icon_chrome.png", 21 | "128": "icon/icon_chrome.png" 22 | }, 23 | "permissions": [ 24 | "clipboardWrite", 25 | "clipboardRead" 26 | ], 27 | "host_permissions": [ 28 | "*://get.geojs.io/*", 29 | "*://api.jdoodle.com/*", 30 | "*://*.baiy.org/*" 31 | ], 32 | "commands": { 33 | "_execute_action": {}, 34 | "panel": { 35 | "description": "__MSG_main_manifest_commands_panel_description__", 36 | "global": true 37 | } 38 | }, 39 | "update_url": "http://clients2.google.com/service/update2/crx" 40 | } 41 | -------------------------------------------------------------------------------- /packages/ctool-adapter/chrome/src/index.ts: -------------------------------------------------------------------------------- 1 | import {PlatformRuntime} from "ctool-config"; 2 | 3 | export const runtime = new (class implements PlatformRuntime { 4 | name = "chrome" 5 | 6 | is() { 7 | if (navigator.userAgent.includes("Edg")) { 8 | return false 9 | } 10 | return navigator.userAgent.includes("Chrome") && !!window.chrome?.tabs; 11 | } 12 | 13 | openUrl(url: string) { 14 | return chrome.tabs.create({url: url}); 15 | } 16 | 17 | getLocale() { 18 | return chrome.i18n.getUILanguage() || "" 19 | } 20 | }) 21 | -------------------------------------------------------------------------------- /packages/ctool-adapter/chrome/src/release.ts: -------------------------------------------------------------------------------- 1 | import {copyCoreDist, release, replaceFileContent, version} from "ctool-adapter-base"; 2 | import {proxy} from "ctool-config"; 3 | import {cpSync, mkdirSync, rmSync} from "fs"; 4 | import {join} from "path"; 5 | 6 | (async () => { 7 | const tempPath = join(__dirname, '../_temp') 8 | rmSync(tempPath, {recursive: true, force: true}); 9 | mkdirSync(tempPath); 10 | 11 | // 核心文件 12 | copyCoreDist(tempPath) 13 | // 平台文件 14 | cpSync(join(__dirname, '../resources'), tempPath, {recursive: true}) 15 | // 写入版本号 16 | replaceFileContent(join(tempPath, 'manifest.json'), '##version##', version()) 17 | // 写入权限字符串 18 | const permissions = proxy.getManifestPermissions() 19 | replaceFileContent( 20 | join(tempPath, 'manifest.json'), 21 | '"##permissions##",', 22 | permissions.length === 0 ? "" : `"${permissions.join('",\n"')}",\n` 23 | ) 24 | // 发布 25 | console.info(`chrome: ${await release(tempPath, 'chrome')}`) 26 | // 移除临时目录 27 | rmSync(tempPath, {recursive: true, force: true}); 28 | })() 29 | -------------------------------------------------------------------------------- /packages/ctool-adapter/chrome/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "module": "ESNext", 6 | "moduleResolution": "node", 7 | "strict": true, 8 | "jsx": "preserve", 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "isolatedModules": true, 12 | "esModuleInterop": true, 13 | "noImplicitAny": false, 14 | "lib": [ 15 | "ESNext", 16 | "DOM" 17 | ], 18 | "skipLibCheck": true, 19 | "types": [ 20 | "node", 21 | "chrome" 22 | ], 23 | "paths": { 24 | "@/*": [ 25 | "./src/*" 26 | ] 27 | } 28 | }, 29 | "include": [ 30 | "src/**/*.ts" 31 | ] 32 | } 33 | 34 | 35 | -------------------------------------------------------------------------------- /packages/ctool-adapter/chrome/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import {defineConfig} from "tsup"; 2 | 3 | export default defineConfig({ 4 | entry: ["./src/index.ts", "./src/release.ts"], 5 | outDir: "./dist/", 6 | legacyOutput: true, 7 | format: ["cjs", "esm"], 8 | platform: "node", 9 | target: "node16", 10 | splitting: false, 11 | dts: true, 12 | clean: true, 13 | }); 14 | -------------------------------------------------------------------------------- /packages/ctool-adapter/edge/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | 26 | _temp 27 | -------------------------------------------------------------------------------- /packages/ctool-adapter/edge/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ctool-adapter-edge", 3 | "main": "./dist/index.js", 4 | "module": "./dist/esm/index.js", 5 | "types": "./dist/index.d.ts", 6 | "scripts": { 7 | "build": "pnpm exec tsup-node", 8 | "release": "node dist/release.js", 9 | "adapter-build": "pnpm run build", 10 | "platform-release": "pnpm run release" 11 | }, 12 | "dependencies": { 13 | "ctool-adapter-base": "workspace:*", 14 | "ctool-config": "workspace:*" 15 | }, 16 | "devDependencies": { 17 | "@types/chrome": "^0.0.193", 18 | "@types/node": "^20.6.2", 19 | "tsup": "^7.2.0", 20 | "typescript": "^5.2.2" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/ctool-adapter/edge/resources/_locales/en/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "main_manifest_name": { 3 | "message": "Ctool Commonly Used Software Development Tools" 4 | }, 5 | "main_manifest_description": { 6 | "message": "Commonly Used Software Development Tools: Hash/Encrypt/Decrypt/Code Convert/Timestamp/Qrcode/IP Query/Code Formatter/Unicode/Regex/..." 7 | }, 8 | "main_manifest_default_title": { 9 | "message": "Commonly Used Software Development Tools" 10 | }, 11 | "main_manifest_commands_panel_description": { 12 | "message": "Open Popup Tool Windows" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/ctool-adapter/edge/resources/_locales/zh_CN/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "main_manifest_name": { 3 | "message": "Ctool 程序开发常用工具" 4 | }, 5 | "main_manifest_description": { 6 | "message": "程序开发常用工具,哈希/加解密/编码转换/时间戳/二维码/拼音/IP查询/代码优化/Unicode/正则等..." 7 | }, 8 | "main_manifest_default_title": { 9 | "message": "常用开发工具" 10 | }, 11 | "main_manifest_commands_panel_description": { 12 | "message": "打开独立工具窗口" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/ctool-adapter/edge/resources/background.js: -------------------------------------------------------------------------------- 1 | let windowId = null; 2 | // 打开独立窗口 3 | const panel = { 4 | create() { 5 | chrome.windows.create({ 6 | url: chrome.runtime.getURL("tool.html"), 7 | type: "popup", 8 | width: 810, 9 | left: 200, 10 | top: 200, 11 | height: 610, 12 | }, (w) => { 13 | windowId = w.id 14 | }) 15 | }, 16 | open() { 17 | if (windowId === null) { 18 | this.create() 19 | } else { 20 | chrome.windows.get(windowId, (w) => { 21 | if (!w) { 22 | this.create() 23 | } else { 24 | chrome.windows.update(windowId, {focused: true}) 25 | } 26 | }) 27 | } 28 | 29 | }, 30 | onRemoved(id) { 31 | if (id === windowId) { 32 | windowId = null; 33 | } 34 | } 35 | } 36 | 37 | // 注册快捷键 38 | chrome.commands.onCommand.addListener((command) => { 39 | switch (command) { 40 | case "panel": 41 | panel.open() 42 | 43 | break; 44 | default: 45 | return; 46 | } 47 | }) 48 | 49 | // 窗口关闭事件 50 | chrome.windows.onRemoved.addListener((id) => { 51 | panel.onRemoved(id); 52 | }) 53 | -------------------------------------------------------------------------------- /packages/ctool-adapter/edge/resources/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "__MSG_main_manifest_name__", 3 | "description": "__MSG_main_manifest_description__", 4 | "version": "##version##", 5 | "author": "wo@baiy.org", 6 | "offline_enabled": true, 7 | "homepage_url": "https://github.com/baiy/Ctool", 8 | "manifest_version": 2, 9 | "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", 10 | "browser_action": { 11 | "default_icon": "icon/icon_chrome.png", 12 | "default_title": "__MSG_main_manifest_default_title__", 13 | "default_popup": "index.html" 14 | }, 15 | "default_locale": "zh_CN", 16 | "background": { 17 | "scripts": ["background.js"] 18 | }, 19 | "icons": { 20 | "16": "icon/icon_chrome.png", 21 | "48": "icon/icon_chrome.png", 22 | "128": "icon/icon_chrome.png" 23 | }, 24 | "permissions": [ 25 | "clipboardWrite", 26 | "clipboardRead", 27 | "##permissions##", 28 | "*://*.baiy.org/*", 29 | "*://ctool.dev/*", 30 | "*://*.ctool.dev/*" 31 | ], 32 | "commands": { 33 | "panel": { 34 | "description": "__MSG_main_manifest_commands_panel_description__", 35 | "global": true 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /packages/ctool-adapter/edge/src/index.ts: -------------------------------------------------------------------------------- 1 | import {PlatformRuntime} from "ctool-config"; 2 | 3 | export const runtime = new (class implements PlatformRuntime { 4 | name = "edge" 5 | 6 | is() { 7 | return navigator.userAgent.includes("Edg") && !!window.chrome?.tabs; 8 | } 9 | 10 | openUrl(url: string) { 11 | return chrome.tabs.create({url: url}); 12 | } 13 | 14 | getLocale() { 15 | return chrome.i18n.getUILanguage() || "" 16 | } 17 | }) 18 | -------------------------------------------------------------------------------- /packages/ctool-adapter/edge/src/release.ts: -------------------------------------------------------------------------------- 1 | import {copyCoreDist, release, replaceFileContent, version} from "ctool-adapter-base"; 2 | import {proxy} from "ctool-config"; 3 | import {cpSync, mkdirSync, rmSync} from "fs"; 4 | import {join} from "path"; 5 | 6 | (async () => { 7 | const tempPath = join(__dirname, '../_temp') 8 | rmSync(tempPath, {recursive: true, force: true}); 9 | mkdirSync(tempPath); 10 | 11 | // 核心文件 12 | copyCoreDist(tempPath) 13 | // 平台文件 14 | cpSync(join(__dirname, '../resources'), tempPath, {recursive: true}) 15 | // 写入版本号 16 | replaceFileContent(join(tempPath, 'manifest.json'), '##version##', version()) 17 | // 写入权限字符串 18 | const permissions = proxy.getManifestPermissions() 19 | replaceFileContent( 20 | join(tempPath, 'manifest.json'), 21 | '"##permissions##",', 22 | permissions.length === 0 ? "" : `"${permissions.join('",\n"')}",\n` 23 | ) 24 | // 发布 25 | console.info(`edge: ${await release(tempPath, 'edge')}`) 26 | // 移除临时目录 27 | rmSync(tempPath, {recursive: true, force: true}); 28 | })() 29 | -------------------------------------------------------------------------------- /packages/ctool-adapter/edge/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "module": "ESNext", 6 | "moduleResolution": "node", 7 | "strict": true, 8 | "jsx": "preserve", 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "isolatedModules": true, 12 | "esModuleInterop": true, 13 | "noImplicitAny": false, 14 | "lib": [ 15 | "ESNext", 16 | "DOM" 17 | ], 18 | "skipLibCheck": true, 19 | "types": [ 20 | "node", 21 | "chrome" 22 | ], 23 | "paths": { 24 | "@/*": [ 25 | "./src/*" 26 | ] 27 | } 28 | }, 29 | "include": [ 30 | "src/**/*.ts" 31 | ] 32 | } 33 | 34 | 35 | -------------------------------------------------------------------------------- /packages/ctool-adapter/edge/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import {defineConfig} from "tsup"; 2 | 3 | export default defineConfig({ 4 | entry: ["./src/index.ts", "./src/release.ts"], 5 | outDir: "./dist/", 6 | legacyOutput: true, 7 | format: ["cjs", "esm"], 8 | platform: "node", 9 | target: "node16", 10 | splitting: false, 11 | dts: true, 12 | clean: true, 13 | }); 14 | -------------------------------------------------------------------------------- /packages/ctool-adapter/firefox/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | 26 | _temp 27 | -------------------------------------------------------------------------------- /packages/ctool-adapter/firefox/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ctool-adapter-firefox", 3 | "main": "./dist/index.js", 4 | "module": "./dist/esm/index.js", 5 | "types": "./dist/index.d.ts", 6 | "scripts": { 7 | "build": "pnpm exec tsup-node", 8 | "release": "node dist/release.js", 9 | "adapter-build": "pnpm run build", 10 | "platform-release": "pnpm run release" 11 | }, 12 | "dependencies": { 13 | "ctool-adapter-base": "workspace:*", 14 | "ctool-config": "workspace:*" 15 | }, 16 | "devDependencies": { 17 | "@types/firefox-webext-browser": "^94.0.1", 18 | "@types/node": "^20.6.2", 19 | "tsup": "^7.2.0", 20 | "typescript": "^5.2.2" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/ctool-adapter/firefox/resources/_locales/en/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "main_manifest_name": { 3 | "message": "Ctool Commonly Used Software Development Tools" 4 | }, 5 | "main_manifest_description": { 6 | "message": "Commonly Used Software Development Tools: Hash/Encrypt/Decrypt/Code Convert/Timestamp/Qrcode/IP Query/Code Formatter/Unicode/Regex/..." 7 | }, 8 | "main_manifest_default_title": { 9 | "message": "Commonly Used Software Development Tools" 10 | }, 11 | "main_manifest_commands_panel_description": { 12 | "message": "Open Popup Tool Windows" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/ctool-adapter/firefox/resources/_locales/zh_CN/messages.json: -------------------------------------------------------------------------------- 1 | { 2 | "main_manifest_name": { 3 | "message": "Ctool 程序开发常用工具" 4 | }, 5 | "main_manifest_description": { 6 | "message": "程序开发常用工具,哈希/加解密/编码转换/时间戳/二维码/拼音/IP查询/代码优化/Unicode/正则等..." 7 | }, 8 | "main_manifest_default_title": { 9 | "message": "常用开发工具" 10 | }, 11 | "main_manifest_commands_panel_description": { 12 | "message": "打开独立工具窗口" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/ctool-adapter/firefox/resources/background.js: -------------------------------------------------------------------------------- 1 | let windowId = null; 2 | // 打开独立窗口 3 | const panel = { 4 | create() { 5 | browser.windows.create({ 6 | url: browser.runtime.getURL("tool.html"), 7 | type: "popup", 8 | }, (w) => { 9 | browser.windows.update(w.id, { 10 | width: 810, 11 | height: 610 12 | }); 13 | windowId = w.id 14 | }) 15 | }, 16 | open() { 17 | if (windowId === null) { 18 | this.create() 19 | } else { 20 | browser.windows.get(windowId, (w) => { 21 | if (!w) { 22 | this.create() 23 | } else { 24 | browser.windows.update(windowId, {focused: true}) 25 | } 26 | }) 27 | } 28 | 29 | }, 30 | onRemoved(id) { 31 | if (id === windowId) { 32 | windowId = null; 33 | } 34 | } 35 | } 36 | 37 | // 注册快捷键 38 | browser.commands.onCommand.addListener((command) => { 39 | switch (command) { 40 | case "panel": 41 | panel.open() 42 | break; 43 | default: 44 | return; 45 | } 46 | }) 47 | 48 | // 窗口关闭事件 49 | browser.windows.onRemoved.addListener((id) => { 50 | panel.onRemoved(id); 51 | }) 52 | -------------------------------------------------------------------------------- /packages/ctool-adapter/firefox/resources/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "__MSG_main_manifest_name__", 3 | "description": "__MSG_main_manifest_description__", 4 | "version": "##version##", 5 | "author": "wo@baiy.org", 6 | "homepage_url": "https://github.com/baiy/Ctool", 7 | "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", 8 | "manifest_version": 2, 9 | "browser_action": { 10 | "default_icon": "icon/icon_chrome.png", 11 | "default_title": "__MSG_main_manifest_default_title__", 12 | "default_popup": "index.html" 13 | }, 14 | "default_locale": "zh_CN", 15 | "background": { 16 | "scripts": ["background.js"] 17 | }, 18 | "icons": { 19 | "16": "icon/icon_chrome.png", 20 | "48": "icon/icon_chrome.png", 21 | "128": "icon/icon_chrome.png" 22 | }, 23 | "permissions": [ 24 | "clipboardWrite", 25 | "clipboardRead", 26 | "##permissions##", 27 | "*://*.baiy.org/*", 28 | "*://ctool.dev/*", 29 | "*://*.ctool.dev/*" 30 | ], 31 | "commands": { 32 | "_execute_browser_action": {}, 33 | "panel": { 34 | "description": "__MSG_main_manifest_commands_panel_description__" 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /packages/ctool-adapter/firefox/src/index.ts: -------------------------------------------------------------------------------- 1 | import {PlatformRuntime} from "ctool-config"; 2 | 3 | export const runtime = new (class implements PlatformRuntime { 4 | name = "firefox" 5 | 6 | is() { 7 | return navigator.userAgent.includes("Firefox") && !!window.browser?.tabs; 8 | } 9 | 10 | openUrl(url: string) { 11 | return browser.tabs.create({url: url}); 12 | } 13 | 14 | getLocale() { 15 | return browser.i18n.getUILanguage() || "" 16 | } 17 | }) 18 | -------------------------------------------------------------------------------- /packages/ctool-adapter/firefox/src/release.ts: -------------------------------------------------------------------------------- 1 | import {copyCoreDist, release, replaceFileContent, version} from "ctool-adapter-base"; 2 | import {proxy} from "ctool-config"; 3 | import {cpSync, mkdirSync, rmSync} from "fs"; 4 | import {join} from "path"; 5 | 6 | (async () => { 7 | const tempPath = join(__dirname, '../_temp') 8 | rmSync(tempPath, {recursive: true, force: true}); 9 | mkdirSync(tempPath); 10 | 11 | // 核心文件 12 | copyCoreDist(tempPath) 13 | // 平台文件 14 | cpSync(join(__dirname, '../resources'), tempPath, {recursive: true}) 15 | // 写入版本号 16 | replaceFileContent(join(tempPath, 'manifest.json'), '##version##', version()) 17 | // 写入权限字符串 18 | const permissions = proxy.getManifestPermissions() 19 | replaceFileContent( 20 | join(tempPath, 'manifest.json'), 21 | '"##permissions##",', 22 | permissions.length === 0 ? "" : `"${permissions.join('",\n"')}",\n` 23 | ) 24 | // 发布 25 | console.info(`firefox: ${await release(tempPath, 'firefox')}`) 26 | // 移除临时目录 27 | rmSync(tempPath, {recursive: true, force: true}); 28 | })() 29 | -------------------------------------------------------------------------------- /packages/ctool-adapter/firefox/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "module": "ESNext", 6 | "moduleResolution": "node", 7 | "strict": true, 8 | "jsx": "preserve", 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "isolatedModules": true, 12 | "esModuleInterop": true, 13 | "noImplicitAny": false, 14 | "lib": [ 15 | "ESNext", 16 | "DOM" 17 | ], 18 | "skipLibCheck": true, 19 | "types": [ 20 | "node", 21 | "firefox-webext-browser" 22 | ], 23 | "paths": { 24 | "@/*": [ 25 | "./src/*" 26 | ] 27 | } 28 | }, 29 | "include": [ 30 | "src/**/*.ts" 31 | ] 32 | } 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /packages/ctool-adapter/firefox/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import {defineConfig} from "tsup"; 2 | 3 | export default defineConfig({ 4 | entry: ["./src/index.ts", "./src/release.ts"], 5 | outDir: "./dist/", 6 | legacyOutput: true, 7 | format: ["cjs", "esm"], 8 | platform: "node", 9 | target: "node16", 10 | splitting: false, 11 | dts: true, 12 | clean: true, 13 | }); 14 | -------------------------------------------------------------------------------- /packages/ctool-adapter/tauri/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | 26 | _temp 27 | -------------------------------------------------------------------------------- /packages/ctool-adapter/tauri/.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": ["tauri-apps.tauri-vscode", "rust-lang.rust-analyzer"] 3 | } 4 | -------------------------------------------------------------------------------- /packages/ctool-adapter/tauri/README.md: -------------------------------------------------------------------------------- 1 | # Tauri + Vanilla 2 | 3 | This template should help get you started developing with Tauri in vanilla HTML, CSS and Javascript. 4 | 5 | ## Recommended IDE Setup 6 | 7 | - [VS Code](https://code.visualstudio.com/) + [Tauri](https://marketplace.visualstudio.com/items?itemName=tauri-apps.tauri-vscode) + [rust-analyzer](https://marketplace.visualstudio.com/items?itemName=rust-lang.rust-analyzer) 8 | -------------------------------------------------------------------------------- /packages/ctool-adapter/tauri/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ctool 6 | 7 | 8 | 9 | 21 | 22 | 23 |
24 | Loading... 25 |
26 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /packages/ctool-adapter/tauri/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ctool-adapter-tauri", 3 | "main": "./dist/index.js", 4 | "module": "./dist/esm/index.js", 5 | "types": "./dist/index.d.ts", 6 | "scripts": { 7 | "build": "pnpm exec tsup-node", 8 | "init": "node ./dist/init.js && pnpm tauri icon ./dist/web/icon/icon_1024.png", 9 | "dev": "pnpm run build && pnpm run init && pnpm tauri dev", 10 | "release": "pnpm run init && pnpm tauri build && node ./dist/release.js", 11 | "adapter-build": "pnpm run build", 12 | "platform-release": "pnpm run release" 13 | }, 14 | "dependencies": { 15 | "@tauri-apps/api": "^1.4.0", 16 | "ctool-adapter-base": "workspace:*", 17 | "ctool-config": "workspace:*" 18 | }, 19 | "devDependencies": { 20 | "@tauri-apps/cli": "^1.4.0", 21 | "@types/node": "^20.6.2", 22 | "tsup": "^7.2.0", 23 | "typescript": "^5.2.2" 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /packages/ctool-adapter/tauri/src-tauri/.gitignore: -------------------------------------------------------------------------------- 1 | # Generated by Cargo 2 | # will have compiled files and executables 3 | /target/ 4 | /icons/ 5 | tauri.conf.json5 6 | -------------------------------------------------------------------------------- /packages/ctool-adapter/tauri/src-tauri/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "tauri-app" 3 | version = "0.0.0" 4 | description = "A Tauri App" 5 | authors = ["you"] 6 | license = "" 7 | repository = "" 8 | edition = "2021" 9 | rust-version = "1.57" 10 | 11 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 12 | 13 | [build-dependencies] 14 | tauri-build = { version = "1.4", features = ["config-json5"] } 15 | 16 | [dependencies] 17 | serde_json = "1.0" 18 | serde = { version = "1.0", features = ["derive"] } 19 | tauri = { version = "1.4", features = ["api-all", "config-json5", "devtools"] } 20 | reqwest = { version = "0.11", features = ["blocking"] } 21 | dirs = "5.0" 22 | 23 | [features] 24 | # by default Tauri runs in production mode 25 | # when `tauri dev` runs it is executed with `cargo run --no-default-features` if `devPath` is an URL 26 | default = ["custom-protocol"] 27 | # this feature is used used for production builds where `devPath` points to the filesystem 28 | # DO NOT remove this 29 | custom-protocol = ["tauri/custom-protocol"] 30 | -------------------------------------------------------------------------------- /packages/ctool-adapter/tauri/src-tauri/build.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | tauri_build::build() 3 | } 4 | -------------------------------------------------------------------------------- /packages/ctool-adapter/tauri/src/index.ts: -------------------------------------------------------------------------------- 1 | import {PlatformRuntime} from "ctool-config"; 2 | 3 | declare global { 4 | interface Window { 5 | __TAURI__: { 6 | shell: { 7 | open: (url: string) => void 8 | }, 9 | invoke: (command: string, option?: Record) => any 10 | } 11 | } 12 | } 13 | 14 | export const runtime = new (class implements PlatformRuntime { 15 | name = "tauri" 16 | 17 | is() { 18 | return !!window['__TAURI__']; 19 | } 20 | 21 | openUrl(url: string) { 22 | return window.__TAURI__.shell.open(url); 23 | } 24 | 25 | // 开发工具操作 26 | toggleDevTools() { 27 | return window['__TAURI__'].invoke('toggle_dev_tools'); 28 | } 29 | }) 30 | -------------------------------------------------------------------------------- /packages/ctool-adapter/tauri/src/init.ts: -------------------------------------------------------------------------------- 1 | // 同步文件 2 | import {join} from "path"; 3 | import {copyCoreDist, version, getRootPackageJson} from "ctool-adapter-base"; 4 | import {mkdirSync, readFileSync, rmSync, writeFileSync} from "fs"; 5 | 6 | const tempPath = join(__dirname, 'web') 7 | rmSync(tempPath, {recursive: true, force: true}); 8 | mkdirSync(tempPath); 9 | 10 | // 核心文件 11 | copyCoreDist(tempPath) 12 | 13 | // 重写首页跳转文件 14 | writeFileSync(join(tempPath, 'index.html'), readFileSync(join(__dirname, '../index.html')).toString()) 15 | 16 | // 清理文件 17 | const configFilePath = join(__dirname, '../src-tauri/tauri.conf.json5') 18 | const iconsPath = join(__dirname, '../src-tauri/icons') 19 | const targetPath = join(__dirname, '../src-tauri/target') 20 | rmSync(configFilePath, {force: true}); 21 | rmSync(iconsPath, {recursive: true, force: true}); 22 | rmSync(targetPath, {recursive: true, force: true}); 23 | 24 | // 生成`tauri`配置文件 25 | const config = readFileSync(join(__dirname, '../src-tauri/tauri.conf.template.json5')).toString() 26 | .replace(new RegExp("##version##", 'g'), version()) 27 | .replace(new RegExp("##description##", 'g'), getRootPackageJson()['description']); 28 | writeFileSync(configFilePath, `// 程序自动生成 => ./tauri.conf.template.json5\n${config}`) 29 | -------------------------------------------------------------------------------- /packages/ctool-adapter/tauri/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "module": "ESNext", 6 | "moduleResolution": "node", 7 | "strict": true, 8 | "jsx": "preserve", 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "isolatedModules": true, 12 | "esModuleInterop": true, 13 | "noImplicitAny": false, 14 | "lib": [ 15 | "ESNext", 16 | "DOM" 17 | ], 18 | "skipLibCheck": true, 19 | "types": [ 20 | "node" 21 | ], 22 | "paths": { 23 | "@/*": [ 24 | "./src/*" 25 | ] 26 | } 27 | }, 28 | "include": [ 29 | "src/**/*.ts" 30 | ] 31 | } 32 | -------------------------------------------------------------------------------- /packages/ctool-adapter/tauri/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import {defineConfig} from "tsup"; 2 | 3 | export default defineConfig({ 4 | entry: [ 5 | "./src/index.ts", 6 | "./src/init.ts", 7 | "./src/release.ts", 8 | ], 9 | outDir: "./dist/", 10 | legacyOutput: true, 11 | format: ["cjs", "esm"], 12 | platform: "node", 13 | target: "node16", 14 | splitting: false, 15 | dts: true, 16 | clean: true, 17 | }); 18 | -------------------------------------------------------------------------------- /packages/ctool-adapter/utools/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | 26 | _temp 27 | -------------------------------------------------------------------------------- /packages/ctool-adapter/utools/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ctool-adapter-utools", 3 | "main": "./dist/index.js", 4 | "module": "./dist/esm/index.js", 5 | "types": "./dist/index.d.ts", 6 | "scripts": { 7 | "build": "pnpm exec tsup-node", 8 | "release": "node dist/release.js", 9 | "adapter-build": "pnpm run build", 10 | "platform-release": "pnpm run release" 11 | }, 12 | "dependencies": { 13 | "ctool-adapter-base": "workspace:*", 14 | "ctool-config": "workspace:*" 15 | }, 16 | "devDependencies": { 17 | "@types/node": "^20.6.2", 18 | "tsup": "^7.2.0", 19 | "typescript": "^5.2.2", 20 | "utools-api-types": "^3.0.0" 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /packages/ctool-adapter/utools/resources/plugin.json: -------------------------------------------------------------------------------- 1 | { 2 | "pluginName": "Ctool", 3 | "description": "Ctool 程序开发常用工具", 4 | "author": "baiy", 5 | "homepage": "https://github.com/baiy/Ctool", 6 | "main": "tool.html", 7 | "version": "##version##", 8 | "logo": "icon/icon_utools.png", 9 | "pluginSetting": { 10 | "single": false 11 | }, 12 | "development": { 13 | "main": "http://127.0.0.1:5173/tool.html" 14 | }, 15 | "features": "##features##" 16 | } 17 | -------------------------------------------------------------------------------- /packages/ctool-adapter/utools/src/config.ts: -------------------------------------------------------------------------------- 1 | import {FeatureInterface, getTool} from "ctool-config"; 2 | 3 | export type CustomCmd = { 4 | type: "regex" | "over" 5 | minLength?: number 6 | maxLength?: number 7 | match?: string 8 | label?: string 9 | } 10 | export const customCmds = new Map() 11 | 12 | customCmds.set( 13 | getTool('time').getFeature('timestamp'), 14 | [ 15 | { 16 | "type": "regex", 17 | "match": "/(^\\d{5,}$)|(^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}(?:\\.\\d{3})?$)/i", 18 | "minLength": 5, 19 | "maxLength": 25 20 | } 21 | ] 22 | ) 23 | 24 | customCmds.set( 25 | getTool('qrCode').getFeature('generate'), 26 | [ 27 | { 28 | "type": "over", 29 | "minLength": 10, 30 | } 31 | ] 32 | ) 33 | 34 | customCmds.set( 35 | getTool('ip').firstFeature(), 36 | [ 37 | { 38 | "type": "over", 39 | "match": "/\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}/i", 40 | "minLength": 7, 41 | "maxLength": 15 42 | } 43 | ] 44 | ) 45 | 46 | customCmds.set( 47 | getTool('unicode').getFeature('decoder'), 48 | [ 49 | { 50 | "type": "regex", 51 | "match": "/\\\\u[0-9a-f]{4}/i", 52 | "minLength": 6 53 | } 54 | ] 55 | ) 56 | 57 | -------------------------------------------------------------------------------- /packages/ctool-adapter/utools/src/storage.ts: -------------------------------------------------------------------------------- 1 | import {StorageDataStructure, StorageDataStructureInterface, StorageInterface} from "ctool-config"; 2 | 3 | const PREFIX = "_system_" 4 | 5 | const keyName = (key: string) => { 6 | return `${PREFIX}${key}` 7 | } 8 | 9 | class storage implements StorageInterface { 10 | get(key: string): StorageDataStructure { 11 | return window.utools.dbStorage.getItem(keyName(key)) || "" 12 | } 13 | 14 | set(key: string, value: StorageDataStructureInterface): void { 15 | window.utools.dbStorage.setItem(keyName(key), value) 16 | } 17 | 18 | remove(key: string): void { 19 | window.utools.dbStorage.removeItem(keyName(key)) 20 | } 21 | 22 | clear() { 23 | for (let key of this.getAllKey()) { 24 | this.remove(key) 25 | } 26 | } 27 | 28 | getAllKey(): string[] { 29 | return window.utools.db.allDocs(PREFIX).map(({_id}) => { 30 | return _id.replace(PREFIX, ""); 31 | }) 32 | } 33 | } 34 | 35 | export default new storage() 36 | -------------------------------------------------------------------------------- /packages/ctool-adapter/utools/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "module": "ESNext", 6 | "moduleResolution": "node", 7 | "strict": true, 8 | "jsx": "preserve", 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "isolatedModules": true, 12 | "esModuleInterop": true, 13 | "noImplicitAny": false, 14 | "lib": [ 15 | "ESNext", 16 | "DOM" 17 | ], 18 | "skipLibCheck": true, 19 | "types": [ 20 | "node", 21 | "utools-api-types" 22 | ], 23 | "paths": { 24 | "@/*": [ 25 | "./src/*" 26 | ] 27 | } 28 | }, 29 | "include": [ 30 | "src/**/*.ts" 31 | ] 32 | } 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /packages/ctool-adapter/utools/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import {defineConfig} from "tsup"; 2 | 3 | export default defineConfig({ 4 | entry: ["./src/index.ts", "./src/release.ts"], 5 | outDir: "./dist/", 6 | legacyOutput: true, 7 | format: ["cjs", "esm"], 8 | platform: "node", 9 | target: "node16", 10 | splitting: false, 11 | dts: true, 12 | clean: true, 13 | }); 14 | -------------------------------------------------------------------------------- /packages/ctool-adapter/web/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | 26 | _temp 27 | -------------------------------------------------------------------------------- /packages/ctool-adapter/web/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ctool-adapter-web", 3 | "scripts": { 4 | "build": "pnpm exec tsup-node", 5 | "release": "node dist/release.js", 6 | "adapter-build": "pnpm run build", 7 | "platform-release": "pnpm run release" 8 | }, 9 | "dependencies": { 10 | "ctool-adapter-base": "workspace:*" 11 | }, 12 | "devDependencies": { 13 | "@types/node": "^20.6.2", 14 | "tsup": "^7.2.0", 15 | "typescript": "^5.2.2" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /packages/ctool-adapter/web/src/release.ts: -------------------------------------------------------------------------------- 1 | import {copyCoreDist, release} from "ctool-adapter-base"; 2 | import {mkdirSync, rmSync} from "fs"; 3 | import {join} from "path"; 4 | 5 | 6 | (async () => { 7 | const tempPath = join(__dirname, '../_temp') 8 | rmSync(tempPath, {recursive: true, force: true}); 9 | mkdirSync(tempPath); 10 | // 核心文件 11 | copyCoreDist(tempPath) 12 | // 发布 13 | console.info(`web: ${await release(tempPath, 'web')}`) 14 | // 移除临时目录 15 | rmSync(tempPath, {recursive: true, force: true}); 16 | })() 17 | -------------------------------------------------------------------------------- /packages/ctool-adapter/web/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "module": "ESNext", 6 | "moduleResolution": "node", 7 | "strict": true, 8 | "jsx": "preserve", 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "isolatedModules": true, 12 | "esModuleInterop": true, 13 | "noImplicitAny": false, 14 | "lib": [ 15 | "ESNext", 16 | "DOM" 17 | ], 18 | "skipLibCheck": true, 19 | "types": [ 20 | "node" 21 | ], 22 | "paths": { 23 | "@/*": [ 24 | "./src/*" 25 | ] 26 | } 27 | }, 28 | "include": [ 29 | "src/**/*.ts" 30 | ] 31 | } 32 | 33 | 34 | 35 | -------------------------------------------------------------------------------- /packages/ctool-adapter/web/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import {defineConfig} from "tsup"; 2 | 3 | export default defineConfig({ 4 | entry: ["./src/release.ts"], 5 | outDir: "./dist/", 6 | legacyOutput: true, 7 | format: ["cjs"], 8 | platform: "node", 9 | target: "node16", 10 | splitting: false, 11 | clean: true, 12 | }); 13 | -------------------------------------------------------------------------------- /packages/ctool-config/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /packages/ctool-config/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ctool-config", 3 | "main": "./dist/index.js", 4 | "module": "./dist/esm/index.js", 5 | "types": "./dist/index.d.ts", 6 | "scripts": { 7 | "build": "pnpm exec tsup-node && node dist/generate.js" 8 | }, 9 | "dependencies": { 10 | "json5": "^2.2.3", 11 | "lodash": "^4.17.21", 12 | "pinyin-pro": "^3.13.0", 13 | "svg-path-bounds": "^1.0.2" 14 | }, 15 | "devDependencies": { 16 | "@types/lodash": "^4.14.198", 17 | "@types/node": "^20.6.2", 18 | "tsup": "^7.2.0", 19 | "typescript": "^5.2.2" 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /packages/ctool-config/src/category.ts: -------------------------------------------------------------------------------- 1 | import {ToolInterface, CategoryInterface, ToolType, CategoryType} from "./config" 2 | 3 | class Category implements CategoryInterface { 4 | private readonly _name: T; 5 | private _tools: ToolInterface[] = [] 6 | 7 | constructor(name: T) { 8 | this._name = name 9 | } 10 | 11 | get name() { 12 | return this._name; 13 | } 14 | 15 | get tools() { 16 | return this._tools 17 | } 18 | 19 | addTool(tool: ToolInterface) { 20 | this._tools.push(tool) 21 | tool.addCategory(this) 22 | } 23 | 24 | existTool(name: string) { 25 | return this.tools.map(item => item.name).includes(name) 26 | } 27 | 28 | firstTool() { 29 | return this._tools[0] 30 | } 31 | } 32 | 33 | export default Category 34 | -------------------------------------------------------------------------------- /packages/ctool-config/src/feature.ts: -------------------------------------------------------------------------------- 1 | import {ToolInterface, FeatureInterface, ToolType, FeatureType} from "./config" 2 | import {upperFirst} from "lodash"; 3 | 4 | export default class Feature implements FeatureInterface { 5 | private readonly _name: FeatureType 6 | private readonly _tool: ToolInterface 7 | 8 | constructor(tool: ToolInterface, name: FeatureType) { 9 | this._name = name 10 | this._tool = tool 11 | this._tool.addFeature(this) 12 | } 13 | 14 | get name() { 15 | return this._name; 16 | } 17 | 18 | get tool() { 19 | return this._tool; 20 | } 21 | 22 | getComponentPath() { 23 | return `${this.tool.root}/${upperFirst(this.name)}.vue` 24 | } 25 | 26 | getRouter() { 27 | return `/tool/${this.tool.directory}${this.tool.isSimple() ? '' : `/${this.name}`}` 28 | } 29 | 30 | getQuery(category: string = "", other: Record = {}) { 31 | if (!this.tool.inCategory(category)) { 32 | category = this.tool.firstCategory().name 33 | } 34 | return { 35 | category, 36 | ...other 37 | } 38 | } 39 | 40 | getKey() { 41 | return `${this.tool.name}-${this.name}` 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate.ts: -------------------------------------------------------------------------------- 1 | import {allLocales, buildI18n} from "./generate/i18n" 2 | import {buildRoute} from "./generate/router" 3 | import {buildKeywords} from "./generate/keyword" 4 | import {buildIcon} from "./generate/icon" 5 | import {buildAddition, buildData, buildType} from "./generate/fileSystem"; 6 | import {copyFileSync} from "fs"; 7 | import {join} from "path"; 8 | 9 | // 路由配置文件 10 | buildRoute(); 11 | 12 | // 语言包 13 | buildI18n() 14 | 15 | // 关键字 16 | buildKeywords() 17 | 18 | // icon 19 | buildIcon() 20 | 21 | // 工具信息 22 | buildAddition.add('i18n', allLocales) 23 | 24 | // 复制其他文件 25 | copyFileSync(join(__dirname, '../../../', 'README.md'), join(__dirname, '../../../packages/ctool-core/public', 'README.md')) 26 | copyFileSync(join(__dirname, '../../../', 'LICENSE'), join(__dirname, '../../../packages/ctool-core/public', 'LICENSE')) 27 | 28 | // 编译数据写入 29 | buildData.write() 30 | buildType.write() 31 | buildAddition.write() 32 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/ad.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | "M535.6544 110.1824L309.7088 264.96H161.1776C128.7168 264.96 102.4 291.328 102.4 323.7888v376.4736c0 32.4608 26.3168 58.7776 58.7776 58.7776h148.5312l225.9456 154.7776a44.032 44.032 0 0 0 68.864-36.3008V146.4832a44.032 44.032 0 0 0-68.864-36.3008zM699.6992 417.792a25.6 25.6 0 0 0-4.8128 35.8912c10.6496 13.8752 16.2304 30.5664 16.2304 48.128 0 17.664-5.632 34.3552-16.3328 48.2816a25.6 25.6 0 0 0 40.6016 31.232c17.664-22.9376 26.9312-50.432 26.9312-79.4624 0-28.928-9.2672-56.32-26.7264-79.2576a25.6512 25.6512 0 0 0-35.8912-4.8128z", 3 | "M800.4608 304.5376a25.6 25.6 0 1 0-23.1936 45.6704A169.216 169.216 0 0 1 870.4 501.8112a169.216 169.216 0 0 1-93.0304 151.552 25.5488 25.5488 0 1 0 23.1936 45.6192A220.16 220.16 0 0 0 921.6 501.8112a220.3136 220.3136 0 0 0-121.1392-197.2736z" 4 | ] 5 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/checked.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | "M512 773.42464c-144.47488 0-261.45024-116.97536-261.45024-261.42464 0-144.31616 116.97536-261.29024 261.45024-261.29024 144.28544 0 261.25952 116.97536 261.25952 261.29024C773.25952 656.45056 656.28544 773.42464 512 773.42464L512 773.42464zM512 119.97952C295.4752 119.97952 119.85536 295.47392 119.85536 512c0 216.49536 175.61984 392.14464 392.14464 392.14464 216.46464 0 391.9552-175.65056 391.9552-392.14464C903.9552 295.47392 728.46464 119.97952 512 119.97952L512 119.97952zM512 969.42976C259.29472 969.42976 54.57024 764.67968 54.57024 512 54.57024 259.4496 259.29472 54.57024 512 54.57024c252.51968 0 457.42976 204.87936 457.42976 457.42976C969.42976 764.67968 764.51968 969.42976 512 969.42976L512 969.42976zM512 969.42976" 3 | ] 4 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/clear.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | "M479.3 863.6L899.9 443c37.4-37.4 37.4-98.3 0-135.8L716.7 124.1C698.5 106 674.4 96 648.7 96c-25.8 0-50.4 10.8-68.6 29l-455 455c-18.2 18.2-29 42.8-29 68.6 0 25.7 9.9 49.9 28.1 68l183.1 183.2c18.1 18.1 42.2 28.1 67.9 28.1 3 0 5.9-0.1 8.8-0.4v0.1h512c17.7 0 32-14.3 32-32s-14.3-32-32-32H479.3z m-126.8-9L169.4 671.5c-6-6-9.4-14.1-9.4-22.6 0-8.5 3.3-16.6 9.4-22.6l104.9-104.9 228.4 228.4-104.9 104.8c-6 6-14.1 9.4-22.6 9.4-8.6 0-16.6-3.3-22.7-9.4z" 3 | ] 4 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/clipboard.ts: -------------------------------------------------------------------------------- 1 | export default "M192 0c-41.8 0-77.4 26.7-90.5 64H48C21.5 64 0 85.5 0 112V464c0 26.5 21.5 48 48 48H336c26.5 0 48-21.5 48-48V112c0-26.5-21.5-48-48-48H282.5C269.4 26.7 233.8 0 192 0zm0 128c-17.7 0-32-14.3-32-32s14.3-32 32-32s32 14.3 32 32s-14.3 32-32 32zm-80 64H272c8.8 0 16 7.2 16 16s-7.2 16-16 16H112c-8.8 0-16-7.2-16-16s7.2-16 16-16z" 2 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/close.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | "M310.6 150.6c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L160 210.7 54.6 105.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3L114.7 256 9.4 361.4c-12.5 12.5-12.5 32.8 0 45.3s32.8 12.5 45.3 0L160 301.3 265.4 406.6c12.5 12.5 32.8 12.5 45.3 0s12.5-32.8 0-45.3L205.3 256 310.6 150.6z" 3 | ] 4 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/copy.ts: -------------------------------------------------------------------------------- 1 | export default "M224 0c-35.3 0-64 28.7-64 64V288c0 35.3 28.7 64 64 64H448c35.3 0 64-28.7 64-64V64c0-35.3-28.7-64-64-64H224zM64 160c-35.3 0-64 28.7-64 64V448c0 35.3 28.7 64 64 64H288c35.3 0 64-28.7 64-64V384H288v64H64V224h64V160H64z" 2 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/devtools.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | "M955.140191 657.686057L482.322585 376.382253c-17.251919-10.262738-28.340465-2.425236-24.684192 17.409508l100.538811 543.990599c3.666506 19.828604 16.083304 22.576181 27.628244 6.077415 0 0 64.233953-92.081185 116.91478-148.294464l101.060697 150.524248c9.646708 14.33652 29.105898 18.077727 43.275619 8.336876l33.92567-23.452132c14.148231-9.760295 17.830087-29.519314 8.207939-43.884486L788.174482 736.668922c67.536162-27.991518 162.961512-51.606355 162.961512-51.606354 19.460214-4.800329 21.261233-17.116843 4.004197-27.376511z", 3 | "M491.223303 891.487987H219.679793c-49.051159 0-88.897679-38.494733-88.897679-85.863576v-594.520435c0-47.365774 39.84652-85.924975 88.897679-85.924975v0.057305h583.463612c48.995901 0 88.843444 38.556131 88.843444 85.924975v346.19779h65.833381V211.160257c0-83.677794-69.426209-151.757333-154.681942-151.757332h-583.458495c-85.305875 0-154.672732 68.079538-154.672732 151.757332v594.519412c0 83.625606 69.366857 151.702074 154.672732 151.702074h271.542486v-65.893756z" 4 | ] 5 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/empty.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | 'M855.6 427.2H168.5c-12.7 0-24.4 6.9-30.6 18L4.4 684.7C1.5 689.9 0 695.8 0 701.8v287.1c0 19.4 15.7 35.1 35.1 35.1H989c19.4 0 35.1-15.7 35.1-35.1V701.8c0-6-1.5-11.8-4.4-17.1L886.2 445.2c-6.2-11.1-17.9-18-30.6-18zM673.4 695.6c-16.5 0-30.8 11.5-34.3 27.7-12.7 58.5-64.8 102.3-127.2 102.3s-114.5-43.8-127.2-102.3c-3.5-16.1-17.8-27.7-34.3-27.7H119c-26.4 0-43.3-28-31.1-51.4l81.7-155.8c6.1-11.6 18-18.8 31.1-18.8h622.4c13 0 25 7.2 31.1 18.8l81.7 155.8c12.2 23.4-4.7 51.4-31.1 51.4H673.4zM819.9 209.5c-1-1.8-2.1-3.7-3.2-5.5-9.8-16.6-31.1-22.2-47.8-12.6L648.5 261c-17 9.8-22.7 31.6-12.6 48.4 0.9 1.4 1.7 2.9 2.5 4.4 9.5 17 31.2 22.8 48 13L807 257.3c16.7-9.7 22.4-31 12.9-47.8zM375.4 261.1L255 191.6c-16.7-9.6-38-4-47.8 12.6-1.1 1.8-2.1 3.6-3.2 5.5-9.5 16.8-3.8 38.1 12.9 47.8L337.3 327c16.9 9.7 38.6 4 48-13.1 0.8-1.5 1.7-2.9 2.5-4.4 10.2-16.8 4.5-38.6-12.4-48.4zM512 239.3h2.5c19.5 0.3 35.5-15.5 35.5-35.1v-139c0-19.3-15.6-34.9-34.8-35.1h-6.4C489.6 30.3 474 46 474 65.2v139c0 19.5 15.9 35.4 35.5 35.1h2.5z' 3 | ] 4 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/error.ts: -------------------------------------------------------------------------------- 1 | export default "M512 64c126.677333 3.328 232.192 47.146667 316.501333 131.498667C912.853333 279.808 956.672 385.28 960 512c-3.328 126.677333-47.146667 232.192-131.498667 316.501333C744.192 912.853333 638.72 956.672 512 960c-126.677333-3.328-232.192-47.146667-316.501333-131.498667C111.146667 744.192 67.328 638.72 64 512c3.328-126.677333 47.146667-232.192 131.498667-316.501333C279.808 111.146667 385.28 67.328 512 64z m0 394.026667L407.978667 354.005333a37.802667 37.802667 0 0 0-27.477334-11.989333 37.034667 37.034667 0 0 0-27.008 11.52c-7.68 7.637333-11.52 16.64-11.477333 26.965333 0 10.368 4.010667 19.541333 11.989333 27.52L458.026667 512l-104.021334 104.021333a37.802667 37.802667 0 0 0-11.989333 27.477334c0 10.325333 3.84 19.328 11.52 27.008 7.637333 7.68 16.64 11.52 26.965333 11.477333a37.930667 37.930667 0 0 0 27.52-11.989333L512 565.973333l104.021333 104.021334c10.666667 9.984 22.954667 13.184 36.992 9.514666a34.773333 34.773333 0 0 0 26.453334-26.496 37.205333 37.205333 0 0 0-9.472-36.992L565.973333 512l104.021334-104.021333a37.802667 37.802667 0 0 0 11.989333-27.477334 37.034667 37.034667 0 0 0-11.52-27.008 36.778667 36.778667 0 0 0-26.965333-11.477333 37.930667 37.930667 0 0 0-27.52 11.989333L512 458.026667z" 2 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/full.ts: -------------------------------------------------------------------------------- 1 | export default "M32 32C14.3 32 0 46.3 0 64v96c0 17.7 14.3 32 32 32s32-14.3 32-32V96h64c17.7 0 32-14.3 32-32s-14.3-32-32-32H32zM64 352c0-17.7-14.3-32-32-32s-32 14.3-32 32v96c0 17.7 14.3 32 32 32h96c17.7 0 32-14.3 32-32s-14.3-32-32-32H64V352zM320 32c-17.7 0-32 14.3-32 32s14.3 32 32 32h64v64c0 17.7 14.3 32 32 32s32-14.3 32-32V64c0-17.7-14.3-32-32-32H320zM448 352c0-17.7-14.3-32-32-32s-32 14.3-32 32v64H320c-17.7 0-32 14.3-32 32s14.3 32 32 32h96c17.7 0 32-14.3 32-32V352z" 2 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/github.ts: -------------------------------------------------------------------------------- 1 | export default "M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z" 2 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/history.ts: -------------------------------------------------------------------------------- 1 | export default "M75 75L41 41C25.9 25.9 0 36.6 0 57.9V168c0 13.3 10.7 24 24 24H134.1c21.4 0 32.1-25.9 17-41l-30.8-30.8C155 85.5 203 64 256 64c106 0 192 86 192 192s-86 192-192 192c-40.8 0-78.6-12.7-109.7-34.4c-14.5-10.1-34.4-6.6-44.6 7.9s-6.6 34.4 7.9 44.6C151.2 495 201.7 512 256 512c141.4 0 256-114.6 256-256S397.4 0 256 0C185.3 0 121.3 28.7 75 75zm181 53c-13.3 0-24 10.7-24 24V256c0 6.4 2.5 12.5 7 17l72 72c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-65-65V152c0-13.3-10.7-24-24-24z" 2 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/info.ts: -------------------------------------------------------------------------------- 1 | export default "M553.984 553.984l0-256-84.010667 0 0 256 84.010667 0zM553.984 726.016l0-86.016-84.010667 0 0 86.016 84.010667 0zM512 86.016q176 0 301.013333 125.013333t125.013333 301.013333-125.013333 301.013333-301.013333 125.013333-301.013333-125.013333-125.013333-301.013333 125.013333-301.013333 301.013333-125.013333z" 2 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/location.ts: -------------------------------------------------------------------------------- 1 | export default "M256 0c17.7 0 32 14.3 32 32V66.7C368.4 80.1 431.9 143.6 445.3 224H480c17.7 0 32 14.3 32 32s-14.3 32-32 32H445.3C431.9 368.4 368.4 431.9 288 445.3V480c0 17.7-14.3 32-32 32s-32-14.3-32-32V445.3C143.6 431.9 80.1 368.4 66.7 288H32c-17.7 0-32-14.3-32-32s14.3-32 32-32H66.7C80.1 143.6 143.6 80.1 224 66.7V32c0-17.7 14.3-32 32-32zM128 256c0 70.7 57.3 128 128 128s128-57.3 128-128s-57.3-128-128-128s-128 57.3-128 128zm128 80c-44.2 0-80-35.8-80-80s35.8-80 80-80s80 35.8 80 80s-35.8 80-80 80z" 2 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/message.ts: -------------------------------------------------------------------------------- 1 | export default "M892 141.6H134c-37.6 0-68 30.4-68 68v534.5c0 37.6 30.4 68 68 68h109.1l18.5 82c8.6 38 55.1 52.5 83.7 26l117-108H892c37.6 0 68-30.4 68-68V209.6c0-37.5-30.5-68-68-68zM314 507.8c-31.8 0-57.5-25.8-57.5-57.5s25.8-57.5 57.5-57.5c31.8 0 57.5 25.8 57.5 57.5s-25.7 57.5-57.5 57.5z m209.4 4c-31.8 0-57.5-25.8-57.5-57.5s25.8-57.5 57.5-57.5c31.8 0 57.5 25.8 57.5 57.5s-25.7 57.5-57.5 57.5z m209.4 0c-31.8 0-57.5-25.8-57.5-57.5s25.8-57.5 57.5-57.5c31.8 0 57.5 25.8 57.5 57.5s-25.7 57.5-57.5 57.5z" 2 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/moon.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | "M518.8 512.7c0-178.9 116.1-330.9 278.5-389.1-45.6-16.3-94.6-25.7-145.9-25.7C417 97.9 227 283.7 227 512.7c0 229.1 190 414.8 424.5 414.8 51.4 0 100.3-9.4 145.9-25.7-162.5-58.1-278.6-210.1-278.6-389.1z" 3 | ] 4 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/question.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | "M256 512c141.4 0 256-114.6 256-256S397.4 0 256 0S0 114.6 0 256S114.6 512 256 512zM169.8 165.3c7.9-22.3 29.1-37.3 52.8-37.3h58.3c34.9 0 63.1 28.3 63.1 63.1c0 22.6-12.1 43.5-31.7 54.8L280 264.4c-.2 13-10.9 23.6-24 23.6c-13.3 0-24-10.7-24-24V250.5c0-8.6 4.6-16.5 12.1-20.8l44.3-25.4c4.7-2.7 7.6-7.7 7.6-13.1c0-8.4-6.8-15.1-15.1-15.1H222.6c-3.4 0-6.4 2.1-7.5 5.3l-.4 1.2c-4.4 12.5-18.2 19-30.6 14.6s-19-18.2-14.6-30.6l.4-1.2zM288 352c0 17.7-14.3 32-32 32s-32-14.3-32-32s14.3-32 32-32s32 14.3 32 32z" 3 | ] 4 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/right.ts: -------------------------------------------------------------------------------- 1 | export default "M887.254 353.743c-20.511-48.423-49.759-91.872-87.139-129.251s-80.828-66.628-129.251-87.139c-50.123-21.238-103.402-31.918-158.257-31.918s-108.134 10.801-158.257 31.918c-48.423 20.511-91.872 49.759-129.251 87.139-37.379 37.379-66.628 80.828-87.139 129.251-21.238 50.123-31.918 103.402-31.918 158.257s10.801 108.134 31.918 158.257c20.511 48.423 49.759 91.872 87.139 129.251 37.379 37.379 80.828 66.628 129.251 87.139 50.123 21.238 103.402 31.918 158.257 31.918s108.134-10.801 158.257-31.918c48.423-20.511 91.872-49.759 129.251-87.139 37.379-37.379 66.628-80.828 87.139-129.251 21.238-50.123 31.918-103.402 31.918-158.257s-10.801-108.134-31.918-158.257zM740.405 401.923l-280.227 280.227c-11.286 11.286-29.855 11.286-41.142 0l-143.209-143.209c-11.286-11.286-11.286-29.855 0-41.142 11.286-11.286 29.855-11.286 41.142 0l122.576 122.576 259.596-259.596c11.286-11.286 29.855-11.286 41.142 0 11.408 11.286 11.408 29.733 0.122 41.142z"; 2 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/search.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | "M192 480a256 256 0 1 1 512 0 256 256 0 0 1-512 0m631.776 362.496l-143.2-143.168A318.464 318.464 0 0 0 768 480c0-176.736-143.264-320-320-320S128 303.264 128 480s143.264 320 320 320a318.016 318.016 0 0 0 184.16-58.592l146.336 146.368c12.512 12.48 32.768 12.48 45.28 0 12.48-12.512 12.48-32.768 0-45.28" 3 | ] 4 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/selected.ts: -------------------------------------------------------------------------------- 1 | export default "M470.6 105.4c12.5 12.5 12.5 32.8 0 45.3l-256 256c-12.5 12.5-32.8 12.5-45.3 0l-128-128c-12.5-12.5-12.5-32.8 0-45.3s32.8-12.5 45.3 0L192 338.7 425.4 105.4c12.5-12.5 32.8-12.5 45.3 0z" 2 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/setting.ts: -------------------------------------------------------------------------------- 1 | export default "M495.9 166.6c3.2 8.7 .5 18.4-6.4 24.6l-43.3 39.4c1.1 8.3 1.7 16.8 1.7 25.4s-.6 17.1-1.7 25.4l43.3 39.4c6.9 6.2 9.6 15.9 6.4 24.6c-4.4 11.9-9.7 23.3-15.8 34.3l-4.7 8.1c-6.6 11-14 21.4-22.1 31.2c-5.9 7.2-15.7 9.6-24.5 6.8l-55.7-17.7c-13.4 10.3-28.2 18.9-44 25.4l-12.5 57.1c-2 9.1-9 16.3-18.2 17.8c-13.8 2.3-28 3.5-42.5 3.5s-28.7-1.2-42.5-3.5c-9.2-1.5-16.2-8.7-18.2-17.8l-12.5-57.1c-15.8-6.5-30.6-15.1-44-25.4L83.1 425.9c-8.8 2.8-18.6 .3-24.5-6.8c-8.1-9.8-15.5-20.2-22.1-31.2l-4.7-8.1c-6.1-11-11.4-22.4-15.8-34.3c-3.2-8.7-.5-18.4 6.4-24.6l43.3-39.4C64.6 273.1 64 264.6 64 256s.6-17.1 1.7-25.4L22.4 191.2c-6.9-6.2-9.6-15.9-6.4-24.6c4.4-11.9 9.7-23.3 15.8-34.3l4.7-8.1c6.6-11 14-21.4 22.1-31.2c5.9-7.2 15.7-9.6 24.5-6.8l55.7 17.7c13.4-10.3 28.2-18.9 44-25.4l12.5-57.1c2-9.1 9-16.3 18.2-17.8C227.3 1.2 241.5 0 256 0s28.7 1.2 42.5 3.5c9.2 1.5 16.2 8.7 18.2 17.8l12.5 57.1c15.8 6.5 30.6 15.1 44 25.4l55.7-17.7c8.8-2.8 18.6-.3 24.5 6.8c8.1 9.8 15.5 20.2 22.1 31.2l4.7 8.1c6.1 11 11.4 22.4 15.8 34.3zM256 336c44.2 0 80-35.8 80-80s-35.8-80-80-80s-80 35.8-80 80s35.8 80 80 80z" 2 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/success.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | "M243.8 339.8C232.9 350.7 215.1 350.7 204.2 339.8L140.2 275.8C129.3 264.9 129.3 247.1 140.2 236.2C151.1 225.3 168.9 225.3 179.8 236.2L224 280.4L332.2 172.2C343.1 161.3 360.9 161.3 371.8 172.2C382.7 183.1 382.7 200.9 371.8 211.8L243.8 339.8zM512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 48C141.1 48 48 141.1 48 256C48 370.9 141.1 464 256 464C370.9 464 464 370.9 464 256C464 141.1 370.9 48 256 48z" 3 | ] 4 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/sun.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | "M298.7 676.2l-52.3 52.3c-9.6 9.6-9.6 25.3 0 34.9 9.6 9.6 25.3 9.6 34.9 0l52.3-52.3c9.6-9.6 9.6-25.3 0-34.9-9.6-9.6-25.3-9.6-34.9 0z m-15-372.7c9.7 9.7 25.5 9.7 35.2 0 9.7-9.7 9.7-25.5 0-35.2l-52.8-52.8c-9.7-9.7-25.5-9.7-35.2 0-9.7 9.7-9.7 25.5 0 35.2l52.8 52.8z m-69.9 168.8h-74.7c-13.8 0-24.9 11.1-24.9 24.9 0 13.8 11.2 24.9 24.9 24.9h74.7c13.8 0 24.9-11.1 24.9-24.9 0-13.7-11.2-24.9-24.9-24.9z m298.8-249c13.8 0 24.9-11.1 24.9-24.9v-74.7c0-13.8-11.1-24.9-24.9-24.9s-24.9 11.1-24.9 24.9v74.7c0 13.8 11.2 24.9 24.9 24.9z m239.6 69.2l52.3-52.3c9.6-9.6 9.6-25.3 0-34.9-9.6-9.6-25.3-9.6-34.9 0l-52.3 52.3c-9.6 9.6-9.6 25.3 0 34.9 9.6 9.7 25.3 9.7 34.9 0z m133.9 179.8h-74.7c-13.8 0-24.9 11.1-24.9 24.9 0 13.8 11.1 24.9 24.9 24.9h74.7c13.8 0 24.9-11.1 24.9-24.9 0-13.7-11.1-24.9-24.9-24.9zM741.5 690.9c-9.7-9.7-25.5-9.7-35.2 0-9.7 9.7-9.7 25.5 0 35.2l52.8 52.8c9.7 9.7 25.5 9.7 35.2 0 9.7-9.7 9.7-25.5 0-35.2l-52.8-52.8zM512.6 273c-123.9 0-224.3 100.4-224.3 224.3s100.4 224.3 224.3 224.3 224.3-100.4 224.3-224.3S636.5 273 512.6 273z m0 498.1c-13.8 0-24.9 11.1-24.9 24.9v74.7c0 13.8 11.1 24.9 24.9 24.9s24.9-11.1 24.9-24.9V796c0-13.7-11.1-24.9-24.9-24.9z" 3 | ] 4 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/toggle.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | "M677.888 598.528l-254.464 239.616c-15.872 14.848-38.912 18.944-59.392 11.264-20.48-8.192-33.792-26.624-33.792-47.616V322.56c0-20.992 13.312-39.424 33.792-47.616 6.656-2.56 13.824-4.096 20.992-4.096 14.336 0 28.16 5.12 38.4 15.36l254.464 239.616c10.24 9.728 15.872 23.04 15.872 36.352 0.512 13.824-5.632 26.624-15.872 36.352z" 3 | ] 4 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/unchecked.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | "M512.00512 54.57024c-252.71424 0-457.43488 204.87936-457.43488 457.42464 0 252.67968 204.72064 457.43488 457.43488 457.43488 252.51456 0 457.42464-204.7552 457.42464-457.43488C969.42976 259.4496 764.51968 54.57024 512.00512 54.57024L512.00512 54.57024zM512.00512 904.14976c-216.52992 0-392.13952-175.6544-392.13952-392.15488 0-216.51968 175.6096-392.01536 392.13952-392.01536 216.45952 0 391.9552 175.49568 391.9552 392.01536C903.96032 728.49536 728.46464 904.14976 512.00512 904.14976L512.00512 904.14976zM512.00512 904.14976" 3 | ] 4 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/up.ts: -------------------------------------------------------------------------------- 1 | export default [ 2 | "M512 614.656 857.344 960 945.344 872 512 438.656 78.656 872 166.656 959.872Z", 3 | "M512 240.064 857.344 585.344 945.344 497.344 512 64 78.656 497.344 166.656 585.344Z" 4 | ] 5 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/icon/upload.ts: -------------------------------------------------------------------------------- 1 | export default "M144 480C64.5 480 0 415.5 0 336c0-62.8 40.2-116.2 96.2-135.9c-.1-2.7-.2-5.4-.2-8.1c0-88.4 71.6-160 160-160c59.3 0 111 32.2 138.7 80.2C409.9 102 428.3 96 448 96c53 0 96 43 96 96c0 12.2-2.3 23.8-6.4 34.6C596 238.4 640 290.1 640 352c0 70.7-57.3 128-128 128H144zm79-217c-9.4 9.4-9.4 24.6 0 33.9s24.6 9.4 33.9 0l39-39V392c0 13.3 10.7 24 24 24s24-10.7 24-24V257.9l39 39c9.4 9.4 24.6 9.4 33.9 0s9.4-24.6 0-33.9l-80-80c-9.4-9.4-24.6-9.4-33.9 0l-80 80z" 2 | -------------------------------------------------------------------------------- /packages/ctool-config/src/generate/router.ts: -------------------------------------------------------------------------------- 1 | import {tools} from "../index"; 2 | import {buildData, fileCoreSrc} from "./fileSystem"; 3 | 4 | export const buildRoute = () => { 5 | const indent = " ".repeat(4) 6 | const config = tools.map((tool) => { 7 | return tool.features.map((feature) => { 8 | const filePath = feature.getComponentPath() 9 | if (!fileCoreSrc.isFile(filePath)) { 10 | throw new Error(`文件 ${filePath} 不存在`) 11 | } 12 | return [ 13 | `${indent.repeat(1)}{`, 14 | `${indent.repeat(2)}tool: "${feature.tool.name}",`, 15 | `${indent.repeat(2)}feature: "${feature.name}",`, 16 | `${indent.repeat(2)}component: () => import('@${filePath}')`, 17 | `${indent.repeat(1)}},`, 18 | ].join("\n"); 19 | }).join("\n") 20 | }).join("\n") 21 | 22 | buildData.prepend(`import {ToolRouteConfig} from "@/types"`) 23 | buildData.append( 24 | `export const toolRoutes: ToolRouteConfig[] = [ 25 | ${config} 26 | ] 27 | `, '路由配置') 28 | } 29 | -------------------------------------------------------------------------------- /packages/ctool-config/src/proxy.ts: -------------------------------------------------------------------------------- 1 | // 在平台 platform.runtime.webSecurity() === true 时 需要配置代理访问的域名 2 | const domains: string[] = [ 3 | "api.jdoodle.com", 4 | "armconverter.com" 5 | ] 6 | 7 | export default { 8 | defaultProxyUrl: "https://ctool.dev/api/proxy", 9 | is(url: string) { 10 | if (url !== "") { 11 | for (let domain of domains) { 12 | if (url.includes(domain)) { 13 | return true; 14 | } 15 | } 16 | } 17 | return false; 18 | }, 19 | getDomains() { 20 | return domains 21 | }, 22 | // chrome / edge / firefox 浏览器扩展 manifest.json permissions 23 | getManifestPermissions() { 24 | return domains.map(domain => { 25 | domain = domain.trim(); 26 | const lists = domain.split('.') 27 | if (lists.length < 2) { 28 | return ""; 29 | } 30 | if (lists.length === 2) { 31 | return [`*.${domain}`, domain] 32 | } 33 | return lists.join("."); 34 | }).flat().filter(str => str !== "").map(str => `*://${str}/*`) 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /packages/ctool-config/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "ESNext", 4 | "useDefineForClassFields": true, 5 | "module": "ESNext", 6 | "moduleResolution": "node", 7 | "strict": true, 8 | "jsx": "preserve", 9 | "sourceMap": true, 10 | "resolveJsonModule": true, 11 | "isolatedModules": true, 12 | "esModuleInterop": true, 13 | "noImplicitAny": false, 14 | "lib": [ 15 | "ESNext", 16 | "DOM" 17 | ], 18 | "skipLibCheck": true, 19 | "types": [ 20 | "node" 21 | ], 22 | "paths": { 23 | "@/*": [ 24 | "./src/*" 25 | ] 26 | } 27 | }, 28 | "include": [ 29 | "src/**/*.ts" 30 | ] 31 | } 32 | 33 | -------------------------------------------------------------------------------- /packages/ctool-config/tsup.config.ts: -------------------------------------------------------------------------------- 1 | import {defineConfig} from "tsup"; 2 | 3 | export default defineConfig({ 4 | entry: ["./src/index.ts", "./src/generate.ts"], 5 | outDir: "./dist/", 6 | legacyOutput: true, 7 | format: ["cjs", "esm"], 8 | platform: "node", 9 | target: "node16", 10 | splitting: false, 11 | dts: true, 12 | clean: true, 13 | }); 14 | -------------------------------------------------------------------------------- /packages/ctool-core/.gitignore: -------------------------------------------------------------------------------- 1 | # Logs 2 | logs 3 | *.log 4 | npm-debug.log* 5 | yarn-debug.log* 6 | yarn-error.log* 7 | pnpm-debug.log* 8 | lerna-debug.log* 9 | 10 | node_modules 11 | dist 12 | dist-ssr 13 | *.local 14 | 15 | # Editor directories and files 16 | .vscode/* 17 | !.vscode/extensions.json 18 | .idea 19 | .DS_Store 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | 26 | # gitignore 27 | src/buildDataTemp.ts 28 | src/buildTypeTemp.d.ts 29 | public/LICENSE 30 | public/README.md 31 | public/ctool.addition.json 32 | test.js 33 | temp/ 34 | dist1 35 | -------------------------------------------------------------------------------- /packages/ctool-core/CONTRIBUTING.md: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baiy/Ctool/d1088f9dc31bbf71106acb0858a64941aec48da3/packages/ctool-core/CONTRIBUTING.md -------------------------------------------------------------------------------- /packages/ctool-core/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Ctool 6 | 7 | 8 | 9 | 10 | 11 |
12 | Loading... 13 |
14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/ctool-core/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baiy/Ctool/d1088f9dc31bbf71106acb0858a64941aec48da3/packages/ctool-core/public/favicon.ico -------------------------------------------------------------------------------- /packages/ctool-core/public/icon/icon_1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baiy/Ctool/d1088f9dc31bbf71106acb0858a64941aec48da3/packages/ctool-core/public/icon/icon_1024.png -------------------------------------------------------------------------------- /packages/ctool-core/public/icon/icon_chrome.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baiy/Ctool/d1088f9dc31bbf71106acb0858a64941aec48da3/packages/ctool-core/public/icon/icon_chrome.png -------------------------------------------------------------------------------- /packages/ctool-core/public/icon/icon_utools.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baiy/Ctool/d1088f9dc31bbf71106acb0858a64941aec48da3/packages/ctool-core/public/icon/icon_utools.png -------------------------------------------------------------------------------- /packages/ctool-core/public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Allow: / 3 | -------------------------------------------------------------------------------- /packages/ctool-core/src/block/Clipboard.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 23 | -------------------------------------------------------------------------------- /packages/ctool-core/src/block/Index.vue: -------------------------------------------------------------------------------- 1 | 49 | 52 | -------------------------------------------------------------------------------- /packages/ctool-core/src/block/Test.vue: -------------------------------------------------------------------------------- 1 | 9 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/ctool-core/src/components/Exception.vue: -------------------------------------------------------------------------------- 1 | 7 | 15 | -------------------------------------------------------------------------------- /packages/ctool-core/src/components/HelpTip.vue: -------------------------------------------------------------------------------- 1 | 8 | 9 | 42 | -------------------------------------------------------------------------------- /packages/ctool-core/src/components/editor/monaco.ts: -------------------------------------------------------------------------------- 1 | import loader from "@monaco-editor/loader"; 2 | import ContextMenu from "./contextMenu"; 3 | import lineInfo from "./lineInfo"; 4 | import * as monaco from "monaco-editor"; 5 | import "./style.css"; 6 | const monacoInstance = () => { 7 | return loader.__getMonacoInstance(); 8 | }; 9 | 10 | export { loader, ContextMenu, monacoInstance, monaco, lineInfo }; 11 | -------------------------------------------------------------------------------- /packages/ctool-core/src/components/editor/style.css: -------------------------------------------------------------------------------- 1 | .view-line .ctool-monaco-editor-line-info { 2 | margin: .1em .2em 0; 3 | display: inline; 4 | line-height: 100%; 5 | height: 100%; 6 | font-size: 10px; 7 | 8 | padding: 0 6px; 9 | background-color: grey; 10 | border-radius: 4px; 11 | text-shadow: none; 12 | color: #fff; 13 | } 14 | -------------------------------------------------------------------------------- /packages/ctool-core/src/components/serialize/index.ts: -------------------------------------------------------------------------------- 1 | // 序列化输入/输出组件 2 | import {SerializeInputEncoderType, SerializeOutputEncoderType} from "@/types"; 3 | import Input from "./input"; 4 | import Output from "./output"; 5 | 6 | // 输入 7 | export type SerializeInput = Input 8 | export const createSerializeInput = (type: SerializeInputEncoderType = 'json', value: string = "") => new Input(type, value) 9 | 10 | // 输出 11 | export type SerializeOutput = Output 12 | export const createSerializeOutput = (type: SerializeOutputEncoderType = 'json') => new Output(type) 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/ctool-core/src/components/text/index.ts: -------------------------------------------------------------------------------- 1 | // 文本数据输入/输出组件 2 | import {TextInputEncoderType, TextOutputEncoderType} from "@/types"; 3 | import Input from "./input"; 4 | import Output from "./output"; 5 | 6 | // 输入 7 | export type TextInput = Input 8 | export const createTextInput = (type: TextInputEncoderType = 'text', value: string = "") => new Input(type, value) 9 | 10 | // 输出 11 | export type TextOutput = Output 12 | export const createTextOutput = (type: TextOutputEncoderType = 'text') => new Output(type) 13 | 14 | 15 | -------------------------------------------------------------------------------- /packages/ctool-core/src/components/ui/Dropdown.vue: -------------------------------------------------------------------------------- 1 | 4 | 9 | 28 | -------------------------------------------------------------------------------- /packages/ctool-core/src/components/ui/InputNumber.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | 51 | 56 | -------------------------------------------------------------------------------- /packages/ctool-core/src/components/ui/Link.vue: -------------------------------------------------------------------------------- 1 | 8 | 13 | 43 | 52 | -------------------------------------------------------------------------------- /packages/ctool-core/src/components/ui/Tooltip.vue: -------------------------------------------------------------------------------- 1 | 4 | 5 | 51 | -------------------------------------------------------------------------------- /packages/ctool-core/src/components/util.ts: -------------------------------------------------------------------------------- 1 | import {isNumber} from "lodash"; 2 | 3 | /** 4 | * 尺寸转换 适用于 width height 等 5 | * @param size 6 | * @param lists 7 | */ 8 | export const sizeConvert = (size: string | number, lists: Record = {}): string => { 9 | if (Object.keys(lists).includes(`${size}`)) { 10 | return lists[`${size}`] 11 | } 12 | return (isNumber(size) || /^[\d.]+$/.test(`${size}`)) ? `${size}px` : `${size}` 13 | } 14 | 15 | export const measureTextMaxWidth = (texts: string[], fontSize) => { 16 | const lists: number[] = [0] 17 | const el = document.createElement('div'); 18 | el.style.position = "absolute" 19 | el.style.left = "-10000px" 20 | el.style.top = "-10000px" 21 | document.body.appendChild(el); 22 | el.style.fontSize = fontSize 23 | for (let text of texts) { 24 | el.textContent = text; 25 | lists.push(el.clientWidth) 26 | } 27 | document.body.removeChild(el); 28 | return Math.max(...lists); 29 | } 30 | -------------------------------------------------------------------------------- /packages/ctool-core/src/config.ts: -------------------------------------------------------------------------------- 1 | export type { 2 | ToolType, 3 | CategoryType, 4 | FeatureType, 5 | ToolInterface, 6 | CategoryInterface, 7 | FeatureInterface 8 | } from "ctool-config" 9 | 10 | export {tools, categories, commonTool, toolExists, categoryExists, getTool, getCategory} from "ctool-config" 11 | -------------------------------------------------------------------------------- /packages/ctool-core/src/directive/row.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * 网格布局 3 | * v-row="a:b" a:d布局 间距默认5px a/b 为数字 4 | * v-row="a-b-c|10" a:d:c布局 间距默认10px a/b/c 为数字 5 | * v-row="a-100px|10" a:100px布局 间距默认10px a/b 为数字 6 | */ 7 | import {App} from "vue"; 8 | const update = (el: HTMLElement, value: string = "") => { 9 | el.setAttribute('ctool-v-row',value) 10 | // 项目间距 11 | if (!value.includes("|")) { 12 | value = `${value}|5` // 默认值 13 | } 14 | let [column, gap] = value.split("|") 15 | if (column === "") { 16 | return; 17 | } 18 | let columns = column.split("-"); 19 | if (columns.length < 2) { 20 | return; 21 | } 22 | el.style.display = "grid" 23 | el.style.gridTemplateColumns = columns.map((item) => { 24 | if (/^\d+$/.test(item)){ 25 | return `minmax(0, ${item}fr)` 26 | } 27 | return `${item}` 28 | }).join(" "); 29 | el.style.gap = `${gap}px` 30 | } 31 | 32 | export default (app: App) => { 33 | app.directive('row', { 34 | beforeMount(el: HTMLElement, binding: { value: string }) { 35 | update(el, binding.value) 36 | }, 37 | mounted(el: HTMLElement, binding: { value: string }) { 38 | update(el, binding.value) 39 | }, 40 | beforeUpdate(el: HTMLElement, binding: { value: string }) { 41 | update(el, binding.value) 42 | }, 43 | updated(el: HTMLElement, binding: { value: string }) { 44 | update(el, binding.value) 45 | }, 46 | }) 47 | } 48 | -------------------------------------------------------------------------------- /packages/ctool-core/src/helper/helper.ts: -------------------------------------------------------------------------------- 1 | import platform from "./platform" 2 | 3 | export const openUrl = (url: string = window.location.href) => { 4 | platform.runtime.openUrl(url) 5 | } 6 | 7 | export const optionMap = (items: string[] | number[], prefix = "") => { 8 | return items.map((item: string | number) => { 9 | return {value: item, label: $t(`${prefix}${item}`)} 10 | }) 11 | } 12 | 13 | -------------------------------------------------------------------------------- /packages/ctool-core/src/helper/icon.ts: -------------------------------------------------------------------------------- 1 | import {iconData, iconType} from "@/buildDataTemp"; 2 | 3 | const lists: Record = {} 4 | 5 | import {h, VNode} from 'vue' 6 | 7 | const svg = (name: iconType) => { 8 | let [left, top, right, bottom] = iconData[name].box 9 | left = Math.ceil(left) 10 | top = Math.ceil(top) 11 | right = Math.ceil(right - left) 12 | bottom = Math.ceil(bottom - top) 13 | return h( 14 | 'svg', 15 | { 16 | xmlns: "http://www.w3.org/2000/svg", 17 | viewBox: `${left} ${top} ${right} ${bottom}`, 18 | 'data-icon': name 19 | }, 20 | iconData[name].data.map(path => { 21 | return h('path', {d: path}) 22 | }) 23 | ) 24 | } 25 | 26 | export const all = Object.keys(iconData) as iconType[] 27 | 28 | export type IconType = iconType 29 | 30 | export const load = async (name: iconType) => { 31 | if (!(name in lists)) { 32 | if (!(name in iconData)) { 33 | throw new Error(`icon [${name}] not found`) 34 | } 35 | lists[name] = svg(name) 36 | } 37 | return lists[name] 38 | } 39 | -------------------------------------------------------------------------------- /packages/ctool-core/src/helper/json/index.ts: -------------------------------------------------------------------------------- 1 | import {parse, stringify} from "when-json-met-bigint"; 2 | import {jsonrepair} from "jsonrepair"; 3 | 4 | 5 | type Stringify = Parameters> 6 | 7 | export default { 8 | parse: (str: string, {BIGINT_TO_STING = false, JSON_REPAIR = false} = {}) => { 9 | return parse( 10 | JSON_REPAIR ? jsonrepair(str) : str, 11 | (key, value) => { 12 | // 非安全数字转字符串 13 | if (BIGINT_TO_STING && typeof value === "bigint") { 14 | return (value as BigInt).toString() 15 | } 16 | return value 17 | } 18 | ) 19 | }, 20 | stringify: (value: Stringify[0], replacer?: Stringify[1], space?: Stringify[2]) => stringify(value, replacer, space) as string 21 | } 22 | -------------------------------------------------------------------------------- /packages/ctool-core/src/helper/platform/index.ts: -------------------------------------------------------------------------------- 1 | import { LocaleLists } from "@/types"; 2 | import Runtime from "./runtime"; 3 | 4 | class Platform { 5 | private readonly _runtime = new Runtime; 6 | 7 | get name() { 8 | return this.runtime.name(); 9 | } 10 | 11 | isChrome(): boolean { 12 | return this.name === "chrome"; 13 | } 14 | 15 | isEdge(): boolean { 16 | return this.name === "edge"; 17 | } 18 | 19 | isChromium(): boolean { 20 | return this.isChrome() || this.isEdge(); 21 | } 22 | 23 | isFirefox(): boolean { 24 | return this.name === "firefox"; 25 | } 26 | 27 | isUtools(): boolean { 28 | return this.name === "utools"; 29 | } 30 | 31 | isWeb(): boolean { 32 | return this.name === "web"; 33 | } 34 | 35 | isDesktop(): boolean { 36 | return ["tauri"].includes(this.name); 37 | } 38 | 39 | getLocale(): LocaleLists { 40 | // link https://www.ruanyifeng.com/blog/2008/02/codes_for_language_names.html 41 | const locale = (this.runtime.getLocale() || "").trim(); 42 | return locale === "zh" || locale.indexOf("zh-") === 0 || locale.indexOf("zh_") === 0 ? "zh_CN" : "en"; 43 | } 44 | 45 | get runtime() { 46 | return this._runtime; 47 | } 48 | } 49 | 50 | export default new Platform; 51 | -------------------------------------------------------------------------------- /packages/ctool-core/src/helper/platform/platformRuntimeDefault.ts: -------------------------------------------------------------------------------- 1 | import {PlatformRuntime} from "ctool-config"; 2 | import storage from "./storage"; 3 | 4 | export const runtime = new (class implements PlatformRuntime { 5 | name = "web" 6 | 7 | webSecurity() { 8 | return true 9 | } 10 | 11 | is() { 12 | return true 13 | } 14 | 15 | openUrl(url: string) { 16 | return window.open(url); 17 | } 18 | 19 | getLocale() { 20 | return navigator.language 21 | } 22 | 23 | storage() { 24 | return storage 25 | } 26 | 27 | }) 28 | -------------------------------------------------------------------------------- /packages/ctool-core/src/helper/platform/storage.ts: -------------------------------------------------------------------------------- 1 | import store from 'store2' 2 | import {StorageInterface, StorageDataStructure, StorageDataStructureInterface} from '@/types' 3 | 4 | // 当前操作实例 5 | const instance = store.namespace('ctool') 6 | 7 | class storage implements StorageInterface { 8 | get(key: string): StorageDataStructure { 9 | return instance.get(key, null) 10 | } 11 | 12 | clear(): void { 13 | instance.clear() 14 | } 15 | 16 | getAllKey(): string[] { 17 | return instance.keys(); 18 | } 19 | 20 | remove(key: string): void { 21 | instance.remove(key) 22 | } 23 | 24 | set(key: string, value: StorageDataStructureInterface): void { 25 | instance.set(key, value) 26 | } 27 | } 28 | 29 | export default new storage() 30 | -------------------------------------------------------------------------------- /packages/ctool-core/src/helper/proxy.ts: -------------------------------------------------------------------------------- 1 | import { proxy } from "ctool-config"; 2 | import _axios, { AxiosHeaders } from "axios"; 3 | import platform from "@/helper/platform"; 4 | import qs from "qs"; 5 | import useSetting from "@/store/setting"; 6 | 7 | // 对外请求代理方法 8 | export const axios = () => { 9 | const storeSetting = useSetting(); 10 | const instance = _axios.create(); 11 | instance.interceptors.request.use(config => { 12 | // 判断是否需要使用代理 13 | if (platform.runtime.webSecurity() && config.url && proxy.is(config.url)) { 14 | if (!storeSetting.items.proxy_enable || !storeSetting.items.proxy_url) { 15 | throw new Error($t("main_network_request_proxy_prompt")); 16 | } 17 | config.headers = !config.headers ? new AxiosHeaders() : config.headers; 18 | const connector = config.url.includes("?") ? "&" : "?"; 19 | config.headers["Ctool-Proxy-Url"] = `${config.url}${ 20 | config.params ? `${connector}${qs.stringify(config.params)}` : "" 21 | }`; 22 | config.params = undefined; 23 | config.url = storeSetting.items.proxy_url; 24 | } 25 | return config; 26 | }); 27 | return instance; 28 | }; 29 | -------------------------------------------------------------------------------- /packages/ctool-core/src/helper/radix.ts: -------------------------------------------------------------------------------- 1 | import BigNumber from "bignumber.js"; 2 | 3 | export const defaultAlphabet = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_@" 4 | 5 | export default (base: string | number, source: number, target: number, alphabet: string = "") => { 6 | alphabet = alphabet || defaultAlphabet 7 | 8 | const BN = BigNumber.clone({ALPHABET: alphabet,EXPONENTIAL_AT: 1e+9}) 9 | return (new BN(base, source)).toString(target); 10 | } 11 | -------------------------------------------------------------------------------- /packages/ctool-core/src/helper/router.ts: -------------------------------------------------------------------------------- 1 | import {createRouter, createWebHashHistory} from "vue-router" 2 | import {ToolRouteConfig, RouteMeta} from "@/types" 3 | import {toolRoutes} from "@/buildDataTemp" 4 | import {getTool} from "@/config"; 5 | 6 | const routes: { 7 | name: string, 8 | path: string, 9 | component: any, 10 | meta: RouteMeta 11 | }[] = [ 12 | { 13 | name: 'index', 14 | path: "/", 15 | component: () => import('@/block/Index.vue'), 16 | meta: {type: "index"} 17 | }, 18 | { 19 | name: 'clipboard', 20 | path: "/clipboard", 21 | component: () => import('@/block/Clipboard.vue'), 22 | meta: {type: "other"} 23 | }, 24 | { 25 | name: 'test', 26 | path: "/test", 27 | component: () => import('@/block/Test.vue'), 28 | meta: {type: "other"} 29 | }, 30 | ...toolRoutes.map((item: ToolRouteConfig) => { 31 | const meta: RouteMeta = {type: "tool", tool: item.tool, feature: item.feature} 32 | return { 33 | name: `${item.tool}${item.feature ? `_${item.feature}` : ''}`, 34 | path: getTool(item.tool).getFeature(item.feature).getRouter(), 35 | meta: meta, 36 | component: item.component 37 | } 38 | }) 39 | ] 40 | 41 | export default createRouter({ 42 | history: createWebHashHistory(), 43 | routes, 44 | }) 45 | -------------------------------------------------------------------------------- /packages/ctool-core/src/helper/serialize/phpArray.ts: -------------------------------------------------------------------------------- 1 | // 算法来源 2 | // https://www.npmjs.com/package/phparr 3 | // 添加 BigInt 类型支持 4 | import {isArray, isBoolean, isNull, isNumber, isObject, isString} from "lodash" 5 | 6 | export const stringify = (data) => { 7 | const space = " ".repeat(4); 8 | const indent = function (item) { 9 | return item.split('\n').map(line => `${space}${line}`).join('\n'); 10 | }; 11 | switch (true) { 12 | case isNumber(data): 13 | case isString(data): 14 | case isBoolean(data): 15 | case isNull(data): 16 | return JSON.stringify(data); 17 | case isArray(data): 18 | return [ 19 | space ? '[\n' : '[', 20 | data.map(item => stringify(item)).map(indent).join(space ? ',\n' : ','), 21 | space ? '\n]' : ']' 22 | ].join("") 23 | case isObject(data): { 24 | let items: string[] = []; 25 | for (let k in data) { 26 | items.push(JSON.stringify(k) + (space ? ' => ' : '=>') + stringify(data[k])) 27 | } 28 | return (space ? '[\n' : '[') + items.map(indent).join(space ? ',\n' : ',') + (space ? '\n]' : ']') 29 | } 30 | case typeof data === 'bigint': { 31 | return (data as BigInt).toString() 32 | } 33 | default: 34 | throw new Error('parse error'); 35 | } 36 | } 37 | 38 | export default { 39 | stringify: (data) => `(value = ""): T { 6 | return unserialize(value) 7 | }, 8 | stringify(json: any): string { 9 | return serialize(json) 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /packages/ctool-core/src/helper/serialize/yaml.ts: -------------------------------------------------------------------------------- 1 | // https://github.com/nodeca/js-yaml/issues/614 2 | 3 | import yaml from "js-yaml" 4 | 5 | // @ts-ignore 6 | let options = Object.assign({}, yaml.types.int.options); 7 | 8 | options.construct = data => { 9 | let value = data, sign = 1n, ch; 10 | 11 | if (value.indexOf('_') !== -1) { 12 | value = value.replace(/_/g, ''); 13 | } 14 | 15 | ch = value[0]; 16 | if (ch === '-' || ch === '+') { 17 | if (ch === '-') sign = -1n; 18 | value = value.slice(1); 19 | ch = value[0]; 20 | } 21 | if (Number.isSafeInteger(ch === "-" ? -value : +value)) { 22 | return ch === "-" ? -1 * value : 1 * value 23 | } 24 | return sign * BigInt(value); 25 | }; 26 | 27 | 28 | options.predicate = object => { 29 | return Object.prototype.toString.call(object) === '[object BigInt]' 30 | // @ts-ignore 31 | || yaml.types.int.options.predicate(object); 32 | }; 33 | 34 | 35 | let BigIntType = new yaml.Type('tag:yaml.org,2002:int', options); 36 | 37 | const SCHEMA = yaml.DEFAULT_SCHEMA.extend({implicit: [BigIntType]}); 38 | 39 | export default { 40 | dump: (data) => { 41 | return yaml.dump(data, {schema: SCHEMA}) 42 | }, 43 | load: (data) => { 44 | return yaml.load(data, {schema: SCHEMA}) 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /packages/ctool-core/src/helper/stat.ts: -------------------------------------------------------------------------------- 1 | import {stringify} from "qs"; 2 | import {version} from "./util" 3 | import {getCurrentLocale} from "@/i18n" 4 | import platform from "./platform" 5 | import {getUserUuid} from "@/store/user" 6 | 7 | export const report = (data: Record = {}) => { 8 | setTimeout(() => { 9 | try { 10 | let img = new Image(1, 1); 11 | img.src = 'https://www.baiy.org/chrome_tool/stat/?' + stringify({ 12 | v: version, 13 | u: getUserUuid(), 14 | p: platform.name, 15 | l: getCurrentLocale(), 16 | r: Math.random(), 17 | ...data 18 | }); 19 | } catch (e) { 20 | } 21 | }, 3000) 22 | } 23 | -------------------------------------------------------------------------------- /packages/ctool-core/src/index.ts: -------------------------------------------------------------------------------- 1 | setTimeout(function () { 2 | window.location.href = "tool.html" 3 | }, 1); 4 | export {} 5 | -------------------------------------------------------------------------------- /packages/ctool-core/src/statics/tools/code/run_api_config.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baiy/Ctool/d1088f9dc31bbf71106acb0858a64941aec48da3/packages/ctool-core/src/statics/tools/code/run_api_config.png -------------------------------------------------------------------------------- /packages/ctool-core/src/statics/tools/crontab/crontab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/baiy/Ctool/d1088f9dc31bbf71106acb0858a64941aec48da3/packages/ctool-core/src/statics/tools/crontab/crontab.png -------------------------------------------------------------------------------- /packages/ctool-core/src/store/user.ts: -------------------------------------------------------------------------------- 1 | // 用户 2 | import {defineStore} from '@/helper/pinia' 3 | import {ref} from 'vue'; 4 | import {uuid} from '@/helper/util'; 5 | import storage from '@/helper/storage'; 6 | 7 | export const getUserUuid = () => { 8 | const name = 'user_uuid' 9 | let id = storage.get(name, null, false) 10 | if (!id) { 11 | id = uuid(); 12 | storage.setNoVersion(name, id) 13 | } 14 | return id; 15 | } 16 | 17 | export default defineStore('user', () => { 18 | const userUuid = ref(getUserUuid()) 19 | return {userUuid} 20 | }, false) 21 | 22 | 23 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tool.ts: -------------------------------------------------------------------------------- 1 | import { createApp } from "vue"; 2 | import { pinia } from "@/helper/pinia"; 3 | import platform from "@/helper/platform"; 4 | import storage from "@/helper/storage"; 5 | import ctool from "@/helper/plugin"; 6 | import router from "@/helper/router"; 7 | import "@/statics/style.css"; 8 | import Tool from "@/Tool.vue"; 9 | import { initPermission as initClipboardPermission } from "@/helper/clipboard"; 10 | 11 | (async () => { 12 | await initClipboardPermission(); 13 | if (document.body.clientWidth > 850 || platform.isUtools() || platform.isWeb() || platform.isDesktop()) { 14 | const page = document.getElementById("ctool"); 15 | if (page) { 16 | page.style.width = "auto"; 17 | page.style.height = "auto"; 18 | } 19 | } 20 | const app = createApp(Tool); 21 | app.use(pinia).use(router).use(ctool).mount("#app"); 22 | })(); 23 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/arm/i18n/en.json5: -------------------------------------------------------------------------------- 1 | { 2 | "info_source": "Information Source: ", 3 | "convert": "Convert", 4 | "output": "Output", 5 | "error": "error: {0}" 6 | } 7 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/arm/i18n/zh_CN.json5: -------------------------------------------------------------------------------- 1 | { 2 | "info_source": "数据来源:", 3 | "convert": "转换", 4 | "output": "输出", 5 | "error": "错误: {0}" 6 | } 7 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/ascii/i18n/zh_CN.json5: -------------------------------------------------------------------------------- 1 | { 2 | "input_prompt": "请输入待转换 {0} 数字, 多个用空格分隔", 3 | input_str_prompt: "请输入待转换 ascii 字符串", 4 | "input_str": "字符串", 5 | "input_bin": "二进制", 6 | "input_oct": "八进制", 7 | "input_dec": "十进制", 8 | "input_hex": "十六进制", 9 | "yes": "是", 10 | "no": "否", 11 | "is_visible": "是否可见", 12 | "description": "描述", 13 | "code_nul": "空字符(Null)", 14 | "code_soh": "标题开始", 15 | "code_stx": "本文开始", 16 | "code_etx": "本文结束", 17 | "code_eot": "传输结束", 18 | "code_enq": "请求", 19 | "code_ack": "确认回应", 20 | "code_bel": "响铃", 21 | "code_bs": "退格", 22 | "code_tab": "水平定位符号", 23 | "code_lf": "换行键", 24 | "code_vt": "垂直定位符号", 25 | "code_ff": "换页键", 26 | "code_cr": "归位键", 27 | "code_so": "取消变换(Shift out)", 28 | "code_si": "启用变换(Shift in)", 29 | "code_dle": "跳出数据通讯", 30 | "code_dc1": "设备控制一(XON 启用软件速度控制)", 31 | "code_dc2": "设备控制二", 32 | "code_dc3": "设备控制三(XOFF 停用软件速度控制)", 33 | "code_dc4": "设备控制四", 34 | "code_nak": "确认失败回应", 35 | "code_syn": "同步用暂停", 36 | "code_etb": "区块传输结束", 37 | "code_can": "取消", 38 | "code_em": "连接介质中断", 39 | "code_sub": "替换", 40 | "code_esc": "跳出", 41 | "code_fs": "文件分割符", 42 | "code_gs": "组群分隔符", 43 | "code_rs": "记录分隔符", 44 | "code_us": "单元分隔符", 45 | "code_del": "删除", 46 | "code_space": "空格" 47 | } 48 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/asn1/i18n/en.json5: -------------------------------------------------------------------------------- 1 | { 2 | "input_der_text": "Please enter ASN.1 DER text", 3 | "output_result": "decode result" 4 | } 5 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/asn1/i18n/zh_CN.json5: -------------------------------------------------------------------------------- 1 | { 2 | "input_der_text": "请输入ASN.1 DER格式文本", 3 | "output_result": "解码结果" 4 | } 5 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/barcode/i18n/en.json5: -------------------------------------------------------------------------------- 1 | { 2 | "background": "Background", 3 | "line_color": "Line Color", 4 | "bar_width": "Width", 5 | "height": "Height", 6 | "margin": "Margin", 7 | "text": "Text", 8 | "close": "Hide", 9 | "top": "Top", 10 | "bottom": "Bottom", 11 | "text_align": "Align", 12 | "left": "Left", 13 | "center": "Center", 14 | "right": "Right", 15 | "font": "Font", 16 | "bold": "Bold", 17 | "italic": "Italic", 18 | "font_size": "Size", 19 | "generate_fail": "Generate Failure" 20 | } 21 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/barcode/i18n/zh_CN.json5: -------------------------------------------------------------------------------- 1 | { 2 | "background": "背景", 3 | "line_color": "线条颜色", 4 | "bar_width": "宽", 5 | "height": "高", 6 | "margin": "边距", 7 | "text": "文本", 8 | "close": "隐藏", 9 | "top": "上方", 10 | "bottom": "下方", 11 | "text_align": "对齐", 12 | "left": "居左", 13 | "center": "居中", 14 | "right": "居右", 15 | "font": "字体", 16 | "bold": "粗体", 17 | "italic": "斜体", 18 | "font_size": "大小", 19 | "generate_fail": "生成失败" 20 | } 21 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/base64/Decoder.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | 28 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/base64/Encoder.vue: -------------------------------------------------------------------------------- 1 | 21 | 22 | 31 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/bcrypt/i18n/en.json5: -------------------------------------------------------------------------------- 1 | { 2 | "generate": "Generate", 3 | "password": "String", 4 | "hash": "Hash", 5 | "rounds": "Rounds", 6 | "check": "check", 7 | "check_result_success": "Right", 8 | "check_result_error": "Wrong", 9 | "rounds_range": "Rounds range [{0} - {1}]", 10 | } 11 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/bcrypt/i18n/zh_CN.json5: -------------------------------------------------------------------------------- 1 | { 2 | "generate": "生成", 3 | "password": "明文(String)", 4 | "hash": "哈希(Hash)", 5 | "rounds": "Rounds", 6 | "check": "校验", 7 | "check_result_success": "正确", 8 | "check_result_error": "错误", 9 | "rounds_range": "Rounds 范围 [{0} - {1}]" 10 | } 11 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/bcrypt/worker.ts: -------------------------------------------------------------------------------- 1 | import bcrypt from "bcryptjs"; 2 | 3 | // Helper function to send messages back to the main thread 4 | const post = (method: string, data: any) => { 5 | let send = { method, data }; 6 | console.log("worker send", send); 7 | self.postMessage({ method, data }); 8 | }; 9 | 10 | // Function to simulate different bcrypt versions in hashing 11 | const hash = ({ input, rounds, version }) => { 12 | // Generate the salt 13 | let salt = bcrypt.genSaltSync(rounds); 14 | 15 | // Simulate version by replacing the prefix of the salt 16 | if (version === '2y') { 17 | salt = salt.replace(/\$2a\$/, "$2y$"); 18 | } else if (version === '2b') { 19 | salt = salt.replace(/\$2a\$/, "$2b$"); 20 | } 21 | 22 | // Hash the input with the modified salt 23 | bcrypt.hash(input, salt, (err, hash) => post('hash', { err, hash, version })); 24 | }; 25 | 26 | // Function to compare input with hash 27 | const compare = ({ input, hash }) => { 28 | bcrypt.compare(input, hash, (err, res) => post('compare', { err, res })); 29 | }; 30 | 31 | // Event listener to handle incoming messages 32 | self.addEventListener('message', function (e) { 33 | console.log("worker accept", e.data); 34 | const data = e.data; 35 | if (data.method === "hash") { 36 | return hash(data.data); 37 | } 38 | if (data.method === "compare") { 39 | return compare(data.data); 40 | } 41 | }, false); 42 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/binary/i18n/en.json5: -------------------------------------------------------------------------------- 1 | { 2 | "input": "Input", 3 | "length": "{0} bit", 4 | "true_form": "trueForm", 5 | "inverse": "Inverse", 6 | "complement": "Complement", 7 | "error": "error: {0}" 8 | } 9 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/binary/i18n/zh_CN.json5: -------------------------------------------------------------------------------- 1 | { 2 | "input": "输入", 3 | "length": "{0} 位", 4 | "true_form": "原码", 5 | "inverse": "反码", 6 | "complement": "补码", 7 | "error": "错误: {0}" 8 | } 9 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/angular.ts: -------------------------------------------------------------------------------- 1 | import prettier from "prettier/standalone"; 2 | import parserAngular from "prettier/parser-angular"; 3 | import Base from "./base"; 4 | 5 | export const formatter = new (class extends Base<'angular'> { 6 | async beautify(): Promise { 7 | return prettier.format(this.code, { 8 | plugins: [parserAngular], 9 | parser: "angular", 10 | tabWidth: this.getOptionValue('tab', 4) 11 | }); 12 | } 13 | }) 14 | 15 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/base.ts: -------------------------------------------------------------------------------- 1 | import {Languages, Format, OptionMap} from "./types" 2 | 3 | 4 | export default abstract class implements Format { 5 | protected name: T | string = ""; 6 | protected code: string = "" 7 | protected option?: OptionMap[T] 8 | 9 | getOptionValue(key: K, defaultValue: OptionMap[T][K]) { 10 | if (this.option === undefined || this.option[key] === undefined) { 11 | return defaultValue 12 | } 13 | return this.option[key] 14 | } 15 | 16 | setName(value: T) { 17 | this.name = value; 18 | return this 19 | } 20 | 21 | set(code: string, option?: OptionMap[T]) { 22 | this.code = code; 23 | this.option = option; 24 | return this 25 | } 26 | 27 | async beautify(): Promise { 28 | throw new Error($t(`code_not_support`, [`${this.name}`, $t(`code_beautify`)])) 29 | } 30 | 31 | async compress(): Promise { 32 | throw new Error($t(`code_not_support`, [`${this.name}`, $t(`code_compress`)])) 33 | } 34 | 35 | async format(type: "beautify" | "compress"): Promise { 36 | const result = type === "beautify" ? await this.beautify() : await this.compress() 37 | return new Promise((resolve) => { 38 | resolve(result) 39 | }) 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/css.ts: -------------------------------------------------------------------------------- 1 | import prettier from "prettier/standalone"; 2 | import parserCss from "prettier/parser-postcss"; 3 | import {minify} from 'csso'; 4 | import Base from "./base"; 5 | 6 | export const formatter = new (class extends Base<'css'> { 7 | async beautify(): Promise { 8 | return prettier.format(this.code, { 9 | plugins: [parserCss], 10 | parser: "css", 11 | tabWidth: this.getOptionValue('tab', 4) 12 | }); 13 | } 14 | 15 | async compress(): Promise { 16 | return minify(this.code, {restructure: false}).css; 17 | } 18 | }) 19 | 20 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/graphql.ts: -------------------------------------------------------------------------------- 1 | import prettier from "prettier/standalone"; 2 | import parserGraphql from "prettier/parser-graphql"; 3 | import Base from "./base"; 4 | 5 | export const formatter = new (class extends Base<'graphql'> { 6 | async beautify(): Promise { 7 | return prettier.format(this.code, { 8 | plugins: [parserGraphql], 9 | parser: "graphql", 10 | tabWidth: this.getOptionValue('tab', 4) 11 | }); 12 | } 13 | }) 14 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/html.ts: -------------------------------------------------------------------------------- 1 | import prettier from "prettier/standalone"; 2 | import parserHtml from "prettier/parser-html"; 3 | import Base from "./base"; 4 | 5 | export const formatter = new (class extends Base<'html'> { 6 | async beautify(): Promise { 7 | return prettier.format(this.code, { 8 | plugins: [parserHtml], 9 | parser: "html", 10 | tabWidth: this.getOptionValue('tab', 4) 11 | }); 12 | } 13 | 14 | async compress(): Promise { 15 | let headHtml = ""; 16 | let code = this.code; 17 | code = code.replace(/(\r\n|\n|\r|\t)/gm, ""); 18 | code = code.replace(/\s+/g, " "); 19 | code = code.replace(new RegExp(" { 6 | async beautify(): Promise { 7 | return prettier.format(this.code, { 8 | plugins: [javaPlugin], 9 | parser: "java", 10 | tabWidth: this.getOptionValue('tab', 4) 11 | }); 12 | } 13 | }) 14 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/javascript.ts: -------------------------------------------------------------------------------- 1 | import Base from "./base" 2 | import UglifyJS from 'uglify-js-export'; 3 | import prettier from "prettier/standalone"; 4 | import parser from "prettier/parser-babel"; 5 | 6 | export const formatter = new (class extends Base<"javascript"> { 7 | async beautify(): Promise { 8 | return prettier.format(this.code, { 9 | plugins: [parser], 10 | parser: "babel", 11 | tabWidth: this.getOptionValue('tab', 4) 12 | }); 13 | } 14 | 15 | async compress(): Promise { 16 | let result = UglifyJS.minify(this.code, { 17 | keep_fnames: true, 18 | compress: false, 19 | mangle: false, 20 | output: { 21 | beautify: false, 22 | } 23 | }) 24 | if (!("code" in result) || !result.code) { 25 | throw new Error(JSON.stringify(result.error)) 26 | } 27 | return result.code 28 | } 29 | }) 30 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/json.ts: -------------------------------------------------------------------------------- 1 | import prettier from "prettier/standalone"; 2 | import parserJson5 from "prettier/parser-babel"; 3 | import Base from "./base"; 4 | import jsonMinify from "./jsonMinify"; 5 | 6 | 7 | export const formatter = new (class extends Base<"json"> { 8 | async beautify(): Promise { 9 | return prettier.format(this.code, { 10 | parser: "json", 11 | plugins: [parserJson5], 12 | quoteProps: "preserve", 13 | trailingComma: "none", 14 | tabWidth: this.getOptionValue("tab", 4), 15 | printWidth: 1, 16 | }); 17 | } 18 | 19 | async compress(): Promise { 20 | return jsonMinify(this.code); 21 | } 22 | }); 23 | 24 | 25 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/less.ts: -------------------------------------------------------------------------------- 1 | import prettier from "prettier/standalone"; 2 | import parserCss from "prettier/parser-postcss"; 3 | import Base from "./base"; 4 | 5 | export const formatter = new (class extends Base<'less'> { 6 | 7 | async beautify(): Promise { 8 | return prettier.format(this.code, { 9 | plugins: [parserCss], 10 | parser: "less", 11 | tabWidth: this.getOptionValue('tab', 4) 12 | }); 13 | } 14 | }) 15 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/markdown.ts: -------------------------------------------------------------------------------- 1 | import prettier from "prettier/standalone"; 2 | import parser from "prettier/parser-markdown"; 3 | import Base from "./base"; 4 | 5 | export const formatter = new (class extends Base<'markdown'> { 6 | async beautify(): Promise { 7 | return prettier.format(this.code, { 8 | plugins: [parser], 9 | parser: "markdown", 10 | tabWidth: this.getOptionValue('tab', 4) 11 | }); 12 | } 13 | }) 14 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/php.ts: -------------------------------------------------------------------------------- 1 | import prettier from "prettier/standalone"; 2 | import phpPlugin from "@prettier/plugin-php/standalone"; 3 | import Base from "./base"; 4 | 5 | export const formatter = new (class extends Base<'php'> { 6 | async beautify(): Promise { 7 | return prettier.format(this.code, { 8 | plugins: [phpPlugin], 9 | parser: "php", 10 | tabWidth: this.getOptionValue('tab', 4) 11 | }); 12 | } 13 | }) 14 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/scss.ts: -------------------------------------------------------------------------------- 1 | import prettier from "prettier/standalone"; 2 | import parserCss from "prettier/parser-postcss"; 3 | import Base from "./base"; 4 | 5 | export const formatter = new (class extends Base<'scss'> { 6 | async beautify(): Promise { 7 | return prettier.format(this.code, { 8 | plugins: [parserCss], 9 | parser: "scss", 10 | tabWidth: this.getOptionValue('tab', 4) 11 | }); 12 | } 13 | }) 14 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/sql.ts: -------------------------------------------------------------------------------- 1 | import {format} from 'sql-formatter'; 2 | import Base from "./base"; 3 | 4 | export const formatter = new (class extends Base<'sql'> { 5 | async beautify(): Promise { 6 | return format(this.code, { 7 | language: this.option?.language || "sql", 8 | tabWidth: this.getOptionValue('tab', 4) 9 | }); 10 | } 11 | 12 | async compress(): Promise { 13 | return this.code.replace(/\s+/g, " ").replace(/\s+\(/, "(").replace(/\s+\)/, ")") 14 | } 15 | }) 16 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/types.ts: -------------------------------------------------------------------------------- 1 | import {SqlLanguage, formatters as sqlFormatters} from 'sql-formatter'; 2 | 3 | type GlobalOption = { 4 | tab: number 5 | } 6 | 7 | export interface OptionMap { 8 | javascript: GlobalOption 9 | json: GlobalOption 10 | typescript: GlobalOption 11 | css: GlobalOption 12 | php: GlobalOption 13 | java: GlobalOption 14 | less: GlobalOption 15 | scss: GlobalOption 16 | markdown: GlobalOption 17 | yaml: GlobalOption 18 | xml: { collapse_content: boolean } & GlobalOption 19 | html: GlobalOption 20 | sql: { language: SqlLanguage } & GlobalOption 21 | vue: GlobalOption 22 | angular: GlobalOption 23 | graphql: GlobalOption 24 | } 25 | 26 | export type Languages = keyof OptionMap 27 | 28 | export interface Format { 29 | format(type: "beautify" | "compress"): Promise 30 | 31 | setName(value: T): Format 32 | 33 | set(code: string, option?: OptionMap[T]): Format 34 | } 35 | 36 | export interface Config { 37 | beautify: boolean 38 | compress: boolean 39 | load: () => Promise> 40 | } 41 | 42 | export const sqlLanguages = Object.keys(sqlFormatters).sort() 43 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/typescript.ts: -------------------------------------------------------------------------------- 1 | import prettier from "prettier/standalone"; 2 | import parserTypeScript from "prettier/parser-typescript"; 3 | import Base from "./base"; 4 | 5 | export const formatter = new (class extends Base<'typescript'> { 6 | async beautify(): Promise { 7 | return prettier.format(this.code, { 8 | plugins: [parserTypeScript], 9 | parser: "typescript", 10 | tabWidth: this.getOptionValue('tab', 4) 11 | }); 12 | } 13 | }) 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/vue.ts: -------------------------------------------------------------------------------- 1 | import prettier from "prettier/standalone"; 2 | import parserHtml from "prettier/parser-html"; 3 | import Base from "./base"; 4 | 5 | export const formatter = new (class extends Base<'vue'> { 6 | async beautify(): Promise { 7 | return prettier.format(this.code, { 8 | plugins: [parserHtml], 9 | parser: "vue", 10 | tabWidth: this.getOptionValue('tab', 4) 11 | }); 12 | } 13 | }) 14 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/xml.ts: -------------------------------------------------------------------------------- 1 | import xmlFormatter from "xml-formatter" 2 | import Base from "./base"; 3 | 4 | export const formatter = new (class extends Base<'xml'> { 5 | 6 | async beautify(): Promise { 7 | return xmlFormatter(this.code, { 8 | indentation: " ".repeat(this.getOptionValue('tab', 4)), 9 | collapseContent: this.getOptionValue('collapse_content', false), 10 | lineSeparator: '\n' 11 | }); 12 | } 13 | 14 | async compress(): Promise { 15 | return xmlFormatter(this.code, { 16 | indentation: '', 17 | collapseContent: true, 18 | lineSeparator: '' 19 | }) 20 | } 21 | }) 22 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/formatter/yaml.ts: -------------------------------------------------------------------------------- 1 | import prettier from "prettier/standalone"; 2 | import parser from "prettier/parser-yaml"; 3 | import Base from "./base"; 4 | 5 | export const formatter = new (class extends Base<'yaml'> { 6 | 7 | async beautify(): Promise { 8 | return prettier.format(this.code, { 9 | plugins: [parser], 10 | parser: "yaml", 11 | tabWidth: this.getOptionValue('tab', 4) 12 | }); 13 | } 14 | }) 15 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/i18n/en.json5: -------------------------------------------------------------------------------- 1 | { 2 | "indent_width": "Indent Space {0}", 3 | "indent_width_null": "No Indent", 4 | "xml_collapse_content": "Collapse Content", 5 | "beautify": "Beautify", 6 | "compress": "Compress", 7 | "run": "Run", 8 | "running": "Running", 9 | "run_used_times": "Today Used Times: {0} ", 10 | "run_config_explain": "Click to get configuration, the third-party service({0}) is at your own risk, and has nothing to do with Ctool", 11 | "not_support": "Not Support {0} {1}" 12 | } 13 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/code/i18n/zh_CN.json5: -------------------------------------------------------------------------------- 1 | { 2 | "beautify": "格式化", 3 | "indent_width": "缩进空格 {0}", 4 | "indent_width_null": "无缩进", 5 | "xml_collapse_content": "内容同行", 6 | "compress": "压缩", 7 | "run": "运行", 8 | "running": "运行中", 9 | "run_used_times": "今日使用次数: {0} ", 10 | "run_config_explain": "点击获取配置, 第三方服务({0})风险自担, 与Ctool没有任何关系", 11 | "not_support": "暂不支持{0}的{1}" 12 | } 13 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/color/i18n/en.json5: -------------------------------------------------------------------------------- 1 | { 2 | "input_placeholder": "Please enter color {0} value, e.g. {1}", 3 | } 4 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/color/i18n/zh_CN.json5: -------------------------------------------------------------------------------- 1 | { 2 | "input_placeholder": "请输入颜色 {0} 值 例子:{1}", 3 | } 4 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/crontab/generate/Option.vue: -------------------------------------------------------------------------------- 1 | 9 | 10 | 25 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/crontab/generate/style.css: -------------------------------------------------------------------------------- 1 | .ctool-crontab-generate-layout { 2 | display: grid; 3 | grid-template-columns: auto auto minmax(0, 1fr); 4 | gap: 20px 10px; 5 | align-items: center; 6 | } 7 | .ctool-crontab-generate-layout .ctool-input input { 8 | text-align: center; 9 | } 10 | .ctool-crontab-generate-layout .ctool-input { 11 | width: 60px; 12 | } 13 | .ctool-crontab-generate-layout .ctool-checkbox .ctool-bool{ 14 | height: 24px; 15 | } 16 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/crontab/generate/type.ts: -------------------------------------------------------------------------------- 1 | export type ItemType = "second" | "minute" | "hour" | "day" | "month" | "week" 2 | export type OptionType = "any" | "scope" | "interval" | "list" | "ignore" 3 | export type OptionValue = { 4 | any: "*", 5 | scope: { 6 | start: number, 7 | end: number, 8 | }, 9 | interval: { 10 | start: string, 11 | step: number 12 | }, 13 | list: (string | number)[] 14 | } 15 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/crontab/i18n/en.json5: -------------------------------------------------------------------------------- 1 | { 2 | "expression": "Expression", 3 | "execute_time": "Execute Time", 4 | "example": "Example", 5 | "format": "Format", 6 | "execute_time_list": "Execute Time List", 7 | "no": "{0}: {1}", 8 | "symbol": "Symbol", 9 | "l_prompt": "Use the 'L' parameter with caution and confirm in advance whether the environment supports it.", 10 | "second_prompt": "Use sub-second tasks with caution and confirm in advance whether the environment supports them.", 11 | "description": "Description", 12 | "symbol_description_1": "any value", 13 | "symbol_description_2": "value list separator", 14 | "symbol_description_3": "range of values", 15 | "symbol_description_4": "step values", 16 | "generate": "Generate", 17 | "generate_ignore": "Ignore", 18 | "generate_second": "Second", 19 | "generate_minute": "Minute", 20 | "generate_hour": "Hour", 21 | "generate_day": "Day", 22 | "generate_month": "Month", 23 | "generate_week": "Week", 24 | "generate_any": "Any", 25 | "generate_scope": "Scope", 26 | "generate_interval": "Interval", 27 | "generate_list": "List", 28 | } 29 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/crontab/i18n/zh_CN.json5: -------------------------------------------------------------------------------- 1 | { 2 | "expression": "表达式", 3 | "execute_time": "最近执行时间", 4 | "example": "例子", 5 | "format": "格式", 6 | "execute_time_list": "最近10次执行时间", 7 | "no": "第{0}次: {1}", 8 | "symbol": "特殊符号", 9 | "l_prompt": "谨慎使用 'L' 参数, 提前确认环境是否支持", 10 | "second_prompt": "谨慎使用 秒级 任务, 提前确认环境是否支持", 11 | "description": "描述", 12 | "symbol_description_1": "代表任何时刻都接受的意思。举例来说,范例一内那个日、月、周都是*,就代表着不论何月、何日的礼拜几的12:00都执行后续命令的意思。", 13 | "symbol_description_2": "代表分隔时段的意思。举例来说,如果要执行的工作是3:00与6:00时,就会是:0 3,6 * * * command时间还是有五列,不过第二列是 3,6 ,代表3与6都适用", 14 | "symbol_description_3": "代表一段时间范围内,举例来说,8点到12点之间的每小时的20分都进行一项工作:20 8-12 * * * command仔细看到第二列变成8-12.代表 8,9,10,11,12 都适用的意思", 15 | "symbol_description_4": "那个n代表数字,即是每隔n单位间隔的意思,例如每五分钟进行一次,则:*/5 * * * * command用*与/5来搭配,也可以写成0-59/5,意思相同", 16 | "generate": "生成", 17 | "generate_ignore": "忽略", 18 | "generate_second": "秒", 19 | "generate_minute": "分", 20 | "generate_hour": "时", 21 | "generate_day": "日", 22 | "generate_month": "月", 23 | "generate_week": "周", 24 | "generate_any": "任意", 25 | "generate_scope": "范围", 26 | "generate_interval": "间隔", 27 | "generate_list": "指定", 28 | } 29 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/dataValidation/util.ts: -------------------------------------------------------------------------------- 1 | import radix from "@/helper/radix"; 2 | import {padStart} from "lodash"; 3 | import Text from "@/helper/text"; 4 | import crcHandle from 'crc'; 5 | 6 | export type CrcType = keyof typeof crcHandle; 7 | export const crcTypeLists = Object.keys(crcHandle) as CrcType[] 8 | 9 | export const bcc = (text: Text) => { 10 | let result = 0 11 | text.toHexArray().forEach(item => { 12 | result ^= parseInt(item, 16); 13 | }) 14 | return result; 15 | } 16 | 17 | export const lrc = (text: Text) => { 18 | let result = 0 19 | text.toHexArray().forEach(item => { 20 | result += parseInt(item, 16); 21 | }) 22 | return 256 - (result % 256); 23 | } 24 | 25 | export const crc = async (text: Text, type: CrcType) => { 26 | const handle = await import('crc'); 27 | return handle[type](text.toBuffer()) 28 | } 29 | 30 | export const result = (value: number, type: string) => { 31 | type = type.toLowerCase() 32 | if (type === "oct") { 33 | return radix(value, 10, 8) 34 | } 35 | if (type === "hex") { 36 | const temp = radix(value, 10, 16) 37 | return padStart(temp, Math.ceil(temp.length / 2) * 2, "0") 38 | } 39 | if (type === "bin") { 40 | const temp = radix(value, 10, 2) 41 | return padStart(temp, Math.ceil(temp.length / 8) * 8, "0") 42 | } 43 | return `${value}` 44 | } 45 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/diffs/Diffs.vue: -------------------------------------------------------------------------------- 1 | 13 | 51 | 52 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/diffs/i18n/en.json5: -------------------------------------------------------------------------------- 1 | { 2 | "collapse":"Collapse Identical", 3 | "revert_direction": "Revert Direction", 4 | "left_to_right":"Left => Right", 5 | "right_to_left":"Left <= Right", 6 | } 7 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/diffs/i18n/zh_CN.json5: -------------------------------------------------------------------------------- 1 | { 2 | "collapse": "折叠相同", 3 | "revert_direction": "覆盖方向", 4 | "left_to_right": "左 => 右", 5 | "right_to_left": "左 <= 右" 6 | } 7 | -------------------------------------------------------------------------------- /packages/ctool-core/src/tools/dockerCompose/DockerCompose.vue: -------------------------------------------------------------------------------- 1 |