Skip to content

Commit

Permalink
Merge pull request #3 from Zuoqiu-Yingyi/dev
Browse files Browse the repository at this point in the history
chore: release v0.1.1
  • Loading branch information
Zuoqiu-Yingyi authored Aug 15, 2023
2 parents 6fe5bd6 + b36fd14 commit f8ed131
Show file tree
Hide file tree
Showing 10 changed files with 500 additions and 13 deletions.
98 changes: 97 additions & 1 deletion public/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ A plugin for [SiYuan Note](https://github.com/siyuan-note/siyuan) that can use [
* `API URL`

* Customize the API service address for `Wakapi/WakaTime`.
* Corresponds to the `api_url` configuration item in the `Wakapi/WakaTime` configuration file.
* Corresponds to the `api_url` configuration option in the `.wakatime.cfg` configuration file of `Wakapi/WakaTime`.
* If empty, the service address of `WakaTime` will be used (`https://wakatime.com/api/v1`).
* If using a hosted `Wakapi` service, it should be set to `https://wakapi.dev/api`.
* If using a privately deployed `Wakapi` service, it should be set to `http(s)://host[:port]/api`.
Expand All @@ -144,23 +144,119 @@ A plugin for [SiYuan Note](https://github.com/siyuan-note/siyuan) that can use [
* `API KEY`

* Customize the access key for the `Wakapi/WakaTime` API service.
* Corresponds to the `api_key` configuration option in the `.wakatime.cfg` configuration file of `Wakapi/WakaTime`.
* This is a required field, and if not set, a connection cannot be established with `Wakapi/WakaTime`.
* `Hostname`

* Customize the device name.
* Corresponds to the `hostname` configuration option in the `.wakatime.cfg` configuration file of `Wakapi/WakaTime`.
* If empty, the host name of the device where Obsidian is located will be used.
* `Timeout`

* Timeout duration when calling the `Wakapi/WakaTime` API.
* Corresponds to the `timeout` configuration option in the `.wakatime.cfg` configuration file of `Wakapi/WakaTime`.
* Unit: seconds
* `Hide Notebook Name`

* Whether to hide the notebook name in the submitted activity information.
* Corresponds to the `hide_branch_names` configuration option in the `.wakatime.cfg` configuration file of `Wakapi/WakaTime`.
* If enabled, all <kbd>Notebook Name</kbd> in the submitted information will be replaced with <kbd>Notebook ID</kbd>.
* `Hide Document Title`

* Whether to hide the document title in the submitted activity information.
* Corresponds to the `hide_file_names` configuration option in the `.wakatime.cfg` configuration file of `Wakapi/WakaTime`.
* If enabled, all <kbd>Document Title</kbd> in the submitted information will be replaced with <kbd>Block ID</kbd>.
* `ID Include List`

* Only submit documents whose ID path includes the list field.
* If empty, it includes all notebooks and documents.
* If not empty, only submit documents whose ID path includes the list field.

* ID path format: `notebook/document/.../document.sy`
* ID path examples:

* `20210808180117-czj9bvb/20200812220555-lj3enxa.sy`
* `20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj.sy`
* One record per line, can be text or regular expression. Regular expressions need to be wrapped in `/` as shown below:

```plaintext
20200812220555-lj3enxa
/^20210917000226-w9fa32i\/20230522022822-roxea7p/
```

The above list is equivalent to the following JavaScript code:

```javascript
path.includes("20200812220555-lj3enxa") && /^20210917000226-w9fa32i\/20230522022822-roxea7p/.test(path)
```

* `20200812220555-lj3enxa`

* Submit documents that have the ID `20200812220555-lj3enxa`, including itself and its sub-documents.

* Example:

* `20210808180117-czj9bvb/20200812220555-lj3enxa.sy`: included
* `20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj.sy`: included
* `20210808180117-czj9bvb/20210117211155-56n4odu.sy`: not included
* `/^20210917000226-w9fa32i\/20230522022822-roxea7p/`

* Submit documents that match the regular expression `^20210917000226-w9fa32i/20230522022822-roxea7p`.

* Example:

* `20210917000226-w9fa32i/20230522022822-roxea7p.sy`: included
* `20210917000226-w9fa32i/20230522022822-roxea7p/20230522022929-ojqqfyn.sy`: included
* `20210917000226-w9fa32i/20220424113742-2eznev2.sy`: not included
* `20210808180117-czj9bvb/20210917000226-w9fa32i/20230522022822-roxea7p.sy`: not included
* `ID Exclude List`

* Exclude documents whose ID path includes the list field when submitting.
* If empty, do not exclude any notebooks or documents.
* If not empty, exclude documents whose ID path includes the list field.

* ID path format and matching rules can be found in `Wakapi/WakaTime > Service Settings > ID Inclusion List`.
* One record per line, can be text or regular expression. Regular expressions need to be wrapped in `/`.
* The exclusion list takes precedence over the inclusion list.

* If a document's ID path matches both the ID inclusion list and the ID exclusion list, the document will be excluded.
* `Include List`
* Only submit documents whose path includes the list field.
* Corresponds to the `include` configuration option in the `.wakatime.cfg` configuration file of `Wakapi/WakaTime`.
* If empty, it includes all notebooks and documents.
* If not empty, only submit documents whose path includes the list field.
* Path format and examples:
| | `Hide notebook names`: ✔ | `Hide notebook names`: ✖<br /> |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ |
| `Hide document titles`: ✔ | `<Notebook ID>/<Document ID>/.../<Document ID>.sy`<br />`20210808180117-czj9bvb/20200812220555-lj3enxa.sy`<br /> | `<Notebook Name>/<Document ID>/.../<Document ID>.sy`<br />`User Guide/20200812220555-lj3enxa.sy`<br /> |
| `Hide document titles`: ✖ | `<Notebook ID>/<Document Title>/.../<Document Title>.sy`<br />`20210808180117-czj9bvb/Start Here.sy` | `<Notebook Name>/<Document Title>/.../<Document Title>.sy`<br />`User Guide/Start Here.sy`<br /> |
* One record per line, can be text or regular expression. Regular expressions need to be wrapped in `/` as shown below:
```plaintext
Start Here
/^User Guide\/Start Here/
```
The above list is equivalent to the following JavaScript code:
```javascript
path.includes("Start Here") && /^User Guide\/Start Here/.test(path)
```
* `Exclude List`
* Exclude documents whose path includes the list field when submitting.
* Corresponds to the `exclude` configuration option in the `.wakatime.cfg` configuration file of `Wakapi/WakaTime`.
* If empty, do not exclude any notebooks or documents.
* If not empty, exclude documents whose path includes the list field.
* Path format and matching rules can be found in `Wakapi/WakaTime > Service Settings > Inclusion List`.
* One record per line, can be text or regular expression. Regular expressions need to be wrapped in `/`.
* The exclusion list takes precedence over the inclusion list.
* If a document's path matches both the inclusion list and the exclusion list, the document will be excluded.

## CHANGELOG

Expand Down
98 changes: 97 additions & 1 deletion public/README_zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
* `API URL`

* 自定义 `Wakapi/WakaTime` API 服务地址
* 对应 `Wakapi/WakaTime` 配置文件中的 `api_url` 配置项
* 对应 `Wakapi/WakaTime` 配置文件 `.wakatime.cfg` 中的 `api_url` 配置项
* 若为空, 则使用 `WakaTime` 的服务地址 `https://wakatime.com/api/v1`
* 若使用托管的 `Wakapi` 服务, 应设置为 `https://wakapi.dev/api`
* 若使用私有部署的 `Wakapi` 服务, 应设置为 `http(s)://host[:port]/api`
Expand All @@ -144,23 +144,119 @@
* `API 密钥`

* 自定义 `Wakapi/WakaTime` API 服务访问密钥
* 对应 `Wakapi/WakaTime` 配置文件 `.wakatime.cfg` 中的 `api_key` 配置项
* 必填项, 若未设置则无法与 `Wakapi/WakaTime` 建立连接
* `主机名称`

* 自定义设备名称
* 对应 `Wakapi/WakaTime` 配置文件 `.wakatime.cfg` 中的 `hostname` 配置项
* 若为空, 则使用思源内核所在设备的主机名
* `超时时间`

* 调用 `Wakapi/WakaTime` API 时的超时时间
* 对应 `Wakapi/WakaTime` 配置文件 `.wakatime.cfg` 中的 `timeout` 配置项
* 单位: 秒
* `隐藏笔记本名称`

* 在提交的操作活动信息中是否隐藏笔记本名称
* 对应 `Wakapi/WakaTime` 配置文件 `.wakatime.cfg` 中的 `hide_branch_names` 配置项
* 若开启, 则提交的信息中所有 <kbd>笔记本名称</kbd> 都替换为 <kbd>笔记本 ID</kbd>
* `隐藏文档标题`

* 在提交的操作活动信息中是否隐藏文档标题
* 对应 `Wakapi/WakaTime` 配置文件 `.wakatime.cfg` 中的 `hide_file_names` 配置项
* 若开启, 则提交的信息中所有 <kbd>文档标题</kbd> 都替换为 <kbd>文档块 ID</kbd>
* `ID 包含列表`

* 仅提交 ID 路径中包含列表字段的文档
* 若为空则包含所有笔记本与文档
* 若不为空则仅提交 ID 路径中包含列表字段的文档

* ID 路径格式: `<笔记本 ID>/<文档 ID>/.../<文档 ID>.sy`
* ID 路径示例

* `20210808180117-czj9bvb/20200812220555-lj3enxa.sy`
* `20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj.sy`
* 每行一个记录, 可以为文本或者正则表达式, 正则表达式首尾需要使用 `/` 包裹, 如下所示

```plaintext
20200812220555-lj3enxa
/^20210917000226-w9fa32i\/20230522022822-roxea7p/
```

上述列表与下述 `JavaScript` 代码等价

```javascript
path.includes("20200812220555-lj3enxa") && /^20210917000226-w9fa32i\/20230522022822-roxea7p/.test(path)
```

* `20200812220555-lj3enxa`

* 提交 ID`20200812220555-lj3enxa` 的笔记本或者文档本身及其下级的文档

* 示例

* `20210808180117-czj9bvb/20200812220555-lj3enxa.sy`: 包含
* `20210808180117-czj9bvb/20200812220555-lj3enxa/20210808180320-fqgskfj.sy`: 包含
* `20210808180117-czj9bvb/20210117211155-56n4odu.sy`: 不包含
* `/^20210917000226-w9fa32i\/20230522022822-roxea7p/`

* 提交匹配正则表达式 `^20210917000226-w9fa32i/20230522022822-roxea7p`` 的文档
* 示例
* `20210917000226-w9fa32i/20230522022822-roxea7p.sy`: 包含
* `20210917000226-w9fa32i/20230522022822-roxea7p/20230522022929-ojqqfyn.sy`: 包含
* `20210917000226-w9fa32i/20220424113742-2eznev2.sy`: 不包含
* `20210808180117-czj9bvb/20210917000226-w9fa32i/20230522022822-roxea7p.sy`: 不包含
* `ID 排除列表`
* 提交时排除 ID 路径中包含列表字段的文档
* 若为空则不排除所有笔记本与文档
* 若不为空则排除 ID 路径中包含列表字段的文档
* ID 路径格式与匹配规则请参考 `Wakapi/WakaTime > 服务设置 > ID 包含列表`
* 每行一个记录, 可以为文本或者正则表达式, 正则表达式首尾需要使用 `/` 包裹
* 排除列表的优先级高于包含列表
* 若一个文档的 ID 路径同时匹配 ID 包含列表与 ID 排除列表, 则该文件会被排除
* `包含列表`
* 仅提交路径中包含列表字段的文档
* 对应 `Wakapi/WakaTime` 配置文件 `.wakatime.cfg` 中的 `include` 配置项
* 若为空则包含所有笔记本与文档
* 若不为空则仅提交路径中包含列表字段的文档
* 路径格式与示例
| | `隐藏笔记本名称`: ✔ | `隐藏笔记本名称`: ✖<br /> |
| ----------------- | ------------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------- |
| `隐藏文档标题`: ✔ | `<笔记本 ID>/<文档 ID>/.../<文档 ID>.sy`<br />`20210808180117-czj9bvb/20200812220555-lj3enxa.sy`<br /> | `<笔记本名称>/<文档 ID>/.../<文档 ID>.sy`<br />`思源笔记用户指南/20200812220555-lj3enxa.sy`<br /> |
| `隐藏文档标题`: ✖ | `<笔记本 ID>/<文档标题>/.../<文档标题>.sy`<br />`20210808180117-czj9bvb/请从这里开始.sy` | `思源笔记用户指南/<文档标题>/.../<文档标题>.sy`<br />`思源笔记用户指南/请从这里开始.sy`<br /> |
* 每行一个记录, 可以为文本或者正则表达式, 正则表达式首尾需要使用 `/` 包裹, 如下所示
```plaintext
请从这里开始
/^思源笔记用户指南\/请从这里开始/
```

上述列表与下述 `JavaScript` 代码等价

```javascript
path.includes("请从这里开始") && /^思源笔记用户指南\/请从这里开始/.test(path)
```
* 排除列表

* 提交时排除路径中包含列表字段的文档
* 对应 `Wakapi/WakaTime` 配置文件 `.wakatime.cfg` 中的 `exclude` 配置项
* 若为空则不排除所有笔记本与文档
* 若不为空则排除路径中包含列表字段的文档

* 路径格式与匹配规则请参考 `Wakapi/WakaTime > 服务设置 > 包含列表`
* 每行一个记录, 可以为文本或者正则表达式, 正则表达式首尾需要使用 `/` 包裹
* 排除列表的优先级高于包含列表

* 若一个文档的路径同时匹配包含列表与排除列表, 则该文件会被排除

## 更改日志

Expand Down
20 changes: 20 additions & 0 deletions public/i18n/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@
"description": "Wakapi/WakaTime API URL<br/>Corresponds to <code class='fn__code'>api_url</code> in Wakapi/WakaTime configuration",
"title": "API URL"
},
"exclude": {
"description": "Exclude documents with fields listed in the submission path.<br/>Each entry should be on a separate line. Use <span data-type='code'>/</span> to enclose regular expressions.<br/>Corresponds to the <span data-type='code'>exclude</span> option in the Wakapi/WakaTime configuration.",
"placeholder": "Exclude no notebooks or documents",
"title": "Exclude List"
},
"excludeID": {
"description": "Exclude documents with fields listed in the submission ID path.<br/>Each entry should be on a separate line. Use <span data-type='code'>/</span> to enclose regular expressions.",
"placeholder": "Exclude no notebooks or documents",
"title": "ID Exclude List"
},
"hide_branch_names": {
"description": "Whether to hide notebook names. If enabled, the notebook name is replaced with the notebook ID<br/>Corresponds to <code class='fn__code'>hide_branch_names</code> in Wakapi/WakaTime configuration",
"title": "Hide notebook names"
Expand All @@ -58,6 +68,16 @@
"description": "Custom current host name<br/>Corresponds to <code class='fn__code'>hostname</code> in Wakapi/WakaTime configuration",
"title": "Hostname"
},
"include": {
"description": "Only include documents with fields listed in the submission path.<br/>Each entry should be on a separate line. Use <span data-type='code'>/</span> to enclose regular expressions.<br/>Corresponds to the <span data-type='code'>include</span> option in the Wakapi/WakaTime configuration.",
"placeholder": "Include all notebooks and documents",
"title": "Include List"
},
"includeID": {
"description": "Only include documents with fields listed in the submission ID path.<br/>Each entry should be on a separate line. Use <span data-type='code'>/</span> to enclose regular expressions.",
"placeholder": "Include all notebooks and documents",
"title": "ID Include List"
},
"test": {
"description": "Test if connected to Wakapi/WakaTime service correctly",
"messages": {
Expand Down
20 changes: 20 additions & 0 deletions public/i18n/zh_CHT.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@
"description": "Wakapi/WakaTime API URL<br/>對應 Wakapi/WakaTime 配置中的 <code class='fn__code'>api_url</code>",
"title": "API URL"
},
"exclude": {
"description": "提交時排除路徑中包含列表欄位的文件<br/>每行一條記錄,若為正則表示式則需要使用 <code class='fn__code'>/</code> 包裹<br/>對應 Wakapi/WakaTime 配置中的 <code class='fn__code'>exclude</code>",
"placeholder": "不排除任何筆記本與文件",
"title": "排除列表"
},
"excludeID": {
"description": "提交時排除 ID 路徑中包含列表欄位的文件<br/>每行一條記錄,若為正則表示式則需要使用 <code class='fn__code'>/</code> 包裹",
"placeholder": "不排除任何筆記本與文件",
"title": "ID 排除列表"
},
"hide_branch_names": {
"description": "是否隱藏筆記本名稱,開啟後將使用筆記本 ID 替換筆記本名稱<br/>對應 Wakapi/WakaTime 配置中的 <code class='fn__code'>hide_branch_names</code>",
"title": "隱藏筆記本名稱"
Expand All @@ -58,6 +68,16 @@
"description": "自定義當前主機名稱<br/>對應 Wakapi/WakaTime 配置中的 <code class='fn__code'>hostname</code>",
"title": "主機名稱"
},
"include": {
"description": "僅提交路徑中包含列表欄位的文件<br/>每行一條記錄,若為正則表示式則需要使用 <code class='fn__code'>/</code> 包裹<br/>對應 Wakapi/WakaTime 配置中的 <code class='fn__code'>include</code>",
"placeholder": "包含所有筆記本與文件",
"title": "包含列表"
},
"includeID": {
"description": "僅提交 ID 路徑中包含列表欄位的文件<br/>每行一條記錄,若為正則表示式則需要使用 <code class='fn__code'>/</code> 包裹",
"placeholder": "包含所有筆記本與文件",
"title": "ID 包含列表"
},
"test": {
"description": "測試是否正確連線到 Wakapi/WakaTime 服務",
"messages": {
Expand Down
Loading

0 comments on commit f8ed131

Please sign in to comment.