slack-term 1.32.4 → 1.32.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +110 -109
- package/package.json +1 -1
- package/ts/slack.ts +3 -0
package/package.json
CHANGED
package/ts/slack.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
// Slack Web API client (user token, Authorization: Bearer)
|
|
2
|
+
import { resolveCookie } from "./profiles.ts";
|
|
2
3
|
|
|
3
4
|
export class RateLimitError extends Error {
|
|
4
5
|
retryAfter: number;
|
|
@@ -22,6 +23,7 @@ function base(): string {
|
|
|
22
23
|
}
|
|
23
24
|
|
|
24
25
|
async function call(token: string, method: string, init: RequestInit, cookie?: string): Promise<Json> {
|
|
26
|
+
cookie = token.startsWith("xoxc-") ? (cookie ?? resolveCookie()) : undefined;
|
|
25
27
|
const extraHeaders: Record<string, string> = {};
|
|
26
28
|
if (cookie) extraHeaders["Cookie"] = `d=${cookie}`;
|
|
27
29
|
const res = await fetch(`${base()}/${method}`, {
|
|
@@ -152,6 +154,7 @@ export async function authTest(
|
|
|
152
154
|
export async function authScopes(token: string, cookie?: string): Promise<{
|
|
153
155
|
userId: string; user: string; botId: string; team: string; url: string; scopes: string[];
|
|
154
156
|
}> {
|
|
157
|
+
cookie = token.startsWith("xoxc-") ? (cookie ?? resolveCookie()) : undefined;
|
|
155
158
|
const headers: Record<string, string> = { Authorization: `Bearer ${token}` };
|
|
156
159
|
if (cookie) headers["Cookie"] = `d=${cookie}`;
|
|
157
160
|
const res = await fetch(`${base()}/auth.test`, { method: "GET", headers });
|