-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
setup vscode for consistent JS formatting
- Loading branch information
Showing
15 changed files
with
1,684 additions
and
1,347 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"editor.defaultFormatter": "esbenp.prettier-vscode", | ||
"[javascript]": { | ||
"editor.defaultFormatter": "esbenp.prettier-vscode" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,27 @@ | ||
<!DOCTYPE html> | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>rqbit web 4.0.0-beta.0</title> | ||
<link rel="icon" type="image/svg+xml" href="assets/logo.svg" /> | ||
<!-- Include Bootstrap CSS --> | ||
<link | ||
rel="stylesheet" | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" | ||
crossorigin="anonymous" | ||
/> | ||
<link | ||
rel="stylesheet" | ||
href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css" | ||
integrity="sha384-4LISF5TTJX/fLmGSxO53rV4miRxdg84mZsxmO8Rx5jGtp/LbrixFETvWa5a6sESd" | ||
crossorigin="anonymous" | ||
/> | ||
</head> | ||
|
||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>rqbit web 4.0.0-beta.0</title> | ||
<link rel="icon" type="image/svg+xml" href="assets/logo.svg"> | ||
<!-- Include Bootstrap CSS --> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" | ||
integrity="sha384-9ndCyUaIbzAi2FUVXJi0CjmCapSmO7SnpJef0486qhLnuZ2cdeRhO02iuK6FUUVM" crossorigin="anonymous" /> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css" | ||
integrity="sha384-4LISF5TTJX/fLmGSxO53rV4miRxdg84mZsxmO8Rx5jGtp/LbrixFETvWa5a6sESd" crossorigin="anonymous"> | ||
</head> | ||
|
||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="src/main.tsx"></script> | ||
</body> | ||
|
||
</html> | ||
<body> | ||
<div id="app"></div> | ||
<script type="module" src="src/main.tsx"></script> | ||
</body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,131 +1,132 @@ | ||
// Interface for the Torrent API response | ||
export interface TorrentId { | ||
id: number; | ||
info_hash: string; | ||
id: number; | ||
info_hash: string; | ||
} | ||
|
||
export interface TorrentFile { | ||
name: string; | ||
length: number; | ||
included: boolean; | ||
name: string; | ||
length: number; | ||
included: boolean; | ||
} | ||
|
||
// Interface for the Torrent Details API response | ||
export interface TorrentDetails { | ||
info_hash: string, | ||
files: Array<TorrentFile>; | ||
info_hash: string; | ||
files: Array<TorrentFile>; | ||
} | ||
|
||
export interface AddTorrentResponse { | ||
id: number | null; | ||
details: TorrentDetails; | ||
output_folder: string, | ||
seen_peers?: Array<string>; | ||
id: number | null; | ||
details: TorrentDetails; | ||
output_folder: string; | ||
seen_peers?: Array<string>; | ||
} | ||
|
||
export interface ListTorrentsResponse { | ||
torrents: Array<TorrentId>; | ||
torrents: Array<TorrentId>; | ||
} | ||
|
||
export interface Speed { | ||
mbps: number; | ||
human_readable: string; | ||
mbps: number; | ||
human_readable: string; | ||
} | ||
|
||
// Interface for the Torrent Stats API response | ||
export interface LiveTorrentStats { | ||
snapshot: { | ||
have_bytes: number; | ||
downloaded_and_checked_bytes: number; | ||
downloaded_and_checked_pieces: number; | ||
fetched_bytes: number; | ||
uploaded_bytes: number; | ||
initially_needed_bytes: number; | ||
remaining_bytes: number; | ||
total_bytes: number; | ||
total_piece_download_ms: number; | ||
peer_stats: { | ||
queued: number; | ||
connecting: number; | ||
live: number; | ||
seen: number; | ||
dead: number; | ||
not_needed: number; | ||
}; | ||
}; | ||
average_piece_download_time: { | ||
secs: number; | ||
nanos: number; | ||
snapshot: { | ||
have_bytes: number; | ||
downloaded_and_checked_bytes: number; | ||
downloaded_and_checked_pieces: number; | ||
fetched_bytes: number; | ||
uploaded_bytes: number; | ||
initially_needed_bytes: number; | ||
remaining_bytes: number; | ||
total_bytes: number; | ||
total_piece_download_ms: number; | ||
peer_stats: { | ||
queued: number; | ||
connecting: number; | ||
live: number; | ||
seen: number; | ||
dead: number; | ||
not_needed: number; | ||
}; | ||
download_speed: Speed; | ||
upload_speed: Speed; | ||
all_time_download_speed: { | ||
mbps: number; | ||
human_readable: string; | ||
}; | ||
average_piece_download_time: { | ||
secs: number; | ||
nanos: number; | ||
}; | ||
download_speed: Speed; | ||
upload_speed: Speed; | ||
all_time_download_speed: { | ||
mbps: number; | ||
human_readable: string; | ||
}; | ||
time_remaining: { | ||
human_readable: string; | ||
duration?: { | ||
secs: number; | ||
}; | ||
time_remaining: { | ||
human_readable: string; | ||
duration?: { | ||
secs: number, | ||
} | ||
} | null; | ||
} | null; | ||
} | ||
|
||
export const STATE_INITIALIZING = 'initializing'; | ||
export const STATE_PAUSED = 'paused'; | ||
export const STATE_LIVE = 'live'; | ||
export const STATE_ERROR = 'error'; | ||
export const STATE_INITIALIZING = "initializing"; | ||
export const STATE_PAUSED = "paused"; | ||
export const STATE_LIVE = "live"; | ||
export const STATE_ERROR = "error"; | ||
|
||
export interface TorrentStats { | ||
state: 'initializing' | 'paused' | 'live' | 'error', | ||
error: string | null, | ||
progress_bytes: number, | ||
finished: boolean, | ||
total_bytes: number, | ||
live: LiveTorrentStats | null; | ||
state: "initializing" | "paused" | "live" | "error"; | ||
error: string | null; | ||
progress_bytes: number; | ||
finished: boolean; | ||
total_bytes: number; | ||
live: LiveTorrentStats | null; | ||
} | ||
|
||
|
||
export interface ErrorDetails { | ||
id?: number, | ||
method?: string, | ||
path?: string, | ||
status?: number, | ||
statusText?: string, | ||
text: string, | ||
}; | ||
id?: number; | ||
method?: string; | ||
path?: string; | ||
status?: number; | ||
statusText?: string; | ||
text: string; | ||
} | ||
|
||
export type Duration = number; | ||
|
||
export interface PeerConnectionOptions { | ||
connect_timeout?: Duration | null; | ||
read_write_timeout?: Duration | null; | ||
keep_alive_interval?: Duration | null; | ||
connect_timeout?: Duration | null; | ||
read_write_timeout?: Duration | null; | ||
keep_alive_interval?: Duration | null; | ||
} | ||
|
||
export interface AddTorrentOptions { | ||
paused?: boolean; | ||
only_files_regex?: string | null; | ||
only_files?: number[] | null; | ||
overwrite?: boolean; | ||
list_only?: boolean; | ||
output_folder?: string | null; | ||
sub_folder?: string | null; | ||
peer_opts?: PeerConnectionOptions | null; | ||
force_tracker_interval?: Duration | null; | ||
initial_peers?: string[] | null; // Assuming SocketAddr is equivalent to a string in TypeScript | ||
preferred_id?: number | null; | ||
paused?: boolean; | ||
only_files_regex?: string | null; | ||
only_files?: number[] | null; | ||
overwrite?: boolean; | ||
list_only?: boolean; | ||
output_folder?: string | null; | ||
sub_folder?: string | null; | ||
peer_opts?: PeerConnectionOptions | null; | ||
force_tracker_interval?: Duration | null; | ||
initial_peers?: string[] | null; // Assuming SocketAddr is equivalent to a string in TypeScript | ||
preferred_id?: number | null; | ||
} | ||
|
||
|
||
export interface RqbitAPI { | ||
listTorrents: () => Promise<ListTorrentsResponse>, | ||
getTorrentDetails: (index: number) => Promise<TorrentDetails>, | ||
getTorrentStats: (index: number) => Promise<TorrentStats>; | ||
uploadTorrent: (data: string | File, opts?: AddTorrentOptions) => Promise<AddTorrentResponse>; | ||
|
||
pause: (index: number) => Promise<void>; | ||
start: (index: number) => Promise<void>; | ||
forget: (index: number) => Promise<void>; | ||
delete: (index: number) => Promise<void>; | ||
} | ||
listTorrents: () => Promise<ListTorrentsResponse>; | ||
getTorrentDetails: (index: number) => Promise<TorrentDetails>; | ||
getTorrentStats: (index: number) => Promise<TorrentStats>; | ||
uploadTorrent: ( | ||
data: string | File, | ||
opts?: AddTorrentOptions | ||
) => Promise<AddTorrentResponse>; | ||
|
||
pause: (index: number) => Promise<void>; | ||
start: (index: number) => Promise<void>; | ||
forget: (index: number) => Promise<void>; | ||
delete: (index: number) => Promise<void>; | ||
} |
Oops, something went wrong.