Skip to content

Commit 0755788

Browse files
authored
Merge branch 'main' into main
2 parents c931483 + ef1ba9b commit 0755788

File tree

35 files changed

+733
-251
lines changed

35 files changed

+733
-251
lines changed

.github/FUNDING.yml

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,3 @@
11
# These are supported funding model platforms
22

33
github: gschier
4-
patreon: # Replace with a single Patreon username
5-
open_collective: # Replace with a single Open Collective username
6-
ko_fi: # Replace with a single Ko-fi username
7-
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
8-
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
9-
liberapay: # Replace with a single Liberapay username
10-
issuehunt: # Replace with a single IssueHunt username
11-
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
12-
polar: # Replace with a single Polar username
13-
buy_me_a_coffee: # Replace with a single Buy Me a Coffee username
14-
thanks_dev: # Replace with a single thanks.dev username
15-
custom: https://yaak.app/pricing

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
<!-- sponsors-premium --><a href="https://github.com/MVST-Solutions"><img src="https:&#x2F;&#x2F;github.com&#x2F;MVST-Solutions.png" width="80px" alt="User avatar: MVST-Solutions" /></a>&nbsp;&nbsp;<a href="https://github.com/dharsanb"><img src="https:&#x2F;&#x2F;github.com&#x2F;dharsanb.png" width="80px" alt="User avatar: dharsanb" /></a>&nbsp;&nbsp;<a href="https://github.com/railwayapp"><img src="https:&#x2F;&#x2F;github.com&#x2F;railwayapp.png" width="80px" alt="User avatar: railwayapp" /></a>&nbsp;&nbsp;<a href="https://github.com/caseyamcl"><img src="https:&#x2F;&#x2F;github.com&#x2F;caseyamcl.png" width="80px" alt="User avatar: caseyamcl" /></a>&nbsp;&nbsp;<a href="https://github.com/"><img src="https:&#x2F;&#x2F;raw.githubusercontent.com&#x2F;JamesIves&#x2F;github-sponsors-readme-action&#x2F;dev&#x2F;.github&#x2F;assets&#x2F;placeholder.png" width="80px" alt="User avatar: " /></a>&nbsp;&nbsp;<!-- sponsors-premium -->
2323
</p>
2424
<p align="center">
25-
<!-- sponsors-base --><a href="https://github.com/seanwash"><img src="https:&#x2F;&#x2F;github.com&#x2F;seanwash.png" width="50px" alt="User avatar: seanwash" /></a>&nbsp;&nbsp;<a href="https://github.com/jerath"><img src="https:&#x2F;&#x2F;github.com&#x2F;jerath.png" width="50px" alt="User avatar: jerath" /></a>&nbsp;&nbsp;<a href="https://github.com/itsa-sh"><img src="https:&#x2F;&#x2F;github.com&#x2F;itsa-sh.png" width="50px" alt="User avatar: itsa-sh" /></a>&nbsp;&nbsp;<a href="https://github.com/dmmulroy"><img src="https:&#x2F;&#x2F;github.com&#x2F;dmmulroy.png" width="50px" alt="User avatar: dmmulroy" /></a>&nbsp;&nbsp;<a href="https://github.com/timcole"><img src="https:&#x2F;&#x2F;github.com&#x2F;timcole.png" width="50px" alt="User avatar: timcole" /></a>&nbsp;&nbsp;<a href="https://github.com/VLZH"><img src="https:&#x2F;&#x2F;github.com&#x2F;VLZH.png" width="50px" alt="User avatar: VLZH" /></a>&nbsp;&nbsp;<a href="https://github.com/terasaka2k"><img src="https:&#x2F;&#x2F;github.com&#x2F;terasaka2k.png" width="50px" alt="User avatar: terasaka2k" /></a>&nbsp;&nbsp;<a href="https://github.com/andriyor"><img src="https:&#x2F;&#x2F;github.com&#x2F;andriyor.png" width="50px" alt="User avatar: andriyor" /></a>&nbsp;&nbsp;<a href="https://github.com/majudhu"><img src="https:&#x2F;&#x2F;github.com&#x2F;majudhu.png" width="50px" alt="User avatar: majudhu" /></a>&nbsp;&nbsp;<a href="https://github.com/axelrindle"><img src="https:&#x2F;&#x2F;github.com&#x2F;axelrindle.png" width="50px" alt="User avatar: axelrindle" /></a>&nbsp;&nbsp;<a href="https://github.com/jirizverina"><img src="https:&#x2F;&#x2F;github.com&#x2F;jirizverina.png" width="50px" alt="User avatar: jirizverina" /></a>&nbsp;&nbsp;<a href="https://github.com/chip-well"><img src="https:&#x2F;&#x2F;github.com&#x2F;chip-well.png" width="50px" alt="User avatar: chip-well" /></a>&nbsp;&nbsp;<!-- sponsors-base -->
25+
<!-- sponsors-base --><a href="https://github.com/seanwash"><img src="https:&#x2F;&#x2F;github.com&#x2F;seanwash.png" width="50px" alt="User avatar: seanwash" /></a>&nbsp;&nbsp;<a href="https://github.com/jerath"><img src="https:&#x2F;&#x2F;github.com&#x2F;jerath.png" width="50px" alt="User avatar: jerath" /></a>&nbsp;&nbsp;<a href="https://github.com/itsa-sh"><img src="https:&#x2F;&#x2F;github.com&#x2F;itsa-sh.png" width="50px" alt="User avatar: itsa-sh" /></a>&nbsp;&nbsp;<a href="https://github.com/dmmulroy"><img src="https:&#x2F;&#x2F;github.com&#x2F;dmmulroy.png" width="50px" alt="User avatar: dmmulroy" /></a>&nbsp;&nbsp;<a href="https://github.com/timcole"><img src="https:&#x2F;&#x2F;github.com&#x2F;timcole.png" width="50px" alt="User avatar: timcole" /></a>&nbsp;&nbsp;<a href="https://github.com/VLZH"><img src="https:&#x2F;&#x2F;github.com&#x2F;VLZH.png" width="50px" alt="User avatar: VLZH" /></a>&nbsp;&nbsp;<a href="https://github.com/terasaka2k"><img src="https:&#x2F;&#x2F;github.com&#x2F;terasaka2k.png" width="50px" alt="User avatar: terasaka2k" /></a>&nbsp;&nbsp;<a href="https://github.com/andriyor"><img src="https:&#x2F;&#x2F;github.com&#x2F;andriyor.png" width="50px" alt="User avatar: andriyor" /></a>&nbsp;&nbsp;<a href="https://github.com/majudhu"><img src="https:&#x2F;&#x2F;github.com&#x2F;majudhu.png" width="50px" alt="User avatar: majudhu" /></a>&nbsp;&nbsp;<a href="https://github.com/axelrindle"><img src="https:&#x2F;&#x2F;github.com&#x2F;axelrindle.png" width="50px" alt="User avatar: axelrindle" /></a>&nbsp;&nbsp;<a href="https://github.com/jirizverina"><img src="https:&#x2F;&#x2F;github.com&#x2F;jirizverina.png" width="50px" alt="User avatar: jirizverina" /></a>&nbsp;&nbsp;<a href="https://github.com/chip-well"><img src="https:&#x2F;&#x2F;github.com&#x2F;chip-well.png" width="50px" alt="User avatar: chip-well" /></a>&nbsp;&nbsp;<a href="https://github.com/GRAYAH"><img src="https:&#x2F;&#x2F;github.com&#x2F;GRAYAH.png" width="50px" alt="User avatar: GRAYAH" /></a>&nbsp;&nbsp;<!-- sponsors-base -->
2626
</p>
2727

2828
![Yaak API Client](https://yaak.app/static/screenshot.png)

plugins/auth-oauth2/src/getOrRefreshAccessToken.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ export async function getOrRefreshAccessToken(
7171
httpRequest.authenticationType = 'none'; // Don't inherit workspace auth
7272
const resp = await ctx.httpRequest.send({ httpRequest });
7373

74-
if (resp.status === 401) {
75-
// Bad refresh token, so we'll force it to fetch a fresh access token by deleting
76-
// and returning null;
77-
console.log('[oauth2] Unauthorized refresh_token request');
74+
if (resp.status >= 400 && resp.status < 500) {
75+
// Client errors (4xx) indicate the refresh token is invalid, expired, or revoked
76+
// Delete the token and return null to trigger a fresh authorization flow
77+
console.log('[oauth2] Refresh token request failed with client error, deleting token');
7878
await deleteToken(ctx, tokenArgs);
7979
return null;
8080
}

plugins/importer-curl/src/index.ts

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,34 @@ export const plugin: PluginDefinition = {
5555
},
5656
};
5757

58+
/**
59+
* Decodes escape sequences in shell $'...' strings
60+
* Handles Unicode escape sequences (\uXXXX) and common escape codes
61+
*/
62+
function decodeShellString(str: string): string {
63+
return str
64+
.replace(/\\u([0-9a-fA-F]{4})/g, (_, hex) => String.fromCharCode(parseInt(hex, 16)))
65+
.replace(/\\x([0-9a-fA-F]{2})/g, (_, hex) => String.fromCharCode(parseInt(hex, 16)))
66+
.replace(/\\n/g, '\n')
67+
.replace(/\\r/g, '\r')
68+
.replace(/\\t/g, '\t')
69+
.replace(/\\'/g, "'")
70+
.replace(/\\"/g, '"')
71+
.replace(/\\\\/g, '\\');
72+
}
73+
74+
/**
75+
* Checks if a string might contain escape sequences that need decoding
76+
* If so, decodes them; otherwise returns the string as-is
77+
*/
78+
function maybeDecodeEscapeSequences(str: string): string {
79+
// Check if the string contains escape sequences that shell-quote might not handle
80+
if (str.includes('\\u') || str.includes('\\x')) {
81+
return decodeShellString(str);
82+
}
83+
return str;
84+
}
85+
5886
export function convertCurl(rawData: string) {
5987
if (!rawData.match(/^\s*curl /)) {
6088
return null;
@@ -86,9 +114,11 @@ export function convertCurl(rawData: string) {
86114
for (const parseEntry of normalizedParseEntries) {
87115
if (typeof parseEntry === 'string') {
88116
if (parseEntry.startsWith('$')) {
89-
currentCommand.push(parseEntry.slice(1));
117+
// Handle $'...' strings from shell-quote - decode escape sequences
118+
currentCommand.push(decodeShellString(parseEntry.slice(1)));
90119
} else {
91-
currentCommand.push(parseEntry);
120+
// Decode escape sequences that shell-quote might not handle
121+
currentCommand.push(maybeDecodeEscapeSequences(parseEntry));
92122
}
93123
continue;
94124
}
@@ -108,7 +138,7 @@ export function convertCurl(rawData: string) {
108138

109139
if (op?.startsWith('$')) {
110140
// Handle the case where literal like -H $'Header: \'Some Quoted Thing\''
111-
const str = op.slice(2, op.length - 1).replace(/\\'/g, "'");
141+
const str = decodeShellString(op.slice(2, op.length - 1));
112142

113143
currentCommand.push(str);
114144
continue;

plugins/importer-curl/tests/index.test.ts

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,56 @@ describe('importer-curl', () => {
391391
},
392392
});
393393
});
394+
395+
test('Imports data with Unicode escape sequences', () => {
396+
expect(
397+
convertCurl(
398+
`curl 'https://yaak.app' -H 'Content-Type: application/json' --data-raw $'{"query":"SearchQueryInput\\u0021"}' -X POST`,
399+
),
400+
).toEqual({
401+
resources: {
402+
workspaces: [baseWorkspace()],
403+
httpRequests: [
404+
baseRequest({
405+
url: 'https://yaak.app',
406+
method: 'POST',
407+
headers: [{ name: 'Content-Type', value: 'application/json', enabled: true }],
408+
bodyType: 'application/json',
409+
body: { text: '{"query":"SearchQueryInput!"}' },
410+
}),
411+
],
412+
},
413+
});
414+
});
415+
416+
test('Imports data with multiple escape sequences', () => {
417+
expect(
418+
convertCurl(
419+
`curl 'https://yaak.app' --data-raw $'Line1\\nLine2\\tTab\\u0021Exclamation' -X POST`,
420+
),
421+
).toEqual({
422+
resources: {
423+
workspaces: [baseWorkspace()],
424+
httpRequests: [
425+
baseRequest({
426+
url: 'https://yaak.app',
427+
method: 'POST',
428+
bodyType: 'application/x-www-form-urlencoded',
429+
body: {
430+
form: [{ name: 'Line1\nLine2\tTab!Exclamation', value: '', enabled: true }],
431+
},
432+
headers: [
433+
{
434+
enabled: true,
435+
name: 'Content-Type',
436+
value: 'application/x-www-form-urlencoded',
437+
},
438+
],
439+
}),
440+
],
441+
},
442+
});
443+
});
394444
});
395445

396446
const idCount: Partial<Record<string, number>> = {};

plugins/template-function-1password/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"scripts": {
88
"build": "run-s build:*",
99
"build:1-build": "yaakcli build",
10-
"build:2-cpywasm": "cp \"../../node_modules/@1password/sdk-core/nodejs/core_bg.wasm\" build/",
10+
"build:2-cpywasm": "cpx \"../../node_modules/@1password/sdk-core/nodejs/core_bg.wasm\" build/",
1111
"dev": "yaakcli dev"
1212
},
1313
"dependencies": {

0 commit comments

Comments
 (0)