Skip to content

Commit

Permalink
Merge branch 'main' of github.com:snolab/CapsLockX
Browse files Browse the repository at this point in the history
  • Loading branch information
snomiao committed Nov 30, 2024
2 parents 14ce615 + 5881b05 commit a7198ef
Show file tree
Hide file tree
Showing 66 changed files with 156 additions and 473 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v1
- uses: actions/setup-node@v3
- uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: 'https://registry.npmjs.org'
- run: bun install
- run: npm publish
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [1.34.8](https://github.com/snolab/CapsLockX/compare/v1.34.7...v1.34.8) (2024-11-21)


### Bug Fixes

* **Lib:** dir ([28dafc2](https://github.com/snolab/CapsLockX/commit/28dafc2c0bf0cef866d28969588710f6b4b08be9))
* **Lib:** dir ([d38cfbe](https://github.com/snolab/CapsLockX/commit/d38cfbe2b89d72e92d937087c5abbfe7674c087d))

### [1.34.7](https://github.com/snolab/CapsLockX/compare/v1.34.6...v1.34.7) (2024-11-21)

### [1.34.6](https://github.com/snolab/CapsLockX/compare/v1.34.5...v1.34.6) (2024-11-18)

### [1.34.5](https://github.com/snolab/CapsLockX/compare/v1.34.4...v1.34.5) (2024-11-03)


Expand Down
12 changes: 6 additions & 6 deletions CapsLockX.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ global 显示加载提示 := 1
global loadingTips := ""

; 对 核心模块 进行 编码清洗
清洗为_UTF8_WITH_BOM_型编码(CLX_CoreDir "/CapsLockX-Config.ahk")
清洗为_UTF8_WITH_BOM_型编码(CLX_CoreDir "/CapsLockX-Core.ahk")
清洗为_UTF8_WITH_BOM_型编码(CLX_CoreDir "/CapsLockX-RunSilent.ahk")
清洗为_UTF8_WITH_BOM_型编码(CLX_CoreDir "/CapsLockX-Update.ahk")
清洗为_UTF8_WITH_BOM_型编码(CLX_CoreDir "/CapsLockX-i18n.ahk")
CONVERT_FILE_TO_UTF8_WITH_BOM_ENCODING(CLX_CoreDir "/CapsLockX-Config.ahk")
CONVERT_FILE_TO_UTF8_WITH_BOM_ENCODING(CLX_CoreDir "/CapsLockX-Core.ahk")
CONVERT_FILE_TO_UTF8_WITH_BOM_ENCODING(CLX_CoreDir "/CapsLockX-RunSilent.ahk")
CONVERT_FILE_TO_UTF8_WITH_BOM_ENCODING(CLX_CoreDir "/CapsLockX-Update.ahk")
CONVERT_FILE_TO_UTF8_WITH_BOM_ENCODING(CLX_CoreDir "/CapsLockX-i18n.ahk")

; 复制用户模块
; TODO FIX:如果CLX已经开了的话,这一步会触发重启,这可能会导致一些文件冲突的BUG……
Expand Down Expand Up @@ -210,7 +210,7 @@ Return
加载提示追加(t("跳过模块:") . i . " " . 模块名称)
} else {
; 这里引入模块代码
清洗为_UTF8_WITH_BOM_型编码(CLX_ModuleDir "/" 模块文件)
CONVERT_FILE_TO_UTF8_WITH_BOM_ENCODING(CLX_ModuleDir "/" 模块文件)
; 导入模块
模块初始化代码 .= "GoSub CLX_ModuleSetup_" i "`n"
模块导入代码 .= "`n" "#If" "`n" "`n"
Expand Down
18 changes: 11 additions & 7 deletions Core/CapsLockX-i18n.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
global CLX_i18nConfigPath := "Core/lang.ini"
global CLX_i18n_newTranslated := "Core/lang.ini"

清洗为_UTF16_WITH_BOM_型编码(CLX_i18nConfigPath)
CONVERT_FILE_TO_UTF16_WITH_BOM_ENCODING(CLX_i18nConfigPath)

; - [Language Codes \| AutoHotkey v1]( https://www.autohotkey.com/docs/v1/misc/Languages.htm )
LCID_7804 := "Chinese" ; zh
Expand Down Expand Up @@ -82,21 +82,25 @@ i18n_translated(lang, key)
return translated
}

question := "TASK: translate to " . lang . ",dont explain, just translate`n" . "ORIGIN TEXT: " . key
question := ">>> ROLE: Act as translator, input text is between '>>> TEXT BEGIN' and '>>> TEXT END', output transcript, no explain" . "`n"
question .= ">>> TASK: translate to " . lang . "`n"
question .= ">>> TEXT BEGIN" . "`n"
question .= key . "`n"
question .= ">>> TEXT END" . "`n"

global brainstorm_origin
if (!brainstorm_origin) {
brainstorm_origin := CLX_Config("BrainStorm", "Website", "https://brainstorm.snomiao.com")
}
endpoint := brainstorm_origin . "/ai/chat?ret=text"
endpoint := brainstorm_origin . "/ai/translator?ret=text"
xhr := ComObjCreate("Msxml2.XMLHTTP")
xhr.Open("POST", endpoint)
xhr.setRequestHeader("Authorization", "Bearer " . brainstormApiKey)
xhr.onreadystatechange := Func("brainstorm_translatePostResult").Bind(lang, key, xhr)
xhr.onreadystatechange := Func("i18n_brainstorm_translatePostResult").Bind(lang, key, xhr)
xhr.Send(question)
return "…[" . key . "]"
}
brainstorm_translatePostResult(lang, key, xhr)
i18n_brainstorm_translatePostResult(lang, key, xhr)
{
if (xhr.readyState != 4)
return
Expand All @@ -107,7 +111,7 @@ brainstorm_translatePostResult(lang, key, xhr)
; ignore 500 error
return
}
MsgBox, % xhr.status . " " xhr.responseText . " " . ("未知错误 / Unknown Error")
MsgBox, % xhr.status . " " . xhr.responseText . " " . ("未知错误 / Unknown Error")
return
}
global transcript := xhr.responseText
Expand Down Expand Up @@ -160,7 +164,7 @@ CLX_i18n_ConfigSet(field, varName, value)
global CLX_ConfigDir
IniSave(encodedValue, CLX_ConfigDir . "/" . field . ".ini", field, encodedKey)

; 清洗为_UTF16_WITH_BOM_型编码(CLX_ConfigDir)
; CONVERT_FILE_TO_UTF16_WITH_BOM_ENCODING(CLX_ConfigDir)
}
CLX_i18n_ConfigEnocde(str){
str := RegExReplace(str, "\\", "\\")
Expand Down
19 changes: 10 additions & 9 deletions Core/CapslockX-Config.ahk
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ if (!CLX_ConfigPath) {
; 配置文件编码清洗
global CLX_ConfigChangedTickCount
CLX_ConfigChangedTickCount := A_TickCount
; msgbox 清洗为_UTF16_WITH_BOM_型编码1
清洗为_UTF16_WITH_BOM_型编码(CLX_ConfigPath)
; msgbox 清洗为_UTF16_WITH_BOM_型编码2
; msgbox CONVERT_FILE_TO_UTF16_WITH_BOM_ENCODING1
CONVERT_FILE_TO_UTF16_WITH_BOM_ENCODING(CLX_ConfigPath)
; msgbox CONVERT_FILE_TO_UTF16_WITH_BOM_ENCODING2

CLX_Config("_NOTICE_", "ENCODING_USING", "UTF16_LE", "")

Expand Down Expand Up @@ -110,7 +110,8 @@ CLX_Config(field, varName, defaultValue, comment := "")
return content
}

清洗为_UTF16_WITH_BOM_型编码(path){
; convert file to UTF16 (which is required by ReadINI in ahk)
CONVERT_FILE_TO_UTF16_WITH_BOM_ENCODING(path){
ConfigLock("UTF16_WITH_BOM 文件编码清洗:" path)
if (FileGetFormat(path) === "UTF-16 LE") {
ConfigUnlock()
Expand Down Expand Up @@ -150,7 +151,7 @@ FileGetFormat(file)
Return StrLen(f) = size ? "ANSI" : "UTF-8 no BOM"
}

清洗为_UTF8_WITH_BOM_型编码(path){
CONVERT_FILE_TO_UTF8_WITH_BOM_ENCODING(path){
ConfigLock("UTF8_WITH_BOM 文件编码清洗:" path)
if (FileGetFormat(path) === "UTF-8") {
ConfigUnlock()
Expand All @@ -164,14 +165,14 @@ FileGetFormat(file)
ConfigUnlock()
}

ConfigLock(名义:="")
ConfigLock(reason:="")
{
k:= 0
while (FileExist(CLX_ConfigPath ".lock")) {
k := k + 1
if ( k > 10 ) {
FileRead 上次名义, % CLX_ConfigPath ".lock"
; MsgBox, 程序退出, %名义% 配置写入失败,配置文件被意外锁定,上次锁定名义为 %上次名义%
FileRead lastReason, % CLX_ConfigPath ".lock"
; MsgBox, 程序退出, %reason% 配置写入失败,配置文件被意外锁定,上次锁定名义为 %lastReason%
ConfigUnlock()
Reload
ExitApp
Expand All @@ -181,7 +182,7 @@ ConfigLock(名义:="")
}
CLX_DontReload := 1

FileAppend %名义%, % CLX_ConfigPath ".lock"
FileAppend %reason%, % CLX_ConfigPath ".lock"
return True
}
ConfigUnlock()
Expand Down
Binary file modified Core/lang.ini
Binary file not shown.
2 changes: 1 addition & 1 deletion Core/version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.34.5
1.34.8
20 changes: 14 additions & 6 deletions DevTools/choco/CapsLockX.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<id>CapsLockX</id>
<version>1.34.5</version>
<version>1.34.8</version>
<owners>snomiao</owners>
<authors>snomiao</authors>
<copyright>Copyright (C) Snowstar Laboratory 2017-2024</copyright>
Expand Down Expand Up @@ -65,6 +65,18 @@ You can also write your own my-ahk.user.ahkand put it ./User/in the directory, C
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [1.34.8](https://github.com/snolab/CapsLockX/compare/v1.34.7...v1.34.8) (2024-11-21)
### Bug Fixes
* **Lib:** dir ([28dafc2](https://github.com/snolab/CapsLockX/commit/28dafc2c0bf0cef866d28969588710f6b4b08be9))
* **Lib:** dir ([d38cfbe](https://github.com/snolab/CapsLockX/commit/d38cfbe2b89d72e92d937087c5abbfe7674c087d))
### [1.34.7](https://github.com/snolab/CapsLockX/compare/v1.34.6...v1.34.7) (2024-11-21)
### [1.34.6](https://github.com/snolab/CapsLockX/compare/v1.34.5...v1.34.6) (2024-11-18)
### [1.34.5](https://github.com/snolab/CapsLockX/compare/v1.34.4...v1.34.5) (2024-11-03)
Expand Down Expand Up @@ -118,11 +130,7 @@ All notable changes to this project will be documented in this file. See [standa
* **CapsLockX:** brainstorm logic ([b58d0fd](https://github.com/snolab/CapsLockX/commit/b58d0fd5288b092aec97a5fc97672f35212dae3c))
* **capslockx:** cfg dir ([5bb72c1](https://github.com/snolab/CapsLockX/commit/5bb72c183499606d13ee31713464fba2dc2fd751))
* **capslockx:** docsmouse ([e45b9c1](https://github.com/snolab/CapsLockX/commit/e45b9c113353f0b939705d7e578d28ac9a1cfcf2))
* **capslockx:** en ([ba858c5](https://github.com/snolab/CapsLockX/commit/ba858c5571b954cae8339e423b24a2374a5df67d))
* **CapsLockX:** en module help ([32ab8bd](https://github.com/snolab/CapsLockX/commit/32ab8bdab399a80258019942945b6ebf439ccbdf))
* **CapsLockX:** format ([b37401d](https://github.com/snolab/CapsLockX/commit/b37401d0f1580e3a932eb51464a5c713a98e231c))
* **capslockx:** i18n setup ([5ac5047](https://github.com/snolab/CapsLockX/commit/5ac5047bd4ad5c8205c402af8711aeb8c4611dd1))
* **capslockx:** initial locales ([68b61e8](https://github.com/snolab/CapsLockX/commit/68b61e811404967b0bb58e377905e5f3094a42b9))]]></releaseNotes>
* **capslockx:** en ([ba858c5](https://github.com/snolab/CapsLockX/commit/ba858c5571b954cae8339e423b24a2374a5df67d))]]></releaseNotes>

<dependencies></dependencies>
</metadata>
Expand Down
149 changes: 0 additions & 149 deletions DevTools/modulesTips.mjs

This file was deleted.

27 changes: 27 additions & 0 deletions DevTools/setup.iss
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
; -- setup.iss --
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING .ISS SCRIPT FILES!

[Setup]
AppName=CapsLockX
AppVersion=1.34.6
WizardStyle=modern
; DefaultDirName={autopf}\CapsLockX
DefaultDirName={userappdata}\CapsLockX
DefaultGroupName=CapsLockX
UninstallDisplayIcon={app}\CapsLockX.exe
Compression=lzma2
SolidCompression=yes
OutputDir=userdocs:Inno Setup CapsLockX Output

[Files]
Source: "README.md"; DestDir: "{app}"; Flags: isreadme
Source: "CapsLockX.ahk"; DestDir: "{app}"
Source: "CapsLockX.exe"; DestDir: "{app}"
Source: "Core\*"; DestDir: "{app}"
Source: "Data\*"; DestDir: "{app}"
Source: "docs\*"; DestDir: "{app}"
Source: "Modules\*"; DestDir: "{app}"
Source: "Tools\*"; DestDir: "{app}"

[Icons]
Name: "{group}\CapsLockX"; Filename: "{app}\CapsLockX.exe"
Loading

0 comments on commit a7198ef

Please sign in to comment.