Skip to content

Commit

Permalink
优化结构,去掉部分图片
Browse files Browse the repository at this point in the history
  • Loading branch information
ipuppet committed Jun 26, 2024
1 parent 97f364b commit d923337
Show file tree
Hide file tree
Showing 21 changed files with 78 additions and 167 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CAIO

> Clipboard all in one.
> A Clipboard tool based on JSBox.
> An iOS clipboard tool based on JSBox.
[See My Blog](https://blog.ultagic.com/#/detail/42/)

Expand All @@ -16,7 +16,7 @@ npm i -g parcel
npm run build
```

You can also use the packaged files directly [dist/CAIO-en.json](./dist/CAIO-en.json).
You can also use the packaged files directly [dist/CAIO.json](./dist/CAIO.json).

## Actions

Expand All @@ -42,7 +42,7 @@ Config Example:
Host: `https://example.com/dav`
User: `guest`
Password: `password123`
Bast Path: `/path/to/save/appdata`
Base Path: `/path/to/save`

## Shortcuts

Expand Down
6 changes: 3 additions & 3 deletions README_CN.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# CAIO

> Clipboard all in one.
> A Clipboard tool based on JSBox.
> An iOS clipboard tool based on JSBox.
[查看我的博客](https://blog.ultagic.com/#/detail/42/)

Expand All @@ -16,7 +16,7 @@ npm i -g parcel
npm run build
```

您也可以直接使用已打包好的文件 [dist/CAIO-zh-Hans.json](./dist/CAIO-zh-Hans.json)
您也可以直接使用已打包好的文件 [dist/CAIO.json](./dist/CAIO.json)

## Actions

Expand All @@ -42,7 +42,7 @@ npm run build
Host: `https://example.com/dav`
User: `guest`
Password: `password123`
Bast Path: `/path/to/save/appdata`
Base Path: `/path/to/save`

## 快捷指令

Expand Down
Binary file modified assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified assets/icon.white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed assets/icon/github.com.jpeg
Binary file not shown.
Binary file removed assets/icon/telegram.png
Binary file not shown.
31 changes: 14 additions & 17 deletions build.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,24 +105,20 @@ function injectContent() {

function buildTextActions() {
const script = fs.readFileSync(distEntryPath, "utf-8")
const folder = path.join(__dirname, "templates")
const templates = fs.readdirSync(folder)
templates.forEach(fileName => {
const filePath = path.join(folder, fileName)
const fileContent = fs.readFileSync(filePath, "utf-8")
const textAction = JSON.parse(fileContent)

textAction.name = config.info.name

for (let i = 0; i < textAction.actions.length; i++) {
if (textAction.actions[i].type === "@flow.javascript") {
textAction.actions[i].parameters.script.value = script
break
}
const template = path.join(__dirname, "template.json")
const fileContent = fs.readFileSync(template, "utf-8")
const textAction = JSON.parse(fileContent)

textAction.name = config.info.name

for (let i = 0; i < textAction.actions.length; i++) {
if (textAction.actions[i].type === "@flow.javascript") {
textAction.actions[i].parameters.script.value = script
break
}
const outputPath = path.join(__dirname, `dist/${outputName}-${fileName}`)
fs.writeFileSync(outputPath, JSON.stringify(textAction, null, 4))
})
}
const outputPath = path.join(__dirname, `dist/${outputName}.json`)
fs.writeFileSync(outputPath, JSON.stringify(textAction, null, 4))
}

function injectPackageJson(packageJson) {
Expand Down Expand Up @@ -160,6 +156,7 @@ async function build() {
} finally {
// 恢复文件内容
fs.unlinkSync(entryFilePath)
fs.unlinkSync(distEntryPath)
fs.writeFileSync(packageJsonPath, packageJsonContent)
}
}
Expand Down
2 changes: 1 addition & 1 deletion config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"info": {
"name": "CAIO",
"version": "2.2.11",
"version": "2.2.12",
"author": "ipuppet",
"module": false
},
Expand Down
29 changes: 0 additions & 29 deletions dist/CAIO-en.json

This file was deleted.

29 changes: 0 additions & 29 deletions dist/CAIO-zh-Hans.json

This file was deleted.

32 changes: 0 additions & 32 deletions dist/CAIO.js

This file was deleted.

29 changes: 29 additions & 0 deletions dist/CAIO.json

Large diffs are not rendered by default.

4 changes: 0 additions & 4 deletions scripts/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@ class AppKernelBase extends Kernel {
}

get isWebdavEnabled() {
if ($app.env === $env.widget) {
// 在小组件中不启用 WebDAV
return false
}
return this.kernel.setting.get("webdav.status")
}

Expand Down
12 changes: 11 additions & 1 deletion scripts/compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class Compatibility {
}

class VersionActions {
version = 12
version = 13
userVersion = $cache.get("compatibility.version") ?? 0

/**
Expand Down Expand Up @@ -281,6 +281,16 @@ class VersionActions {
this.compatibility.deleteFiles(["shared://caio", "storage"])
}
}

ver13() {
this.compatibility.deleteFiles([
"setting.json",
"dist/CAIO-en.json",
"dist/CAIO-zh-Hans.json",
"dist/CAIO.js",
"assets/icon"
])
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion scripts/libs/easy-jsbox.js

Large diffs are not rendered by default.

8 changes: 2 additions & 6 deletions scripts/setting/experimental/taio.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,10 @@ module.exports = new SettingScript({
title: $l10n("ADD_TO_TAIO"),
message: $l10n("SELECT_TAIO_APP")
})
let version = "en"
if ($device.info.language.includes("zh")) {
version = "zh-Hans"
}
$share.sheet([
{
name: `CAIO-${version}.json`,
data: $file.read(`dist/CAIO-${version}.json`)
name: `CAIO.json`,
data: $file.read(`dist/CAIO.json`)
}
])
}
Expand Down
4 changes: 2 additions & 2 deletions scripts/setting/setting.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ const displaySection = {
const aboutSection = {
items: [
new SettingInfo({
icon: ["/assets/icon/github.com.jpeg", "white"],
icon: ["icon_177", "black"],
title: "Github",
value: ["ipuppet/CAIO", "https://github.com/ipuppet/CAIO"]
}),
new SettingInfo({
icon: ["/assets/icon/telegram.png", "white"],
icon: ["icon_172", "#1888bf"],
title: "Telegram",
value: ["JSBoxTG", "https://t.me/JSBoxTG"]
}),
Expand Down
6 changes: 5 additions & 1 deletion scripts/widget.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,13 @@ class AppKernel extends AppKernelBase {
this.logger = new Logger()
this.logger.printToFile(this.fileStorage, "logs/widget.log")

this.setting.set("webdav.status", false)
this.setting.setReadonly()
}

get isWebdavEnabled() {
// 在小组件中不启用 WebDAV
return false
}
}

class Widget {
Expand Down
17 changes: 7 additions & 10 deletions scripts/widget/Actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,10 @@ class ActionsWidget {
} else if (action.icon.indexOf("/") > -1) {
view.props.image = $image(action.icon)
} else {
view.props.symbol = action.icon
view.props.symbol = {
glyph: action.icon,
size: size
}
}

return view
Expand Down Expand Up @@ -97,10 +100,7 @@ class ActionsWidget {
}
},
{
cornerRadius: {
value: 10,
style: 1 // 0: circular, 1: continuous
}
cornerRadius: 10
}
],
views: [
Expand All @@ -109,7 +109,7 @@ class ActionsWidget {
props: {
symbol: {
glyph: action.icon,
size: 32
size: 50 * 0.6
},
color: $color("#ffffff")
}
Expand Down Expand Up @@ -183,10 +183,7 @@ class ActionsWidget {
}
},
{
cornerRadius: {
value: 10,
style: 1 // 0: circular, 1: continuous
}
cornerRadius: 10
}
],
views: [this.getIcon(action, (itemHeight - 5) * 0.6)]
Expand Down
File renamed without changes.
28 changes: 0 additions & 28 deletions templates/zh-Hans.json

This file was deleted.

0 comments on commit d923337

Please sign in to comment.