Merge tag '2023.12.1' into merge-upstream
This commit is contained in:
commit
018ff4cbda
336 changed files with 1938 additions and 1116 deletions
|
@ -6,6 +6,7 @@
|
|||
import * as assert from 'node:assert';
|
||||
import { readFile } from 'node:fs/promises';
|
||||
import { isAbsolute, basename } from 'node:path';
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import { inspect } from 'node:util';
|
||||
import WebSocket, { ClientOptions } from 'ws';
|
||||
import fetch, { File, RequestInit } from 'node-fetch';
|
||||
|
@ -25,6 +26,8 @@ interface UserToken {
|
|||
|
||||
const config = loadConfig();
|
||||
export const port = config.port;
|
||||
export const origin = config.url;
|
||||
export const host = new URL(config.url).host;
|
||||
|
||||
export const cookie = (me: UserToken): string => {
|
||||
return `token=${me.token};`;
|
||||
|
@ -126,6 +129,15 @@ export const post = async (user: UserToken, params?: misskey.Endpoints['notes/cr
|
|||
return res.body ? res.body.createdNote : null;
|
||||
};
|
||||
|
||||
export const createAppToken = async (user: UserToken, permissions: (typeof misskey.permissions)[number][]) => {
|
||||
const res = await api('miauth/gen-token', {
|
||||
session: randomUUID(),
|
||||
permission: permissions,
|
||||
}, user);
|
||||
|
||||
return (res.body as misskey.entities.MiauthGenTokenResponse).token;
|
||||
};
|
||||
|
||||
// 非公開ノートをAPI越しに見たときのノート NoteEntityService.ts
|
||||
export const hiddenNote = (note: any): any => {
|
||||
const temp = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue