repo
stringlengths
5
106
file_url
stringlengths
78
301
file_path
stringlengths
4
211
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 14:56:49
2026-01-05 02:23:25
truncated
bool
2 classes
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/download-webseed-magnet.js
test/node/download-webseed-magnet.js
import http from 'http' import path from 'path' import finalhandler from 'finalhandler' import fixtures from 'webtorrent-fixtures' import MemoryChunkStore from 'memory-chunk-store' import series from 'run-series' import serveStatic from 'serve-static' import test from 'tape' import WebTorrent from '../../index.js' tes...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/download-from-ip.js
test/node/download-from-ip.js
import fs from 'fs' import fixtures from 'webtorrent-fixtures' import MemoryChunkStore from 'memory-chunk-store' import test from 'tape' import WebTorrent from '../../index.js' test('Download via torrent.addPeer()', (t) => { t.plan(6) // if initial interest isn't set, then this test is delayed t.timeoutAfter(500...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/conn-pool.js
test/node/conn-pool.js
import test from 'tape' import fixtures from 'webtorrent-fixtures' import MemoryChunkStore from 'memory-chunk-store' import dgram from 'dgram' import WebTorrent from '../../index.js' test('client.conn-pool: use TCP when uTP disabled', t => { t.plan(6) const client1 = new WebTorrent({ dht: false, tracker: false, l...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/download-lsd-magnet.js
test/node/download-lsd-magnet.js
import fixtures from 'webtorrent-fixtures' import MemoryChunkStore from 'memory-chunk-store' import test from 'tape' import WebTorrent from '../../index.js' test('Download using LSD (via magnet uri)', t => { t.plan(3) const client1 = new WebTorrent({ dht: false, tracker: false, lsd: true }) const client2 = new ...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/download-private-dht.js
test/node/download-private-dht.js
import { Server as DHT } from 'bittorrent-dht' import fixtures from 'webtorrent-fixtures' import MemoryChunkStore from 'memory-chunk-store' import series from 'run-series' import test from 'tape' import WebTorrent from '../../index.js' test('private torrent should not use DHT', t => { t.plan(4) const dhtServer = ...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/swarm-timeout.js
test/node/swarm-timeout.js
// var randombytes = require('randombytes') // var Swarm = require('../../lib/swarm') // var test = require('tape') // var infoHash = 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36' // var peerId1 = Buffer.from('-WW0001-' + randombytes(6).toString('hex'), 'utf8').toString('hex') // var peerId2 = Buffer.from('-WW0001-' + ra...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/seed-stream.js
test/node/seed-stream.js
import { Readable } from 'stream' import series from 'run-series' import test from 'tape' import { Server as Tracker } from 'bittorrent-tracker' import WebTorrent from '../../index.js' test('client.seed: stream', t => { t.plan(8) const tracker = new Tracker({ udp: false, ws: false }) tracker.on('error', err =>...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/torrent-events.js
test/node/torrent-events.js
import fixtures from 'webtorrent-fixtures' import test from 'tape' import MemoryChunkStore from 'memory-chunk-store' import randombytes from 'randombytes' import WebTorrent from '../../index.js' test('client.add: emit torrent events in order', t => { t.plan(6) const client1 = new WebTorrent({ dht: false, tracker:...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/download-tracker-torrent.js
test/node/download-tracker-torrent.js
import fs from 'fs' import fixtures from 'webtorrent-fixtures' import MemoryChunkStore from 'memory-chunk-store' import series from 'run-series' import test from 'tape' import { Server as TrackerServer } from 'bittorrent-tracker' import WebTorrent from '../../index.js' test('Download using UDP tracker (via .torrent fi...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/extensions.js
test/node/extensions.js
import fixtures from 'webtorrent-fixtures' import test from 'tape' import WebTorrent from '../../index.js' test('extension support', t => { t.plan(6) let extendedHandshakes = 0 class Extension { constructor (wire) { wire.extendedHandshake.test = 'Hello, World!' } onExtendedHandshake (extended...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/blocklist.js
test/node/blocklist.js
import fs from 'fs' import http from 'http' import zlib from 'zlib' import fixtures from 'webtorrent-fixtures' import test from 'tape' import WebTorrent from '../../index.js' function assertBlocked (t, torrent, addr) { torrent.once('blockedPeer', _addr => { t.equal(addr, _addr) }) t.notOk(torrent.addPeer(add...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/download-metadata.js
test/node/download-metadata.js
import http from 'http' import fixtures from 'webtorrent-fixtures' import MemoryChunkStore from 'memory-chunk-store' import test from 'tape' import WebTorrent from '../../index.js' function createServer (data, cb) { const server = http.createServer((req, res) => { if (req.url !== '/') { res.statusCode = 40...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/blocklist-dht.js
test/node/blocklist-dht.js
import { Server as DHT } from 'bittorrent-dht' import fixtures from 'webtorrent-fixtures' import series from 'run-series' import test from 'tape' import WebTorrent from '../../index.js' import common from '../common.js' test('blocklist blocks peers discovered via DHT', t => { t.plan(8) let dhtServer, client1, cli...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/metadata.js
test/node/metadata.js
import fixtures from 'webtorrent-fixtures' import test from 'tape' import WebTorrent from '../../index.js' test('ut_metadata transfer', t => { t.plan(6) const client1 = new WebTorrent({ dht: false, tracker: false, lsd: false, natUpnp: false, natPmp: false }) const client2 = new WebTorrent({ dht: false, tracker:...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/swarm-reconnect.js
test/node/swarm-reconnect.js
// var randombytes = require('randombytes') // var Swarm = require('../../lib/swarm') // var test = require('tape') // var infoHash = 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36' // var peerId1 = Buffer.from('-WW0001-' + randombytes(6).toString('hex'), 'utf8').toString('hex') // var peerId2 = Buffer.from('-WW0001-' + ra...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/swarm-basic.js
test/node/swarm-basic.js
// var randombytes = require('randombytes') // var Swarm = require('../../lib/swarm') // var test = require('tape') // var infoHash = 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa36' // var infoHash2 = 'd2474e86c95b19b8bcfdb92bc12c9d44667cfa37' // var peerId = Buffer.from('-WW0001-' + randombytes(6).toString('hex'), 'utf8')...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/download-dht-magnet.js
test/node/download-dht-magnet.js
import fs from 'fs' import { Server as DHT } from 'bittorrent-dht' import fixtures from 'webtorrent-fixtures' import MemoryChunkStore from 'memory-chunk-store' import networkAddress from 'network-address' import series from 'run-series' import test from 'tape' import WebTorrent from '../../index.js' test('Download usi...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/seed-while-download.js
test/node/seed-while-download.js
import fs from 'fs' import { Server as DHT } from 'bittorrent-dht' import fixtures from 'webtorrent-fixtures' import MemoryChunkStore from 'memory-chunk-store' import series from 'run-series' import test from 'tape' import WebTorrent from '../../index.js' test('Seed and download a file at the same time', t => { t.pl...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/limit-download-upload.js
test/node/limit-download-upload.js
import fixtures from 'webtorrent-fixtures' import test from 'tape' import MemoryChunkStore from 'memory-chunk-store' import WebTorrent from '../../index.js' const DOWNLOAD_SPEED_LIMIT = 200 * 1000 // 200 KB/s const UPLOAD_SPEED_LIMIT = 200 * 1000 // 200 KB/s function testSpeed (t, downloaderOpts, uploaderOpts, cb) { ...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/download-lsd-torrent.js
test/node/download-lsd-torrent.js
import fixtures from 'webtorrent-fixtures' import MemoryChunkStore from 'memory-chunk-store' import test from 'tape' import WebTorrent from '../../index.js' test('Download using LSD (via .torrent file)', t => { t.plan(3) const client1 = new WebTorrent({ dht: false, tracker: false, lsd: true }) const client2 = n...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/download-tracker-magnet.js
test/node/download-tracker-magnet.js
import fs from 'fs' import fixtures from 'webtorrent-fixtures' import MemoryChunkStore from 'memory-chunk-store' import series from 'run-series' import test from 'tape' import { Server as TrackerServer } from 'bittorrent-tracker' import WebTorrent from '../../index.js' test('Download using UDP tracker (via magnet uri)...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/server.js
test/node/server.js
import fs from 'fs' import fixtures from 'webtorrent-fixtures' import get from 'simple-get' import test from 'tape' import WebTorrent from '../../index.js' test('client.createServer: programmatic http server', t => { t.plan(11) const client = new WebTorrent({ tracker: false, dht: false, lsd: false }) client.on...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/download-webseed-torrent.js
test/node/download-webseed-torrent.js
import http from 'http' import path from 'path' import finalhandler from 'finalhandler' import fixtures from 'webtorrent-fixtures' import MemoryChunkStore from 'memory-chunk-store' import series from 'run-series' import serveStatic from 'serve-static' import test from 'tape' import WebTorrent from '../../index.js' // ...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/limit-methods.js
test/node/limit-methods.js
import fixtures from 'webtorrent-fixtures' import test from 'tape' import MemoryChunkStore from 'memory-chunk-store' import WebTorrent from '../../index.js' const DOWNLOAD_SPEED_LIMIT = 200 * 1000 // 200 KB/s const UPLOAD_SPEED_LIMIT = 200 * 1000 // 200 KB/s function testSpeed (t, downloaderOpts, uploaderOpts, cb) { ...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/node/download-dht-torrent.js
test/node/download-dht-torrent.js
import fs from 'fs' import { Server as DHT } from 'bittorrent-dht' import fixtures from 'webtorrent-fixtures' import MemoryChunkStore from 'memory-chunk-store' import series from 'run-series' import test from 'tape' import WebTorrent from '../../index.js' test('Download using DHT (via .torrent file)', t => { t.plan(...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/browser/basic.js
test/browser/basic.js
import test from 'tape' import WebTorrent from '../../index.js' test('WebTorrent.WEBRTC_SUPPORT', t => { t.plan(2) const client = new WebTorrent({ dht: false, tracker: false, lsd: false, natUpnp: false, natPmp: false }) client.on('error', err => { t.fail(err) }) client.on('warning', err => { t.fail(err) }) ...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/test/browser/server.js
test/browser/server.js
import test from 'tape' import WebTorrent from '../../index.js' import fixtures from 'webtorrent-fixtures' import get from 'simple-get' // The image append/render tests don't work in electron, so skip them // TODO get these working // logic taken from https://github.com/atom/electron/issues/2288#issuecomment-123147993...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/lib/conn-pool.js
lib/conn-pool.js
import net from 'net' // browser exclude import debugFactory from 'debug' import queueMicrotask from 'queue-microtask' import Peer from './peer.js' import utp from './utp.cjs' // browser exclude const debug = debugFactory('webtorrent:conn-pool') /** * Connection Pool * * A connection pool allows multiple swarms t...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/lib/torrent.js
lib/torrent.js
import EventEmitter from 'events' import fs from 'fs' import net from 'net' // browser exclude import os from 'os' // browser exclude import path from 'path' import addrToIPPort from 'addr-to-ip-port' import BitField from 'bitfield' import CacheChunkStore from 'cache-chunk-store' import { chunkStoreWrite } from 'chunk-...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
true
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/lib/webconn.js
lib/webconn.js
import BitField from 'bitfield' import debugFactory from 'debug' import fetch from 'cross-fetch-ponyfill' import ltDontHave from 'lt_donthave' import { hash, concat } from 'uint8-util' import Wire from 'bittorrent-protocol' import once from 'once' import VERSION from '../version.cjs' const debug = debugFactory('webto...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/lib/file-iterator.js
lib/file-iterator.js
import debugFactory from 'debug' import EventEmitter from 'events' const debug = debugFactory('webtorrent:file-iterator') /** * Async iterator of a torrent file * * @param {File} file * @param {Object} opts * @param {number} opts.start iterator slice of file, starting from this byte (inclusive) * @param {number...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/lib/worker-server.js
lib/worker-server.js
const portTimeoutDuration = 5000 let cancellable = false const listener = event => { const { url } = event.request if (!url.includes(self.registration.scope + 'webtorrent/')) return null if (url.includes(self.registration.scope + 'webtorrent/keepalive/')) return new Response() if (url.includes(self.registratio...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/lib/peer.js
lib/peer.js
import EventEmitter from 'events' import { Transform, pipeline } from 'streamx' import arrayRemove from 'unordered-array-remove' import debugFactory from 'debug' import Wire from 'bittorrent-protocol' const CONNECT_TIMEOUT_TCP = 5_000 const CONNECT_TIMEOUT_UTP = 5_000 const CONNECT_TIMEOUT_WEBRTC = 25_000 const HANDSH...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/lib/rarity-map.js
lib/rarity-map.js
/** * Mapping of torrent pieces to their respective availability in the torrent swarm. Used * by the torrent manager for implementing the rarest piece first selection strategy. */ export default class RarityMap { constructor (torrent) { this._torrent = torrent this._numPieces = torrent.pieces.length th...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/lib/worker.js
lib/worker.js
import fileResponse from './worker-server.js' self.addEventListener('install', () => { self.skipWaiting() }) self.addEventListener('fetch', event => { const res = fileResponse(event) if (res) event.respondWith(res) }) self.addEventListener('activate', () => { self.clients.claim() })
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/lib/file.js
lib/file.js
import EventEmitter from 'events' import { Readable } from 'streamx' import { chunkStoreRead } from 'chunk-store-iterator' import mime from 'mime/lite.js' import FileIterator from './file-iterator.js' export default class File extends EventEmitter { constructor (torrent, file) { super() this._torrent = torr...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/lib/server.js
lib/server.js
import http from 'http' import escapeHtml from 'escape-html' import pump from 'pump' import rangeParser from 'range-parser' import queueMicrotask from 'queue-microtask' import { Readable } from 'streamx' const keepAliveTime = 20000 class ServerBase { constructor (client, opts = {}) { this.client = client if...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/lib/selections.js
lib/selections.js
/** * @typedef {Object} MinimalSelectionItem * @property {number} from * @property {number} to */ /** A selection of pieces to download. * @typedef {MinimalSelectionItem & { * offset: number, * priority?: number, * notify?: function * remove?: function, * isStreamSelection?: boolean * }} SelectionItem ...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/dist/sw.min.js
dist/sw.min.js
(()=>{"use strict";let e=!1;self.addEventListener("install",()=>{self.skipWaiting()}),self.addEventListener("fetch",s=>{const t=(s=>{const{url:t}=s.request;return t.includes(self.registration.scope+"webtorrent/")?t.includes(self.registration.scope+"webtorrent/keepalive/")?new Response:t.includes(self.registration.scope...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
false
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/dist/webtorrent.chromeapp.js
dist/webtorrent.chromeapp.js
var t={20:(t,e,r)=>{var i=r(2861).Buffer,n=r(7108),s=r(96),o=r(6698),a=r(5359),h=r(4847),u=r(2951);function f(t){s.Writable.call(this);var e=u[t];if(!e)throw new Error("Unknown message digest");this._hashType=e.hash,this._hash=n(e.hash),this._tag=e.id,this._signType=e.sign}function l(t){s.Writable.call(this);var e=u[t]...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
true
webtorrent/webtorrent
https://github.com/webtorrent/webtorrent/blob/fd8f39e1560c5ae5db6b12153077877f0f33b076/dist/webtorrent.min.js
dist/webtorrent.min.js
var e,t,i={405:e=>{e.exports=async function*(e){for(let t of e)"function"==typeof t&&(t=t()),yield*t}},580:e=>{var t=/["'&<>]/;e.exports=function(e){var i,s=""+e,n=t.exec(s);if(!n)return s;var r="",o=0,a=0;for(o=n.index;o<s.length;o++){switch(s.charCodeAt(o)){case 34:i="&quot;";break;case 38:i="&amp;";break;case 39:i="...
javascript
MIT
fd8f39e1560c5ae5db6b12153077877f0f33b076
2026-01-04T15:01:34.127209Z
true
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/index.js
web/default/src/index.js
import React from 'react'; import ReactDOM from 'react-dom/client'; import { BrowserRouter } from 'react-router-dom'; import { Container } from 'semantic-ui-react'; import App from './App'; import Header from './components/Header'; import Footer from './components/Footer'; import 'semantic-ui-css/semantic.min.css'; imp...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/i18n.js
web/default/src/i18n.js
import i18n from 'i18next'; import {initReactI18next} from 'react-i18next'; import LanguageDetector from 'i18next-browser-languagedetector'; import zhTranslation from './locales/zh/translation.json'; import enTranslation from './locales/en/translation.json'; i18n .use(LanguageDetector) .use(initReactI18next) .in...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/App.js
web/default/src/App.js
import React, { lazy, Suspense, useContext, useEffect } from 'react'; import { Route, Routes } from 'react-router-dom'; import Loading from './components/Loading'; import User from './pages/User'; import { PrivateRoute } from './components/PrivateRoute'; import RegisterForm from './components/RegisterForm'; import Logi...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/helpers/history.js
web/default/src/helpers/history.js
import { createBrowserHistory } from 'history'; export const history = createBrowserHistory();
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/helpers/index.js
web/default/src/helpers/index.js
export * from './history'; export * from './auth-header'; export * from './utils'; export * from './api';
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/helpers/api.js
web/default/src/helpers/api.js
import { showError } from './utils'; import axios from 'axios'; export const API = axios.create({ baseURL: process.env.REACT_APP_SERVER ? process.env.REACT_APP_SERVER : '', }); API.interceptors.response.use( (response) => response, (error) => { showError(error); } );
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/helpers/auth-header.js
web/default/src/helpers/auth-header.js
export function authHeader() { // return authorization header with jwt token let user = JSON.parse(localStorage.getItem('user')); if (user && user.token) { return { 'Authorization': 'Bearer ' + user.token }; } else { return {}; } }
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/helpers/render.js
web/default/src/helpers/render.js
import { Label, Message } from 'semantic-ui-react'; import { getChannelOption } from './helper'; import React from 'react'; export function renderText(text, limit) { if (text.length > limit) { return text.slice(0, limit - 3) + '...'; } return text; } export function renderGroup(group) { if (group === '') ...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/helpers/helper.js
web/default/src/helpers/helper.js
import {CHANNEL_OPTIONS} from '../constants'; let channelMap = undefined; export function getChannelOption(channelId) { if (channelMap === undefined) { channelMap = {}; CHANNEL_OPTIONS.forEach((option) => { channelMap[option.key] = option; }); } return channelMap[channe...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/helpers/utils.js
web/default/src/helpers/utils.js
import {toast} from 'react-toastify'; import {toastConstants} from '../constants'; import React from 'react'; import {API} from './api'; const HTMLToastContent = ({ htmlContent }) => { return <div dangerouslySetInnerHTML={{ __html: htmlContent }} />; }; export default HTMLToastContent; export function isAdmin() { ...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/Dashboard/index.js
web/default/src/pages/Dashboard/index.js
import React, {useEffect, useState} from 'react'; import {useTranslation} from 'react-i18next'; import {Card, Grid} from 'semantic-ui-react'; import { Bar, BarChart, CartesianGrid, Legend, Line, LineChart, ResponsiveContainer, Tooltip, XAxis, YAxis, } from 'recharts'; import axios from 'axios'; impo...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/Token/index.js
web/default/src/pages/Token/index.js
import React from 'react'; import { Card } from 'semantic-ui-react'; import TokensTable from '../../components/TokensTable'; import { useTranslation } from 'react-i18next'; const Token = () => { const { t } = useTranslation(); return ( <div className='dashboard-container'> <Card fluid className='chart-c...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/Token/EditToken.js
web/default/src/pages/Token/EditToken.js
import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Button, Form, Header, Message, Segment, Card, } from 'semantic-ui-react'; import { useNavigate, useParams } from 'react-router-dom'; import { API, copy, showError, showSuccess, timestamp2st...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/Home/index.js
web/default/src/pages/Home/index.js
import React, { useContext, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Card, Grid, Header } from 'semantic-ui-react'; import { API, showError, showNotice, timestamp2string } from '../../helpers'; import { StatusContext } from '../../context/Status'; import { marked } fr...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/Chat/index.js
web/default/src/pages/Chat/index.js
import React from 'react'; const Chat = () => { const chatLink = localStorage.getItem('chat_link'); return ( <iframe src={chatLink} style={{ width: '100%', height: '85vh', border: 'none' }} /> ); }; export default Chat;
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/Setting/index.js
web/default/src/pages/Setting/index.js
import React from 'react'; import { useTranslation } from 'react-i18next'; import { Card, Tab } from 'semantic-ui-react'; import SystemSetting from '../../components/SystemSetting'; import { isRoot } from '../../helpers'; import OtherSetting from '../../components/OtherSetting'; import PersonalSetting from '../../compo...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/Channel/index.js
web/default/src/pages/Channel/index.js
import React from 'react'; import { Card } from 'semantic-ui-react'; import ChannelsTable from '../../components/ChannelsTable'; import { useTranslation } from 'react-i18next'; const Channel = () => { const { t } = useTranslation(); return ( <div className='dashboard-container'> <Card fluid className='c...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/Channel/EditChannel.js
web/default/src/pages/Channel/EditChannel.js
import React, {useEffect, useState} from 'react'; import {useTranslation} from 'react-i18next'; import {Button, Card, Form, Input, Message} from 'semantic-ui-react'; import {useNavigate, useParams} from 'react-router-dom'; import {API, copy, getChannelModels, showError, showInfo, showSuccess, verifyJSON,} from '../../h...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/User/index.js
web/default/src/pages/User/index.js
import React from 'react'; import { useTranslation } from 'react-i18next'; import { Card } from 'semantic-ui-react'; import UsersTable from '../../components/UsersTable'; const User = () => { const { t } = useTranslation(); return ( <div className='dashboard-container'> <Card fluid className='chart-card...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/User/EditUser.js
web/default/src/pages/User/EditUser.js
import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Button, Form, Card } from 'semantic-ui-react'; import { useParams, useNavigate } from 'react-router-dom'; import { API, showError, showSuccess } from '../../helpers'; import { renderQuota, renderQuotaWithPrompt ...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/User/AddUser.js
web/default/src/pages/User/AddUser.js
import React, { useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Button, Form, Card } from 'semantic-ui-react'; import { API, showError, showSuccess } from '../../helpers'; const AddUser = () => { const { t } = useTranslation(); const originInputs = { username: '', display_...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/About/index.js
web/default/src/pages/About/index.js
import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Card } from 'semantic-ui-react'; import { API, showError } from '../../helpers'; import { marked } from 'marked'; const About = () => { const { t } = useTranslation(); const [about, setAbout] = useState('')...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/NotFound/index.js
web/default/src/pages/NotFound/index.js
import React from 'react'; import { Message } from 'semantic-ui-react'; const NotFound = () => ( <> <Message negative> <Message.Header>页面不存在</Message.Header> <p>请检查你的浏览器地址是否正确</p> </Message> </> ); export default NotFound;
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/Redemption/index.js
web/default/src/pages/Redemption/index.js
import React from 'react'; import { Card } from 'semantic-ui-react'; import { useTranslation } from 'react-i18next'; import RedemptionsTable from '../../components/RedemptionsTable'; const Redemption = () => { const { t } = useTranslation(); return ( <div className='dashboard-container'> <Card fluid c...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/Redemption/EditRedemption.js
web/default/src/pages/Redemption/EditRedemption.js
import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Button, Form, Card } from 'semantic-ui-react'; import { useParams, useNavigate } from 'react-router-dom'; import { API, downloadTextAsFile, showError, showSuccess } from '../../helpers'; import { renderQuota, re...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/TopUp/index.js
web/default/src/pages/TopUp/index.js
import React, { useEffect, useState } from 'react'; import { Button, Form, Grid, Header, Card, Statistic, Divider, } from 'semantic-ui-react'; import { API, showError, showInfo, showSuccess } from '../../helpers'; import { renderQuota } from '../../helpers/render'; import { useTranslation } from 'react-i1...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/pages/Log/index.js
web/default/src/pages/Log/index.js
import React from 'react'; import { Card } from 'semantic-ui-react'; import { useTranslation } from 'react-i18next'; import LogsTable from '../../components/LogsTable'; const Log = () => { const { t } = useTranslation(); return ( <div className='dashboard-container'> <Card fluid className='chart-card'...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/OtherSetting.js
web/default/src/components/OtherSetting.js
import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Button, Divider, Form, Grid, Header, Message, Modal, } from 'semantic-ui-react'; import { Link } from 'react-router-dom'; import { API, showError, showSuccess, verifyJSON } from '../helpers'; impor...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/PasswordResetForm.js
web/default/src/components/PasswordResetForm.js
import React, { useEffect, useState } from 'react'; import { Button, Form, Grid, Header, Image, Card, Message, } from 'semantic-ui-react'; import { useTranslation } from 'react-i18next'; import { API, getLogo, showError, showInfo, showSuccess } from '../helpers'; import Turnstile from 'react-turnstile'; ...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/PasswordResetConfirm.js
web/default/src/components/PasswordResetConfirm.js
import React, { useEffect, useState } from 'react'; import { Button, Form, Grid, Header, Image, Card, Message, } from 'semantic-ui-react'; import { useTranslation } from 'react-i18next'; import { API, copy, getLogo, showError, showNotice } from '../helpers'; import { useSearchParams } from 'react-router-d...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/TokensTable.js
web/default/src/components/TokensTable.js
import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Button, Dropdown, Form, Label, Pagination, Popup, Table, } from 'semantic-ui-react'; import { Link } from 'react-router-dom'; import { API, copy, showError, showSuccess, showWarning, ti...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/ChannelsTable.js
web/default/src/components/ChannelsTable.js
import React, {useEffect, useState} from 'react'; import {useTranslation} from 'react-i18next'; import {Button, Dropdown, Form, Input, Label, Message, Pagination, Popup, Table,} from 'semantic-ui-react'; import {Link} from 'react-router-dom'; import { API, loadChannelModels, setPromptShown, shouldShowPrompt, ...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/PersonalSetting.js
web/default/src/components/PersonalSetting.js
import React, { useContext, useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Button, Divider, Form, Header, Image, Message, Modal, } from 'semantic-ui-react'; import { Link, useNavigate } from 'react-router-dom'; import { API, copy, showError, showInfo, ...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/LoginForm.js
web/default/src/components/LoginForm.js
import React, { useContext, useEffect, useState } from 'react'; import { Button, Divider, Form, Grid, Header, Image, Message, Modal, Segment, Card, } from 'semantic-ui-react'; import { Link, useNavigate, useSearchParams } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; impor...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/SystemSetting.js
web/default/src/components/SystemSetting.js
import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Button, Divider, Form, Grid, Header, Modal, Message, } from 'semantic-ui-react'; import { API, removeTrailingSlash, showError } from '../helpers'; const SystemSetting = () => { const { t } = use...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/RegisterForm.js
web/default/src/components/RegisterForm.js
import React, { useEffect, useState } from 'react'; import { Button, Form, Grid, Header, Image, Message, Card, Divider, } from 'semantic-ui-react'; import { Link, useNavigate } from 'react-router-dom'; import { useTranslation } from 'react-i18next'; import { API, getLogo, showError, showInfo, showSucces...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/OperationSetting.js
web/default/src/components/OperationSetting.js
import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Divider, Form, Grid, Header } from 'semantic-ui-react'; import { API, showError, showSuccess, timestamp2string, verifyJSON, } from '../helpers'; const OperationSetting = () => { const { t } = useTra...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/Footer.js
web/default/src/components/Footer.js
import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Container, Segment } from 'semantic-ui-react'; import { getFooterHTML, getSystemName } from '../helpers'; const Footer = () => { const { t } = useTranslation(); const systemName = getSystemName(); const [...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/GitHubOAuth.js
web/default/src/components/GitHubOAuth.js
import React, { useContext, useEffect, useState } from 'react'; import { Dimmer, Loader, Segment } from 'semantic-ui-react'; import { useNavigate, useSearchParams } from 'react-router-dom'; import { API, showError, showSuccess } from '../helpers'; import { UserContext } from '../context/User'; const GitHubOAuth = () =...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/PrivateRoute.js
web/default/src/components/PrivateRoute.js
import { Navigate } from 'react-router-dom'; import { history } from '../helpers'; function PrivateRoute({ children }) { if (!localStorage.getItem('user')) { return <Navigate to='/login' state={{ from: history.location }} />; } return children; } export { PrivateRoute };
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/UsersTable.js
web/default/src/components/UsersTable.js
import React, { useEffect, useState } from 'react'; import { Button, Form, Label, Pagination, Popup, Table, Dropdown, } from 'semantic-ui-react'; import { Link } from 'react-router-dom'; import { API, showError, showSuccess } from '../helpers'; import { useTranslation } from 'react-i18next'; import { ITE...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/Header.js
web/default/src/components/Header.js
import React, { useContext, useState } from 'react'; import { Link, useNavigate } from 'react-router-dom'; import { UserContext } from '../context/User'; import { useTranslation } from 'react-i18next'; import { Button, Container, Dropdown, Icon, Menu, Segment, } from 'semantic-ui-react'; import { API, ...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/Loading.js
web/default/src/components/Loading.js
import React from 'react'; import { Segment, Dimmer, Loader } from 'semantic-ui-react'; const Loading = ({ prompt: name = 'page' }) => { return ( <Segment style={{ height: 100 }}> <Dimmer active inverted> <Loader indeterminate>加载{name}中...</Loader> </Dimmer> </Segment> ); }; export def...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/LogsTable.js
web/default/src/components/LogsTable.js
import React, { useEffect, useState } from 'react'; import { Button, Form, Header, Label, Pagination, Segment, Select, Table, Popup, } from 'semantic-ui-react'; import { API, copy, isAdmin, showError, showSuccess, showWarning, timestamp2string, } from '../helpers'; import { useTranslatio...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/LarkOAuth.js
web/default/src/components/LarkOAuth.js
import React, { useContext, useEffect, useState } from 'react'; import { Dimmer, Loader, Segment } from 'semantic-ui-react'; import { useNavigate, useSearchParams } from 'react-router-dom'; import { API, showError, showSuccess } from '../helpers'; import { UserContext } from '../context/User'; const LarkOAuth = () => ...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/RedemptionsTable.js
web/default/src/components/RedemptionsTable.js
import React, { useEffect, useState } from 'react'; import { useTranslation } from 'react-i18next'; import { Button, Form, Label, Popup, Pagination, Table, } from 'semantic-ui-react'; import { Link } from 'react-router-dom'; import { API, copy, showError, showInfo, showSuccess, showWarning, ti...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/components/utils.js
web/default/src/components/utils.js
import { API, showError } from '../helpers'; export async function getOAuthState() { const res = await API.get('/api/oauth/state'); const { success, message, data } = res.data; if (success) { return data; } else { showError(message); return ''; } } export async function onGitHubOAuthClicked(gith...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/constants/toast.constants.js
web/default/src/constants/toast.constants.js
export const toastConstants = { SUCCESS_TIMEOUT: 5000, INFO_TIMEOUT: 8000, ERROR_TIMEOUT: 10000, WARNING_TIMEOUT: 10000, NOTICE_TIMEOUT: 20000, };
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/constants/index.js
web/default/src/constants/index.js
export * from './toast.constants'; export * from './user.constants'; export * from './common.constant'; export * from './channel.constants';
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/constants/user.constants.js
web/default/src/constants/user.constants.js
export const userConstants = { REGISTER_REQUEST: 'USERS_REGISTER_REQUEST', REGISTER_SUCCESS: 'USERS_REGISTER_SUCCESS', REGISTER_FAILURE: 'USERS_REGISTER_FAILURE', LOGIN_REQUEST: 'USERS_LOGIN_REQUEST', LOGIN_SUCCESS: 'USERS_LOGIN_SUCCESS', LOGIN_FAILURE: 'USERS_LOGIN_FAILURE', LOGOUT: '...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/constants/common.constant.js
web/default/src/constants/common.constant.js
export const ITEMS_PER_PAGE = 10; // this value must keep same as the one defined in backend!
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/constants/channel.constants.js
web/default/src/constants/channel.constants.js
export const CHANNEL_OPTIONS = [ { key: 1, text: 'OpenAI', value: 1, color: 'green' }, { key: 50, text: 'OpenAI 兼容', value: 50, color: 'olive', description: 'OpenAI 兼容渠道,支持设置 Base URL', }, {key: 14, text: 'Anthropic', value: 14, color: 'black'}, { key: 33, text: 'AWS', value: 33, color: 'b...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/context/User/reducer.js
web/default/src/context/User/reducer.js
export const reducer = (state, action) => { switch (action.type) { case 'login': return { ...state, user: action.payload }; case 'logout': return { ...state, user: undefined }; default: return state; } }; export const initialState = { use...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/context/User/index.js
web/default/src/context/User/index.js
// contexts/User/index.jsx import React from "react" import { reducer, initialState } from "./reducer" export const UserContext = React.createContext({ state: initialState, dispatch: () => null }) export const UserProvider = ({ children }) => { const [state, dispatch] = React.useReducer(reducer, initialState) ...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/context/Status/reducer.js
web/default/src/context/Status/reducer.js
export const reducer = (state, action) => { switch (action.type) { case 'set': return { ...state, status: action.payload, }; case 'unset': return { ...state, status: undefined, }; default: return state; } }; export const initialState = { s...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/default/src/context/Status/index.js
web/default/src/context/Status/index.js
// contexts/User/index.jsx import React from 'react'; import { initialState, reducer } from './reducer'; export const StatusContext = React.createContext({ state: initialState, dispatch: () => null, }); export const StatusProvider = ({ children }) => { const [state, dispatch] = React.useReducer(reducer, initia...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/berry/src/index.js
web/berry/src/index.js
import { createRoot } from 'react-dom/client'; // third party import { BrowserRouter } from 'react-router-dom'; import { Provider } from 'react-redux'; // project imports import * as serviceWorker from 'serviceWorker'; import App from 'App'; import { store } from 'store'; // style + assets import 'assets/scss/style....
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/berry/src/config.js
web/berry/src/config.js
const config = { // basename: only at build time to set, and Don't add '/' at end off BASENAME for breadcrumbs, also Don't put only '/' use blank('') instead, // like '/berry-material-react/react/default' basename: '/', defaultPath: '/panel/dashboard', fontFamily: `'Roboto', sans-serif, Helvetica, Arial, sans...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false
songquanpeng/one-api
https://github.com/songquanpeng/one-api/blob/8df4a2670b98266bd287c698243fff327d9748cf/web/berry/src/App.js
web/berry/src/App.js
import { useEffect } from 'react'; import { useSelector, useDispatch } from 'react-redux'; import { ThemeProvider } from '@mui/material/styles'; import { CssBaseline, StyledEngineProvider } from '@mui/material'; import { SET_THEME } from 'store/actions'; // routing import Routes from 'routes'; // defaultTheme import ...
javascript
MIT
8df4a2670b98266bd287c698243fff327d9748cf
2026-01-04T15:01:58.337509Z
false