Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .windsurf/rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Project context

- This is a documentation project on the Mintlify platform
- We use MDX files with YAML frontmatter
- We use MDX files with YAML frontmatter
- Navigation is configured in `docs.json`
- We follow technical writing best practices

Expand Down Expand Up @@ -33,7 +33,7 @@ description: "Concise description for SEO and navigation"

- `<Note>` for helpful supplementary information
- `<Warning>` for important cautions and breaking changes
- `<Tip>` for best practices and expert advice
- `<Tip>` for best practices and expert advice
- `<Info>` for neutral contextual information
- `<Check>` for success confirmations

Expand All @@ -60,7 +60,7 @@ description: "Concise description for SEO and navigation"

## API documentation requirements

- Document all parameters with `<ParamField>`
- Document all parameters with `<ParamField>`
- Show response structure with `<ResponseField>`
- Include both success and error examples
- Use `<Expandable>` for nested object properties
Expand Down
22 changes: 11 additions & 11 deletions docs/architecture/file-transfer-flow.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ async requestFileTransfer(files) {
size: file.size,
mime: file.type || mime.defaultMime
};

header.push(fileHeader);
totalSize += file.size;

if (!mime.isImage(file)) {
imagesOnly = false;
}
Expand Down Expand Up @@ -96,11 +96,11 @@ _onFilesTransferRequest(request) {
this.sendJSON({type: 'files-transfer-response', accepted: false});
return;
}

if (window.iOS && request.totalSize >= 200*1024*1024) {
this.sendJSON({
type: 'files-transfer-response',
accepted: false,
type: 'files-transfer-response',
accepted: false,
reason: 'ios-memory-limit'
});
return;
Expand Down Expand Up @@ -169,7 +169,7 @@ async _sendFile(file) {
name: file.name,
mime: file.type || mime.defaultMime
});

this._chunker = new FileChunker(
file,
chunk => this._send(chunk),
Expand Down Expand Up @@ -225,7 +225,7 @@ class FileDigester {
if (isNaN(this.progress)) this.progress = 1;

if (this._bytesReceived < this._size) return;

const blob = new Blob(this._buffer);
this._buffer = null;
this._callback(new File([blob], this._name, {
Expand Down Expand Up @@ -341,12 +341,12 @@ _onFileTransferCompleted() {

const sameSize = fileBlob.size === acceptedHeader.size;
const sameName = fileBlob.name === acceptedHeader.name;
Events.fire('file-received', {
file: fileBlob,
Events.fire('file-received', {
file: fileBlob,
peerId: this._peerId,
imagesOnly: request.imagesOnly,
sameSize,
sameName
sameSize,
sameName
});
}
```
Expand Down
10 changes: 5 additions & 5 deletions docs/architecture/signaling-server.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default class ErikrafTdropWsServer {
this._rooms = {}; // { roomId: peers[] }
this._roomSecrets = {}; // { pairKey: roomSecret }
this._keepAliveTimers = {};

this._wss = new WebSocketServer({ server });
this._wss.on('connection', (socket, request) => this._onConnection(new Peer(socket, request, conf)));
}
Expand All @@ -76,7 +76,7 @@ _onConnection(peer) {
}
return;
}

peer.socket.on('message', message => this._onMessage(peer, message));
peer.socket.onerror = e => console.error(e);
this._keepAlive(peer);
Expand All @@ -94,15 +94,15 @@ function isLocalIp(ip) {
if (!ip.includes(":")) {
return LOCAL_IPV4_PATTERNS.some(pattern => pattern.test(ip));
}

// IPv6 local address validation
const firstWord = ip.split(":").find(el => !!el);
if (/^fe[c-f][0-9a-f]$/.test(firstWord)) return true;
if (/^fc[0-9a-f]{2}$/.test(firstWord)) return true;
if (/^fd[0-9a-f]{2}$/.test(firstWord)) return true;
if (firstWord === "fe80") return true;
if (firstWord === "100") return true;

return false;
}
```
Expand Down Expand Up @@ -278,7 +278,7 @@ _onPairDeviceJoin(sender, message) {
const roomSecret = this._roomSecrets[message.pairKey].roomSecret;
const creator = this._roomSecrets[message.pairKey].creator;
this._removePairKey(message.pairKey);

this._send(sender, {
type: 'pair-device-joined',
roomSecret: roomSecret,
Expand Down
8 changes: 4 additions & 4 deletions docs/architecture/webrtc-connection.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ The core WebRTC functionality is implemented in the `RTCPeer` class in `network.
class RTCPeer extends Peer {
constructor(serverConnection, isCaller, peerId, roomType, roomId, rtcConfig) {
super(serverConnection, isCaller, peerId, roomType, roomId);

this.rtcSupported = true;
this.rtcConfig = rtcConfig;

if (!this._isCaller) return; // we will listen for a caller
this._connect();
}
Expand Down Expand Up @@ -215,15 +215,15 @@ getConnectionHash() {
const localDescriptionLines = this._conn.localDescription.sdp.split("\r\n");
const remoteDescriptionLines = this._conn.remoteDescription.sdp.split("\r\n");
let localConnectionFingerprint, remoteConnectionFingerprint;

// Extract fingerprints from SDP
for (let i=0; i<localDescriptionLines.length; i++) {
if (localDescriptionLines[i].startsWith("a=fingerprint:")) {
localConnectionFingerprint = localDescriptionLines[i].substring(14);
break;
}
}

// Combine and hash fingerprints
const combinedFingerprints = this._isCaller
? localConnectionFingerprint + remoteConnectionFingerprint
Expand Down
6 changes: 3 additions & 3 deletions docs/ecosystem/discord.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ class ErikrafTDropBot {
GatewayIntentBits.MessageContent
]
});

this.dropClient = new DropClient();
this.setupEventHandlers();
}
Expand Down Expand Up @@ -170,7 +170,7 @@ class DropCommand {

async execute(interaction) {
const { key, name, message, file1, file2, file3 } = interaction.options;

// Validate pairing key
if (!this.validateKey(key)) {
return interaction.reply({
Expand All @@ -185,7 +185,7 @@ class DropCommand {

// Initiate transfer
await this.initiateTransfer(key, name, files, textMessage);

// Send response
await interaction.reply({
content: 'Transfer initiated successfully',
Expand Down
4 changes: 2 additions & 2 deletions docs/ecosystem/extensions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -148,14 +148,14 @@ export function activate(context: vscode.ExtensionContext) {
'erikraft-drop.shareFile',
shareFileHandler
);

// Register context menu
vscode.commands.executeCommand(
'setContext',
'erikraft-drop.enabled',
true
);

context.subscriptions.push(shareFileCommand);
}
```
Expand Down
12 changes: 6 additions & 6 deletions docs/ecosystem/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ graph TB
Web[Web App]
PWA[PWA Client]
end

subgraph "Mobile Ecosystem"
Android[Android App]
iOS[iOS Shortcut]
end

subgraph "Desktop Ecosystem"
Browser[Browser Extensions]
IDE[IDE Extensions]
Thunderbird[Thunderbird Add-on]
end

subgraph "Communication Ecosystem"
Discord[Discord Bot]
API[REST API]
end

Web --> WS
PWA --> WS
Android --> WS
Expand Down Expand Up @@ -151,7 +151,7 @@ sequenceDiagram
participant Client as Ecosystem Client
participant Server as Signaling Server
participant Peer as Remote Peer

Client->>Server: WebSocket connection
Server->>Client: Peer list
Client->>Server: WebRTC offer
Expand All @@ -167,7 +167,7 @@ sequenceDiagram
participant Client as Ecosystem Client
participant Server as Signaling Server
participant Peer as Remote Peer

Client->>Server: WebSocket connection
Server->>Client: Peer list
Client->>Server: File transfer request
Expand Down
4 changes: 2 additions & 2 deletions docs/ecosystem/shortcut.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,12 @@ graph TD
B -->|Documents| D[Process Document Files]
B -->|URLs| E[Process Web Links]
B -->|Text| F[Process Text Content]

C --> G[Format for Transfer]
D --> G
E --> G
F --> G

G --> H[Open ErikrafT Drop]
H --> I[Initiate Transfer]
```
Expand Down
10 changes: 5 additions & 5 deletions docs/features/device-pairing.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ _onPairDeviceJoin(sender, message) {
const roomSecret = this._roomSecrets[message.pairKey].roomSecret;
const creator = this._roomSecrets[message.pairKey].creator;
this._removePairKey(message.pairKey);

this._send(sender, {
type: 'pair-device-joined',
roomSecret: roomSecret,
Expand Down Expand Up @@ -240,12 +240,12 @@ async _initDOM() {
roomSecretsEntries.forEach(roomSecretsEntry => {
let $pairedDevice = document.createElement('div');
$pairedDevice.classList.add('paired-device');

// Device display information
const displayDiv = document.createElement('div');
displayDiv.className = 'display-name';
displayDiv.textContent = roomSecretsEntry.displayName;

// Auto-accept toggle
const input = document.createElement('input');
input.type = 'checkbox';
Expand All @@ -255,7 +255,7 @@ async _initDOM() {
autoAccept: e.target.checked
});
});

$pairedDevice.appendChild(displayDiv);
$pairedDevice.appendChild(input);
this.$pairedDevicesWrapper.appendChild($pairedDevice);
Expand Down Expand Up @@ -334,7 +334,7 @@ class EditPairedDevicesDialog extends Dialog {
constructor() {
super('edit-paired-devices-dialog');
this.$pairedDevicesWrapper = this.$el.querySelector('.paired-devices-wrapper');

Events.on('peer-display-name-changed', e => this._onPeerDisplayNameChanged(e));
Events.on('keydown', e => this._onKeyDown(e));
}
Expand Down
2 changes: 1 addition & 1 deletion docs/features/p2p-transfer.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Devices discover each other through:
```javascript
// From network.js lines 1104-1113
_connect() {
if (!this._conn || this._conn.signalingState === "closed")
if (!this._conn || this._conn.signalingState === "closed")
this._openConnection();

if (this._isCaller) {
Expand Down
10 changes: 5 additions & 5 deletions docs/features/qr-connection.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -119,8 +119,8 @@ The system requests camera access for QR code scanning:

```javascript
// Camera access is handled by the browser's getUserMedia API
navigator.mediaDevices.getUserMedia({
video: { facingMode: 'environment' }
navigator.mediaDevices.getUserMedia({
video: { facingMode: 'environment' }
})
.then(stream => {
// Initialize QR code scanner
Expand Down Expand Up @@ -238,17 +238,17 @@ When camera access is unavailable:
function validatePairUrl(url) {
const parsedUrl = new URL(url);
const pairKey = parsedUrl.searchParams.get('pair_key');

// Validate pair key format
if (!/^\d{6}$/.test(pairKey)) {
throw new Error('Invalid pair key format');
}

// Validate domain
if (!allowedDomains.includes(parsedUrl.hostname)) {
throw new Error('Unauthorized domain');
}

return pairKey;
}
```
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/configuration.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,8 @@ if (cluster.isMaster) {
// From network.js lines 819-822
if (window.iOS && request.totalSize >= 200*1024*1024) {
this.sendJSON({
type: 'files-transfer-response',
accepted: false,
type: 'files-transfer-response',
accepted: false,
reason: 'ios-memory-limit'
});
return;
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/host-your-own.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ The easiest way to get ErikrafT Drop up and running is by using Docker.
```bash
docker run -d --restart=unless-stopped --name=pairdrop -p 127.0.0.1:3000:3000 lscr.io/linuxserver/pairdrop
```
> ⚠️ **This is a third-party community image** hosted by [linuxserver.io](https://linuxserver.io).
> ⚠️ **This is a third-party community image** hosted by [linuxserver.io](https://linuxserver.io).
> This is based on PairDrop (a similar but unofficial project), not the official ErikrafT Drop.
> For more information visit https://hub.docker.com/r/linuxserver/pairdrop
>
>
> **For official ErikrafT Drop images, build from source using the Dockerfile below.**


Expand Down
Loading