Skip to content

Commit

Permalink
Merge branch 'dev' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuingsmile committed Mar 14, 2024
2 parents 4c3d0e0 + fccf32f commit f913c04
Show file tree
Hide file tree
Showing 22 changed files with 174 additions and 48 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
# :tada: 2.8.0 (2024-03-14)


### :sparkles: Features

* **custom:** add c1n token setting ([1fdc8fc](https://github.com/Kuingsmile/piclist/commit/1fdc8fc))
* **custom:** add support for cf worker short url service ([9c6504c](https://github.com/Kuingsmile/piclist/commit/9c6504c)), closes [#170](https://github.com/Kuingsmile/piclist/issues/170)
* **custom:** optimize aliyun upload ([2373c64](https://github.com/Kuingsmile/piclist/commit/2373c64))
* **custom:** support force refresh gallery page ([cafb4d5](https://github.com/Kuingsmile/piclist/commit/cafb4d5))


### :pencil: Documentation

* **custom:** prepare for v2.8.0 ([ac2cb0d](https://github.com/Kuingsmile/piclist/commit/ac2cb0d))
* **custom:** update docs ([8d46c9c](https://github.com/Kuingsmile/piclist/commit/8d46c9c))
* **custom:** update FAQ ([3e17647](https://github.com/Kuingsmile/piclist/commit/3e17647))
* **custom:** update wechat ([2c1f40a](https://github.com/Kuingsmile/piclist/commit/2c1f40a))
* **custom:** update wechat group ([dcf5121](https://github.com/Kuingsmile/piclist/commit/dcf5121))



## :tada: 2.7.4 (2024-02-25)


Expand Down
9 changes: 2 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,17 @@ yarn dev
启动项目。

2. 只跟 Electron 主进程相关的代码请在 `src/main` 目录下添加。只跟渲染进程相关的代码请在 `src/renderer` 目录下添加。两个进程都能使用的代码请在 `src/universal` 目录下添加。 **注意**:渲染进程没有 `Node.js` 能力,所有渲染进程需要用到 `Node.js` 模块相关的代码请在 `src/main/events/picgoCoreIPC.ts` 下添加事件进行处理。

3. 所有的跨进程事件名请在 `src/universal/events/constants.ts` 里添加。

4. 所有的全局类型定义请在 `src/universal/types/` 里添加,如果是 `enum`,请在 `src/universal/types/enum.ts` 里添加。

5. 与图床管理功能相关的代码请在`src/main/manage``src/renderer/manage`目录下添加。
5. 与图床管理功能相关的代码请在 `src/main/manage``src/renderer/manage`目录下添加。

## i18n

1.`public/i18n/` 下面创建一种语言的 `yml` 文件,例如 `zh-Hans.yml`。然后参考 `zh-CN.yml` 或者 `en.yml` 编写语言文件。并注意,PicList 会通过语言文件中的 `LANG_DISPLAY_LABEL` 向用户展示该语言的名称。

2.`src/universal/i18n/index.ts` 里添加一种默认语言。其中 `label` 就是语言文件中 `LANG_DISPLAY_LABEL` 的值,`value` 是语言文件名。

3. 如果是对已有语言文件进行更新,请在更新完,务必运行一遍 `yarn gen-i18n`,确保能生成正确的语言定义文件。

## 提交代码

1. 请检查代码没有多余的注释、`console.log` 等调试代码。
2. 提交代码前,请执行命令 `git add . && yarn cz`,唤起 PicGo 的[代码提交规范工具](https://github.com/PicGo/bump-version)。通过该工具提交代码。
2. 提交代码前,请执行命令 `git add . && yarn cz`,唤起 [代码提交规范工具](https://github.com/PicGo/bump-version)。通过该工具提交代码。
7 changes: 1 addition & 6 deletions CONTRIBUTING_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,17 @@ yarn dev
Startup project.

2. Please add code only related to the main process of Electron in the `src/main` directory. Code only related to the rendering process should be added in the `src/renderer` directory. Add code that can be used by both processes in the `src/universal` directory. **Note**: The rendering process does not have the `Node.js` capability. All rendering processes need to use `Node.js modules` related code, please add events under `src/main/events/picgoCoreIPC.ts` for processing.

3. Please add all cross-process event names in `src/universal/events/constants.ts`.

4. Please add all global type definitions in `src/universal/types/`, if it is `enum`, please add it in `src/universal/types/enum.ts`.

5. Code related to the management function of the picture bed should be added in the `src/main/manage` and `src/renderer/manage` directory.

## i18n

1. Create a language `yml` file under `public/i18n/`, for example `zh-Hans.yml`. Then refer to `zh-CN.yml` or `en.yml` to write language files. Also note that PicList will display the name of the language to the user via `LANG_DISPLAY_LABEL` in the language file.

2. Add a default language to `src/universal/i18n/index.ts`. where `label` is the value of `LANG_DISPLAY_LABEL` in the language file, and `value` is the name of the language file.

3. If you are updating an existing language file, be sure to run `yarn gen-i18n` after the update to ensure that the correct language definition file can be generated.

## Submit code

1. Please check that the code has no extra comments, `console.log` and other debugging code.
2. Before submitting the code, please execute the command `git add . && yarn cz` to invoke PicGo's [Code Submission Specification Tool](https://github.com/PicGo/bump-version). Submit code through this tool.
2. Before submitting the code, please execute the command `git add . && yarn cz` to invoke [Code Submission Specification Tool](https://github.com/PicGo/bump-version). Submit code through this tool.
2 changes: 1 addition & 1 deletion FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

## 常见问题

> 本软件的上传工具部分来自PicGo,基本没有改动,请参考PicGo的 [使用文档](https://picgo.github.io/PicGo-Doc/zh/guide/getting-started.html#%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B)
> 常规配置问题请参考 [官方文档](https://piclist.cn)
## 1. PicList和PicGo有什么关系?

Expand Down
11 changes: 6 additions & 5 deletions FAQ_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This FAQ has been modified from PicGo's FAQ, and thanks to the author Molunerfin

## Common Questions

> The upload tool of this software is mainly derived from PicGo, with minimal changes. Please refer to PicGo's [user manual](https://picgo.github.io/PicGo-Doc/zh/guide/getting-started.html#%E5%BF%AB%E9%80%9F%E4%B8%8A%E6%89%8B) for more information.
> Please refer to [user manual](https://piclist.cn) for general configuration issues.
## 1. What is the relationship between PicList and PicGo?

Expand Down Expand Up @@ -79,17 +79,18 @@ Or right-click the PicList icon in the dock and select "Open Main Window."

1. PicList 自带的图床都经过测试,上传出错一般都不是 PicList 自身的原因。如果你用的是 GitHub 图床请参考上面的第 7 点。
2. 检查 PicList 的日志(报错日志可以在 PicList 设置 -> 设置日志文件 -> 点击打开 后找到),看看 `[PicList Error]` 的报错信息里有什么关键信息

1. 先自行搜索 error 里的报错信息,往往你能百度或者谷歌出问题原因,不必开 issue。
2. 如果有带有 `401``403``40X` 状态码字样的,不用怀疑,就是你配置写错了,仔细检查配置,看看是否多了空格之类的。
3. 如果带有 `HttpError``RequestError``socket hang up` 等字样的说明这是网络问题,我无法帮你解决网络问题,请检查你自己的网络,是否有代理,DNS 设置是否正常等。
3. 通常网络问题引起的上传失败都是因为代理设置不当导致的。如果开启了系统代理,建议同时也在 PicList 的代理设置中设置对应的HTTP代理。
4. PicList's built-in image hosting platforms have been tested, and upload errors are generally not caused by PicList itself. If you are using the GitHub image hosting platform, please refer to the 7th point above.
5. Check PicList's log (the error log can be found by clicking "Open" in PicList Settings -> Set Log File ->), and see if there is any key information in the `[PicList Error]` error message

1. PicList's built-in image hosting platforms have been tested, and upload errors are generally not caused by PicList itself. If you are using the GitHub image hosting platform, please refer to the 7th point above.
2. Check PicList's log (the error log can be found by clicking "Open" in PicList Settings -> Set Log File ->), and see if there is any key information in the `[PicList Error]` error message
1. First search for the error message in the error message by yourself, and you can often Baidu or Google the cause of the problem, so you don't need to open an issue.
2. If there are `401`, `403` and other `40X` status code words, don't doubt it, it means that your configuration is wrong, check the configuration carefully to see if there are extra spaces, etc.
3. If there are words such as `HttpError`, `RequestError`, `socket hang up`, etc., it means that this is a network problem, and I cannot help you solve the network problem. Please check your own network, whether there is a proxy, whether the DNS setting is normal, etc.
3. Usually, upload failures caused by network problems are caused by improper proxy settings. If the system proxy is turned on, it is recommended to set the corresponding HTTP proxy in the proxy settings of PicList at the same time.
6. Usually, upload failures caused by network problems are caused by improper proxy settings. If the system proxy is turned on, it is recommended to set the corresponding HTTP proxy in the proxy settings of PicList at the same time.

## 10. After installing the macOS version, there is no main interface

Expand Down Expand Up @@ -170,4 +171,4 @@ Then run:

```bash
docker-compose up -d
```
```
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ If you need to build it yourself, you can start building with `yarn run build`.

## Communication group

If you have any questions, you can join the WeChat group for communication. The group is currently full, please add WeChat `pku_sq_ma` and note `PicList`, and I will add you to the group.
If you have any questions, you can join the WeChat group for communication.

![wechat](https://pichoro.msq.pub/wechat.png)

## License

Expand Down
4 changes: 3 additions & 1 deletion README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ brew uninstall piclist

## 交流群

如果有任何问题,可以加入微信群进行交流,目前群已满,请添加微信号`pku_sq_ma`,备注`PicList`,我会拉你入群。
如果有任何问题,可以加入微信群进行交流.

![wechat](https://pichoro.msq.pub/wechat.png)

## License

Expand Down
15 changes: 10 additions & 5 deletions currentVersion.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
💥 Breaking Change

- 由于[C1N短网址](https://www.c1n.cn/)的收费策略修改,预期可使用API的团队版在1000元/年,作者承担费用压力较大,现在修改为自己提供API token
- 原软件内置提供的c1n token即时失效

✨ Features

- 设置界面添加了新的选项以快速进入配置文件和日志目录
- 优化了github图床云端删除对特殊路径的处理
- 新增对cf workers 短链接项目[xyTom/Url-Shorten-Worker](https://github.com/xyTom/Url-Shorten-Worker)的支持
- 现在相册页面支持强制无视缓存刷新
- 优化了阿里云图床对无扩增名文件的上传处理
- 优化了短网址功能的错误日志记录

🐛 Bug Fixes

- 修复了导入配置时,默认图床名没有跟随当前时间变化的问题
- 修复了内置s3图床的禁用存储桶前缀设置项没有正确生效的问题
- 修复了部分繁体中文翻译错误
- 修复了buffer上传时的文件名错误
15 changes: 10 additions & 5 deletions currentVersion_en.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
💥 Breaking Change

- Due to the upcoming changes in the charging policy of [C1N short URL](https://www.c1n.cn/), the expected team version that can use the API will be around 1000 yuan/year, and the author bears a greater pressure on the cost. Now it is changed to provide the API token by yourself
- The c1n token provided by the original software is immediately invalid

✨ Features

- Add new options in the settings interface to quickly enter the configuration file and log directory
- Optimized the processing of special paths for cloud deletion of github image bed
- Added support for the cf workers short link project [xyTom/Url-Shorten-Worker](https://github.com/xyTom/Url-Shorten-Worker)
- Now the album page supports forced cache refresh
- Optimized the upload processing of files without extension names for Aliyun image bed
- Optimized error log recording for short URL function

🐛 Bug Fixes

- Fix the problem that the default image bed name does not change with the current time when importing the configuration
- Fix the problem that the disable storage bucket prefix setting of the built-in s3 image bed does not take effect correctly
- Fix some translation errors in traditional Chinese
- Fixed the file name error when uploading buffer
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "piclist",
"version": "2.7.4",
"version": "2.8.0",
"author": {
"name": "Kuingsmile",
"email": "pkukuing@gmail.com"
Expand Down Expand Up @@ -68,7 +68,7 @@
"multer": "^1.4.5-lts.1",
"node-ssh-no-cpu-features": "^1.0.1",
"nodejs-file-downloader": "^4.12.1",
"piclist": "^1.7.11",
"piclist": "^1.7.12",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.0",
"proxy-agent": "^5.0.0",
Expand Down
3 changes: 3 additions & 0 deletions public/i18n/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ UPLOAD_AREA: Upload
UPLOAD_VIEW_HINT: Click to open picbeds settings
MANAGE_PAGE: Manage
GALLERY: Gallery
REFRESH: Refresh
MANUAL: Manual
OPEN_MANUAL_LINK: Manual
OPEN_MANUAL_LINK_HINT: Will open the manual link in your browser, do you want to continue?
Expand Down Expand Up @@ -245,8 +246,10 @@ SETTINGS_ENCODE_OUTPUT_URL: Encode Output(or Copyed) URL
SETTINGS_WATCH_CLIPBOARD: Watch clipboard when software start
SETTINGS_SHORT_URL: Use short url
SETTINGS_SHORT_URL_SERVER: Short url server
SETTINGS_SHORT_URL_C1N_TOKEN: C1N Token
SETTINGS_SHORT_URL_YOURLS_DOMAIN: YOURLS domain
SETTINGS_SHORT_URL_YOURLS_SIGNATURE: YOURLS signature
SETTINGS_SHORT_URL_CF_WORKER_HOST: Cloudflare Worker Host
SETTINGS_DELETE_LOCAL_FILE_AFTER_UPLOAD: Delete local file after upload
SETTINGS_SYNC_CONFIG: Settings Sync Configuration
SETTINGS_SYNC_CONFIG_TITLE: Sync Settings
Expand Down
3 changes: 3 additions & 0 deletions public/i18n/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ UPLOAD_AREA: 上传
UPLOAD_VIEW_HINT: 点击打开图床设置
MANAGE_PAGE: 管理
GALLERY: 相册
REFRESH: 刷新
MANUAL: 手册
OPEN_MANUAL_LINK: 前往手册
OPEN_MANUAL_LINK_HINT: 即将打开PicList使用手册网页, 是否继续?
Expand Down Expand Up @@ -248,8 +249,10 @@ SETTINGS_ENCODE_OUTPUT_URL: 输出(复制) URL 时进行转义
SETTINGS_WATCH_CLIPBOARD: 软件启动时自动监听剪贴板上传
SETTINGS_SHORT_URL: 使用短链接
SETTINGS_SHORT_URL_SERVER: 短链接服务
SETTINGS_SHORT_URL_C1N_TOKEN: C1N Token
SETTINGS_SHORT_URL_YOURLS_DOMAIN: YOURLS域名
SETTINGS_SHORT_URL_YOURLS_SIGNATURE: YOURLS signature
SETTINGS_SHORT_URL_CF_WORKER_HOST: Cloudflare Worker域名
SETTINGS_DELETE_LOCAL_FILE_AFTER_UPLOAD: 上传后删除本地文件
SETTINGS_SYNC_CONFIG: 设置配置同步
SETTINGS_SYNC_CONFIG_TITLE: 同步设置
Expand Down
3 changes: 3 additions & 0 deletions public/i18n/zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ UPLOAD_AREA: 上傳
UPLOAD_VIEW_HINT: 點擊打開圖床設定
MANAGE_PAGE: 管理
GALLERY: 相簿
REFRESH: 刷新
MANUAL: 手冊
OPEN_MANUAL_LINK: 手冊
OPEN_MANUAL_LINK_HINT: 即將打開PicList使用手冊網頁,是否繼續?
Expand Down Expand Up @@ -246,8 +247,10 @@ SETTINGS_ENCODE_OUTPUT_URL: 輸出(複製) URL 時進行轉義
SETTINGS_WATCH_CLIPBOARD: 軟體啟動時自動監聽剪貼簿上傳
SETTINGS_SHORT_URL: 使用短網址
SETTINGS_SHORT_URL_SERVER: 短網址服務
SETTINGS_SHORT_URL_C1N_TOKEN: C1N Token
SETTINGS_SHORT_URL_YOURLS_DOMAIN: YOURLS域名
SETTINGS_SHORT_URL_YOURLS_SIGNATURE: YOURLS signature
SETTINGS_SHORT_URL_CF_WORKER_HOST: Cloudflare Worker Host
SETTINGS_DELETE_LOCAL_FILE_AFTER_UPLOAD: 上傳後刪除本地檔案
SETTINGS_SYNC_CONFIG: 設置同步配置
SETTINGS_SYNC_CONFIG_TITLE: 同步設置
Expand Down
5 changes: 5 additions & 0 deletions src/main/events/ipcList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,11 @@ export default {
settingWindow.hide()
})

ipcMain.on('refreshSettingWindow', () => {
const settingWindow = windowManager.get(IWindowList.SETTING_WINDOW)!
settingWindow.webContents.reloadIgnoringCache()
})

// from mini window
ipcMain.on('syncPicBed', () => {
if (windowManager.has(IWindowList.SETTING_WINDOW)) {
Expand Down
30 changes: 25 additions & 5 deletions src/main/utils/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { clipboard, Notification, dialog } from 'electron'
import { handleUrlEncode } from '~/universal/utils/common'
import axios from 'axios'
import FormData from 'form-data'
import { C1 } from '#/utils/static'
import logger from '../apis/core/picgo/logger'

export const handleCopyUrl = (str: string): void => {
Expand Down Expand Up @@ -132,18 +131,22 @@ export const generateShortUrl = async (url: string) => {
if (server === 'c1n') {
const form = new FormData()
form.append('url', url)
const C = Buffer.from(C1, 'base64').toString()
const c1nToken = db.get('settings.c1nToken') || ''
if (!c1nToken) {
logger.warn('c1n token is not set')
return url
}
try {
const res = await axios.post(c1nApi, form, {
headers: {
token: C
token: c1nToken
}
})
if (res.status >= 200 && res.status < 300 && res.data?.code === 0) {
return res.data.data
}
} catch (e: any) {
console.log(e)
logger.error(e)
}
} else if (server === 'yourls') {
let domain = db.get('settings.yourlsDomain') || ''
Expand All @@ -161,11 +164,28 @@ export const generateShortUrl = async (url: string) => {
if (e.response.data.message.indexOf('already exists in database') !== -1) {
return e.response.data.shorturl
}
console.log(e)
logger.error(e)
}
} else {
logger.warn('Yourls server or signature is not set')
}
} else if (server === 'cf_worker') {
let cfWorkerHost = db.get('settings.cfWorkerHost') || ''
cfWorkerHost = cfWorkerHost.replace(/\/$/, '')
if (cfWorkerHost) {
try {
const res = await axios.post(cfWorkerHost, {
url
})
if (res.data.status === 200 && res.data.key.startsWith('/')) {
return `${cfWorkerHost}${res.data.key}`
}
} catch (e: any) {
logger.error(e)
}
} else {
logger.warn('CF Worker host is not set')
}
}
return url
}
29 changes: 27 additions & 2 deletions src/renderer/pages/Gallery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,28 @@
:active-text="$T('SETTINGS_OPEN')"
:inactive-text="$T('SETTINGS_CLOSE')"
@change="handleDeleteCloudFile"
/></span>
/>
<el-button
type="text"
@click="refreshPage"
>
<el-tooltip
class="item"
effect="dark"
:content="$T('REFRESH')"
placement="bottom"
:persistent="false"
teleported
>
<el-icon
size="25"
style="cursor: pointer; margin-left: 10px;"
>
<Refresh />
</el-icon>
</el-tooltip>
</el-button>
</span>
</div>
<transition name="el-zoom-in-top">
<el-row v-show="handleBarActive">
Expand Down Expand Up @@ -447,7 +468,7 @@ import { PASTE_TEXT, GET_PICBEDS } from '#/events/constants'
import { CheckboxValueType, ElMessageBox, ElNotification, ElMessage } from 'element-plus'
// Element Plus 图标
import { InfoFilled, Close, CaretBottom, Document, Edit, Delete, CaretTop, Sort } from '@element-plus/icons-vue'
import { InfoFilled, Close, CaretBottom, Document, Edit, Delete, CaretTop, Sort, Refresh } from '@element-plus/icons-vue'
// Electron 相关
import {
Expand Down Expand Up @@ -653,6 +674,10 @@ function handleChooseImage (val: CheckboxValueType, index: number) {
}
}
function refreshPage () {
ipcRenderer.send('refreshSettingWindow')
}
function clearChoosedList () {
isShiftKeyPress.value = false
Object.keys(choosedList).forEach(key => {
Expand Down
Loading

0 comments on commit f913c04

Please sign in to comment.