Skip to content

Commit 289064c

Browse files
authored
Merge pull request #24 from vicanso/main
version 0.1.12
2 parents 78cc988 + f44a079 commit 289064c

File tree

13 files changed

+32
-11
lines changed

13 files changed

+32
-11
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [0.1.12] - 2023-06-29
6+
7+
### Bug Fixes
8+
9+
- Fix base64 encode, #23
10+
11+
### Refactor
12+
13+
- Improve the performance of select file
14+
- Improve the performance of select file
15+
516
## [0.1.11] - 2023-06-26
617

718
### Bug Fixes

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ orm:
1919
-u "sqlite:///~/Library/Application Support/com.bigtree.cyberapi/my_db.db" \
2020
-o src/entities
2121
version:
22-
git cliff --unreleased --tag 0.1.11 --prepend CHANGELOG.md
22+
git cliff --unreleased --tag 0.1.12 --prepend CHANGELOG.md

src-tauri/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src-tauri/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "cyberapi"
3-
version = "0.1.11"
3+
version = "0.1.12"
44
description = "API tool based on tauri, it is smaller and faster."
55
authors = ["tree.xie@outlook.com"]
66
license = "Apache License 2.0"

src-tauri/src/http_request.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ pub async fn request(
412412

413413
let body = if http_request.content_type.starts_with("multipart/form-data") {
414414
// 数据为base64
415-
let buf = general_purpose::STANDARD_NO_PAD.decode(http_request.body)?;
415+
let buf = general_purpose::STANDARD.decode(http_request.body)?;
416416
Body::from(buf)
417417
} else {
418418
Body::from(http_request.body)
@@ -593,7 +593,7 @@ pub async fn request(
593593
latency: stats.total,
594594
status,
595595
headers,
596-
body: general_purpose::STANDARD_NO_PAD.encode(buf),
596+
body: general_purpose::STANDARD.encode(buf),
597597
stats,
598598
};
599599

src/commands/fn.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { fromUint8Array } from "js-base64";
1010
import sha256 from "crypto-js/sha256";
1111
import md5 from "crypto-js/md5";
1212

13+
import { i18nCommon } from "../i18n";
1314
import { getLatestResponse, getResponseBody } from "./http_response";
1415
import { listVariable, VariableCategory, VariableStatus } from "./variable";
1516
interface FnHandler {
@@ -154,7 +155,9 @@ export async function doFnHandler(handler: FnHandler): Promise<string> {
154155
case Fn.openFile:
155156
case Fn.of:
156157
{
157-
const selected = await open();
158+
const selected = await open({
159+
title: i18nCommon("selectFile"),
160+
});
158161
if (selected) {
159162
p = selected as string;
160163
}

src/commands/http_request.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,6 @@ async function convertMultipartForm(body: string): Promise<MultipartFormData> {
226226
type: encoder.contentType,
227227
});
228228
const buf = await b.arrayBuffer();
229-
encoder.headers;
230229
return {
231230
headers: encoder.headers,
232231
body: fromUint8Array(new Uint8Array(buf)),

src/commands/http_response.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ export function getStatusText(code: number) {
132132
return statusTextMap.get(code.toString()) || "";
133133
}
134134

135-
const mimeTextReg = /text|javascript/gi;
136-
137135
export function getResponseBody(resp: HTTPResponse): ResponseBodyResult {
138136
const { headers, body } = resp;
139137
let category = ResponseBodyCategory.Binary;
@@ -146,6 +144,7 @@ export function getResponseBody(resp: HTTPResponse): ResponseBodyResult {
146144
switch (k) {
147145
case "content-type":
148146
{
147+
const mimeTextReg = /text|javascript/gi;
149148
const value = values.join(" ");
150149
if (value.includes(applicationJSON)) {
151150
category = ResponseBodyCategory.JSON;

src/components/ExKeyValue.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ import {
99
} from "@vicons/ionicons5";
1010
import { debounce } from "lodash-es";
1111
import { open } from "@tauri-apps/api/dialog";
12+
import { downloadDir } from "@tauri-apps/api/path";
1213

1314
import ExDeleteCheck from "./ExDeleteCheck";
1415
import { KVParam } from "../commands/interface";
15-
import { i18nCollection } from "../i18n";
16+
import { i18nCollection, i18nCommon } from "../i18n";
1617
import { padding } from "../constants/style";
1718
import { showError } from "../helpers/util";
1819

@@ -154,7 +155,11 @@ export default defineComponent({
154155
return;
155156
}
156157
try {
157-
const selected = await open();
158+
const selected = await open({
159+
title: i18nCommon("selectFile"),
160+
multiple: false,
161+
defaultPath: await downloadDir(),
162+
});
158163
if (selected) {
159164
const item = kvList.value[index];
160165
item.value = ("file://" + selected) as string;

src/i18n/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ export default {
6262
settings: "Configurations",
6363
create: "Create",
6464
keywordFilterPlaceholder: "Please enter a keyword",
65+
selectFile: "Please select a file",
6566
saveToDownloadSuccess: "File is save to download successful",
6667
},
6768
dashboard: {

0 commit comments

Comments
 (0)