Skip to content

Commit

Permalink
fix: timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
piloking committed Dec 30, 2024
1 parent 82ab02f commit 30c36e7
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 5 deletions.
18 changes: 15 additions & 3 deletions packages/linejs/src/core/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import {
TalkService,
} from "../service/mod.ts";

import { Login, type LoginOption } from "../login/mod.ts";
import { Login } from "../login/mod.ts";
import { Thrift } from "../thrift/mod.ts";
import { RequestClient } from "../request/mod.ts";
import { E2EE } from "../e2ee/mod.ts";
Expand All @@ -46,6 +46,16 @@ import { Polling } from "../polling/mod.ts";
import { Thrift as def } from "@evex/linejs-types/thrift";
import type * as LINETypes from "@evex/linejs-types";

export interface LoginOption {
email?: string;
password?: string;
pincode?: string;
authToken?: string;
qr?: boolean;
e2ee?: boolean;
v3?: boolean;
}

type PollingOption = "talk" | "square";

export interface ClientInit {
Expand Down Expand Up @@ -183,8 +193,10 @@ export class Client extends TypedEventEmitter<ClientEvents> {
await this.storage.set("reqseq", JSON.stringify(this.reqseqs));
return seq;
}
async login(options?: LoginOption): Promise<void> {
return await this.loginProcess.login(options);
async login(
options?: LoginOption,
): Promise<void> {
return await this.loginProcess.login(options as any);
}
polling(options: PollingOption[]): Promise<void[]> {
const promise: Promise<void>[] = [];
Expand Down
2 changes: 1 addition & 1 deletion packages/linejs/src/login/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface PasswordLoginOption {
authToken?: undefined;
}

interface QrCodeLoginOption {
export interface QrCodeLoginOption {
email?: undefined;
authToken?: undefined;
qr?: true;
Expand Down
2 changes: 1 addition & 1 deletion packages/linejs/src/polling/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class Polling {
sync: SyncData = { talk: {} };
polling_talk = false;
polling_square = false;
polling_delay = 5000;
polling_delay = 1000;

client: Client;
constructor(init: { client: Client }) {
Expand Down

0 comments on commit 30c36e7

Please sign in to comment.