Skip to content

Commit

Permalink
Merge branch 'release/3.70.3'
Browse files Browse the repository at this point in the history
  • Loading branch information
purocean committed May 21, 2024
2 parents 0c561fe + 953c504 commit ed1bac3
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 11 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ For more information on how to use the following functions, please see [characte

## Changelogs

### [v3.70.2](https://github.com/purocean/yn/releases/tag/v3.70.2) 2024-05-20
### [v3.70.3](https://github.com/purocean/yn/releases/tag/v3.70.3) 2024-05-21

[Windows](https://github.com/purocean/yn/releases/download/v3.70.2/Yank-Note-win-x64-3.70.2.exe) | [macOS arm64](https://github.com/purocean/yn/releases/download/v3.70.2/Yank-Note-mac-arm64-3.70.2.dmg) | [macOS x64](https://github.com/purocean/yn/releases/download/v3.70.2/Yank-Note-mac-x64-3.70.2.dmg) | [Linux AppImage](https://github.com/purocean/yn/releases/download/v3.70.2/Yank-Note-linux-x86_64-3.70.2.AppImage) | [Linux deb](https://github.com/purocean/yn/releases/download/v3.70.2/Yank-Note-linux-amd64-3.70.2.deb)
[Windows](https://github.com/purocean/yn/releases/download/v3.70.3/Yank-Note-win-x64-3.70.3.exe) | [macOS arm64](https://github.com/purocean/yn/releases/download/v3.70.3/Yank-Note-mac-arm64-3.70.3.dmg) | [macOS x64](https://github.com/purocean/yn/releases/download/v3.70.3/Yank-Note-mac-x64-3.70.3.dmg) | [Linux AppImage](https://github.com/purocean/yn/releases/download/v3.70.3/Yank-Note-linux-x86_64-3.70.3.AppImage) | [Linux deb](https://github.com/purocean/yn/releases/download/v3.70.3/Yank-Note-linux-amd64-3.70.3.deb)

1. feat: Support pasting rich text as Markdown with table support
2. feat: Support keyboard navigation in context menu
Expand Down
4 changes: 2 additions & 2 deletions README_ZH-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@

## 更新日志

### [v3.70.2](https://github.com/purocean/yn/releases/tag/v3.70.2) 2024-05-20
### [v3.70.3](https://github.com/purocean/yn/releases/tag/v3.70.3) 2024-05-21

[Windows](https://github.com/purocean/yn/releases/download/v3.70.2/Yank-Note-win-x64-3.70.2.exe) | [macOS arm64](https://github.com/purocean/yn/releases/download/v3.70.2/Yank-Note-mac-arm64-3.70.2.dmg) | [macOS x64](https://github.com/purocean/yn/releases/download/v3.70.2/Yank-Note-mac-x64-3.70.2.dmg) | [Linux AppImage](https://github.com/purocean/yn/releases/download/v3.70.2/Yank-Note-linux-x86_64-3.70.2.AppImage) | [Linux deb](https://github.com/purocean/yn/releases/download/v3.70.2/Yank-Note-linux-amd64-3.70.2.deb)
[Windows](https://github.com/purocean/yn/releases/download/v3.70.3/Yank-Note-win-x64-3.70.3.exe) | [macOS arm64](https://github.com/purocean/yn/releases/download/v3.70.3/Yank-Note-mac-arm64-3.70.3.dmg) | [macOS x64](https://github.com/purocean/yn/releases/download/v3.70.3/Yank-Note-mac-x64-3.70.3.dmg) | [Linux AppImage](https://github.com/purocean/yn/releases/download/v3.70.3/Yank-Note-linux-x86_64-3.70.3.AppImage) | [Linux deb](https://github.com/purocean/yn/releases/download/v3.70.3/Yank-Note-linux-amd64-3.70.3.deb)

1. feat: 富文本粘贴为 Markdown 支持表格
2. feat: 上下文菜单支持使用键盘导航
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yank.note",
"version": "3.70.2",
"version": "3.70.3",
"description": "Yank Note: A highly extensible Markdown editor, designed for productivity.",
"main": "dist/main/app.js",
"license": "AGPL-3.0",
Expand Down
2 changes: 1 addition & 1 deletion src/main/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export async function install (id: string, url: string) {
const dispatcher = await getAction('get-proxy-dispatcher')(url)
try {
abortcontroller = new AbortController()
const res = await request(url, { dispatcher, signal: abortcontroller.signal })
const res = await request(url, { dispatcher, signal: abortcontroller.signal, maxRedirections: 3 })
const body = await res.body.arrayBuffer()

await new Promise((resolve, reject) => {
Expand Down
13 changes: 10 additions & 3 deletions src/main/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,8 +339,14 @@ const proxy = async (ctx: any, next: any) => {
let timeoutTimer: NodeJS.Timeout | undefined

try {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { 'x-proxy-url': proxyUrl, 'x-proxy-timeout': proxyTimeout, host, ...headers } = ctx.headers
const {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
host,
'x-proxy-url': proxyUrl,
'x-proxy-timeout': proxyTimeout,
'x-proxy-max-redirections': maxRedirections = '3',
...headers
} = ctx.headers

const dispatcher = proxyUrl
? getAction('new-proxy-dispatcher')(proxyUrl)
Expand All @@ -360,7 +366,8 @@ const proxy = async (ctx: any, next: any) => {
method: ctx.method,
headers,
body: ctx.req,
signal
signal,
maxRedirections: Number(maxRedirections)
})

// Set the response status, headers, and body
Expand Down
13 changes: 11 additions & 2 deletions src/renderer/support/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,17 +48,26 @@ export async function fetchHttp (input: RequestInfo, init?: RequestInit) {
* @param init RequestInit
* @returns
*/
export async function proxyFetch (url: string, init?: Omit<RequestInit, 'body'> & { body?: any, timeout?: number, proxy?: string, jsonBody?: boolean }) {
export async function proxyFetch (url: string, init?: Omit<RequestInit, 'body'> & {
body?: any,
timeout?: number,
proxy?: string,
jsonBody?: boolean,
}) {
init ??= {}

if (init.timeout) {
if (typeof init.timeout === 'number') {
init.headers = { ...init.headers, 'x-proxy-timeout': String(init.timeout) }
}

if (init.proxy) {
init.headers = { ...init.headers, 'x-proxy-url': init.proxy }
}

if (init.redirect === 'error' || init.redirect === 'manual') {
init.headers = { ...init.headers, 'x-proxy-max-redirections': '0' }
}

if (init.jsonBody) {
init.headers = { ...init.headers, 'Content-Type': 'application/json' }
init.body = JSON.stringify(init.body)
Expand Down

0 comments on commit ed1bac3

Please sign in to comment.