Skip to content

Commit

Permalink
pref: 调整依赖、优化内存占用
Browse files Browse the repository at this point in the history
  • Loading branch information
jiwangyihao committed Oct 13, 2024
1 parent 2ce822f commit e107c28
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 33 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "src/third-party/Vela_input_method"]
path = src/third-party/Vela_input_method
url = https://github.com/NEORUAA/Vela_input_method.git
[submodule "src/third-party/GBK.js"]
path = src/third-party/GBK.js
url = https://github.com/cnwhy/GBK.js.git
46 changes: 19 additions & 27 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,8 @@
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-prettier": "^3.4.1",
"eslint-plugin-ux": "^0.0.4",
"gbk.js": "^0.3.0",
"husky": "^8.0.1",
"jsonpath-plus": "^1.1.0",
"jsonpath-plus": "^3.0.0",
"less": "^4.2.0",
"less-loader": "^12.2.0",
"lint-staged": "^15.2.10",
Expand Down
2 changes: 1 addition & 1 deletion src/pages/source/source.ux
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@
</template>

<script>
const {template, router, fetch, source, helper} = global
const {template, router, helper, source, fetch} = global

export default {
...template,
Expand Down
1 change: 1 addition & 0 deletions src/third-party/GBK.js
Submodule GBK.js added at 1a2469
2 changes: 1 addition & 1 deletion src/third-party/Vela_input_method
Submodule Vela_input_method updated 1 files
+1 −1 README.md
5 changes: 3 additions & 2 deletions src/utils/fetch.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {fetch as systemFetch, request, file} from "./tsimports"
import {cookie, helper} from "."
const GBK = require("gbk.js")

class Response {
data: string
Expand Down Expand Up @@ -60,7 +59,6 @@ export function fetch(rawUrl: string, options?: any): Promise<Response> {
url = encodeURI(decodeURIComponent(url))
} else if (/^gbk$/gi.test(fullOptions.charset)) {
fullOptions.charset = "gbk"
url = GBK.URI.encodeURI(url)
} else {
console.error("不支持的编码类型")
reject("不支持的编码类型")
Expand All @@ -70,6 +68,8 @@ export function fetch(rawUrl: string, options?: any): Promise<Response> {
}

if (fullOptions.charset) {
const GBK = require("../third-party/GBK.js/dist/gbk.min")
url = GBK.URI.encodeURI(url)
request.download({
url,
...fullOptions,
Expand All @@ -83,6 +83,7 @@ export function fetch(rawUrl: string, options?: any): Promise<Response> {
uri: res.uri,
success(buffer) {
const result = GBK.decode(buffer.buffer)
// const result = buffer
file.delete({
uri: res.uri,
success() {
Expand Down

0 comments on commit e107c28

Please sign in to comment.