Code Monkey home page Code Monkey logo

xdccjs's People

Contributors

bikashdaga avatar code-factor avatar dependabot-preview[bot] avatar dependabot[bot] avatar jipaix avatar snyk-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

xdccjs's Issues

Resumption of stopped downloads not working

Hello again, sorry for writing directly 2 tickets in a row.

Maybe I'm doing something wrong or just don't understand it right.
Right now I wanted to test the resume functionality of an aborted or failed download.

I tried the following usecases through code-flow and through cli-flow. Both failed on me.

Step 1:
npx xdccJS --host irc.rizon.net --bot "CR-HOLLAND|NEW" --nickname climan --channel #subsplease --download 2679 --path __dirname

Step 2:
Abort download after 2-3 seconds.
(On unix - terminals you can abort the running command with command+c)
In code-flow I just wrote
setTimeout(() => { job.cancel() }, 3000)

Step 3:
Now I'm just restarting the download from step 1 again.

Result:

connected to : irc.rizon.net
joined: [ #subsplease ]
> sending command: /MSG CR-HOLLAND|NEW xdcc send 2679
[X] couldn't connect to 89.149.202.221:12345
[X] couldn't connect to 89.149.202.221:12345
[i] retrying: 1/1
[X] couldn't connect to 89.149.202.221:12345
[X] couldn't connect to 89.149.202.221:12345
[X] skipped pack: 2679
[X] couldn't download pack: 2679 from cr-holland|new

The only solution right now is to delete the file from the folder specified in the path-variable from step 1 completely.
Only then the download will restart again.

Any ideas how this can be fixed?

Joining multiple channels does not work

Describe the bug
Some communities require the user to join multiple channels in order to download. For example: #MOVIEGODS requires users to also join #mg-chat, otherwise the bots will simply ignore the users requests. While the CLI option --channel [chan...] does exist, it does not seem to function correctly. xdccJS only seems to join the first channel.

To Reproduce
xdccJS --host irc.abjects.net --bot "some_bot" --download "#123" --channel "#MOVIEGODS" "#mg-chat"

Expected behavior
Join both channels before DMing the bot.

Actual behavior
Only #MOVIEGODS is being joined before DMing the bot. The bot then ignores the request, because the user is not in #mg-chat.

Context:

  • OS: Linux Mint v20.3
  • Version: v4.5.0

resume file download (passive method)

Server creation must be done here:

xdccJS/index.ts

Lines 486 to 500 in 174e27a

if(fileInfo.type === 'DCC SEND') {
const quotedFilename = /\s/.test(fileInfo.file) ? `"${fileInfo.file}"` : fileInfo.file
this.ctcpRequest(resp.nick, 'DCC RESUME', quotedFilename, fileInfo.port, position)
this.resumequeue.push({nick: resp.nick, ip: fileInfo.ip, length: fileInfo.length})
this.timeouts = setTimeout(() => {
this.say(resp.nick, 'XDCC CANCEL')
const err = new Error(`RESUMETIMEOUT: Couldn't resume transfert`)
this.emit('download-err', err, fileInfo)
if (this.verbose) {
console.error(
`\u2937`.padStart(6),
`\x1b[1m\x1b[31m\u0058\x1b[0m couldn't resume download of: \x1b[33m${fileInfo.file}\x1b[0m`
)
}
}, 10000);

adding something like this (just an idea):

const client;
const server;
if (fileInfo.port === 0) {
  server = net.createServer(c => {
  // timeout(()=>{})
  client = c
  })
}

Then here:

xdccJS/index.ts

Lines 491 to 501 in c726ebf

file.on('ready', () => {
if (fileInfo.port === 0) {
clearTimeout(timeout)
clearTimeout(this.timeouts)
this.passiveToFile(file, fileInfo, timeout, resp.nick)
} else {
clearTimeout(this.timeouts)
this.activeToFile(file, fileInfo, timeout, resp.nick)
}
})
}

add server and client to function passiveToFile :

passiveToFile(file, fileInfo, timeout, resp.nick, server, client) {
 if(server && client) {
   //=> DCC RESUME MSG
  } else {
   // Not a resume, setup a server as before.
 }
// server and client events
// server.listening(ip, port)
}

--server change to --host

Describe the bug
wrong documentation statement on front page as advised user to use -- server
which provides [ error: unknown option '--server' ]

To Reproduce
just following save profile section user will get a error about --server

Expected behavior
to save profile, user has to use --host instead

Screenshots
error

Context:

  • OS: Windows
  • Version: 64bit

Additional context
just a small correction on front page .

Poll: Does xdccJS need a WEB-UI ?

What's a weebwee?

It's a Web User Interface, by definition ยซ a control panel in a device presented to the user via the Web browser ยป

but what for ?

command-line is so 70's, wouldn't you rather use xdccJS with a nice graphical interface you can interact with?

Click to vote:



xdccJS shutting down instantly/after a few seconds

Describe the bug
I used the example template from the readme page, changed the server address to irc.freenode.net and ran that, but node will just run for a second or two and then shut down without any info. I expect it to run all the time until I shut it down?
Am I supposed to do something different? Am I missing error messages anywhere? I also tried using the irc-frameworks raw event but there nothing gets output as well. Is this also maybe not designed for continuous running?

To Reproduce
Steps to reproduce the behavior:

  1. Use the template from the readme page
  2. exchange the server url for e.g. freenode
  3. change the 'ready' function to do a log
  4. node index.js

Expected behavior
The server would run, do the log and then just stay alive.

Context:

  • OS: macOS Monterey
  • Version: 4.4.19

resume file download

Describe the solution you'd like

  • Auto-resuming file if the filename's the same

vlc paths for 64bit

Describe the bug
user installed 64bit VLC there is a difference in path which is under C:\Program Files (x86)\VideoLAN\VLC\vlc.exe

To Reproduce
install 64bit and check path

Expected behavior
global path maybe to include 64 and 32 paths for vlc and maybe mpv path

Screenshots
vlc

Context:

  • OS: windows
  • Version: 64

Additional context
maybe include both 64 and 32 pathways for binary. optional to include mpv , allow user to save player pathway when saving profile.

useless code

xdccJS/index.ts

Lines 473 to 478 in 174e27a

if (
typeof fileInfo.filePath === 'undefined' ||
fileInfo.filePath === null
) {
throw Error('filePath must be defined')
}

Be able to provide a password for NickServ to authenticate with nickname

Firstly, thank you for making this! It was one of the few tools I could find that actually worked on all the servers I tested it on ๐Ÿ˜€

Some servers give a wait time before you can download, this has been sorted with the --wait time argument, however most servers will remove this waiting time if you identify with NickServ with a registered nickname (/msg NickServ IDENTIFY <pass>). Being able to provide xdccJS a password to do this would shave of the waiting time and would be extremely useful.

image

Expose ETA

Is your feature request related to a problem? Please describe.
It would be awesome to make available the ETA also in the downloading event

Describe the solution you'd like
It could be the forth parameter of the downloading event handler

Describe alternatives you've considered
Calculate it by myself

Additional context
In order to have better informations about the download in progress, ETA is a crucial information in my opinion

A CLI option to configure the request timeout (to accomodate queues)

issue

[...]

Nevertheless, I was still not getting my download started. Upon further investigation, I think that this might have something to do with the bot queuing my request, but xdccJS aborting the download after a fixed 30 second timeout. Unfortunately, the timeout is currently not configurable through the CLI (moviegods is very highly frequented and queuing times > 10min do regularly happen).

This currently leads me to a couple of "feature requests" and a bug report:

  • A CLI option to configure the request timeout (to accomodate queues)
  • A CLI option to log private bot messages to the console (to debug if the bot has a problem with my request or is queueing it)

[...]

Originally posted by @mikeputh in #500 (comment)

requirements

  • Add Job.on('message') to listen to bot's message
  • When verbose is true, bot message should always be displayed.
  • ๐Ÿšซ Add queueTimeout (or similar name) to XDCC constructor PARMAS
  • ๐Ÿšซ Add --queue-timeout (or similar name) to XDCC CLI options.
  • ๐Ÿšซ use that instead of the fixed 30s
  • add queue parameter which is a regex
    • cancel timeout if bot sends a message matching queue
    • implement this for the CLI

weird [?] font character in terminal

Describe the bug
terminal weird font character

To Reproduce
npm install xdccjs -g

Expected behavior
show normal fonts

Screenshots

Capture

Context:

  • windows 64bit
  • Version: latest US language Windows

Additional context
green, white, blue weird [?] symbol

No .on() - listener method when using typescript

Hello, yesterday I tried to implement a couple of things with your library.
I decided to go by the typescript flow.

The problem is, neither the XDCC-class, nor the Job-class expose listener methods.

Bildschirmfoto 2022-06-04 um 15 38 29

Bildschirmfoto 2022-06-04 um 15 40 39

The only way right now to listen for "download" or "downloading" events is to go through the .irc object.

Bildschirmfoto 2022-06-04 um 15 42 14

Documentation related to how it extends irc-framework is outdated

README.md includes this line:

xdccJS includes (and extends) @kiwiirc/irc-framework, if you need more advanced (IRC) features check their documentation and some examples on how its used with xdccJS

This line was correct until commit 2ca67d9, after that the XDCC class was refactored to extend not Client but CtcpParser, then, on commit 82d45d9, this class was changed to extend EventEmitter.

Now the IRC client can be accessed by the irc property, but it's not noted in the documentation.

TLS conenections do not work

Describe the bug
TLS connections do not work

To Reproduce
Steps to reproduce the behavior:

  1. Create an XDCC client with the following options:
    tls: { enable: true, rejectUnauthorized: true }
  2. Run the program
  3. No output, program just ends.

Expected behavior
Client should establish a connection.

Context:

  • OS: Windows 11
  • Node: 16.19.0
  • Typescript: 4.9.4

Sample code to replicate

import XDCC from 'xdccjs'

const xdccJS = new XDCC({
  host: 'irc.server.net',
  chan: ['#channel'],
  nickname: 'Nickname',
  tls: {
    enable: true,
    rejectUnauthorized: false
  }, 
  path: './tmp/',
  verbose: true
})

xdccJS.on('ready', () => {
    console.log("XDCC client ready")
})

This code was written with typescript if that matters.

"XDCC client ready" does not get logged. The program just ends with no output. However, removing the TLS option does connect to the host. Also, host does work with TLS connections as connecting via "HexChat" client with the TLS option works.

Download bandwidth throttling

Is your feature request related to a problem? Please describe.

I have an automated downloader running on my server that will start to download files whenever they're available. This can be at arbitrary times, but ends up choking my network for larger files. Since there is no way to cap the download speed, my only option is to stop the download and retry at a later time, or not stream any videos for the duration of the download.

Describe the solution you'd like

Ideally, I'd like to set the maximum download speed for a single or all jobs. This limit should be adjustable dynamically by calling something like job.throttle(2048*1000) in order to update the maximum download speed to 2 MB/s.

Describe alternatives you've considered

I've previously used solutions like wondershaper, but that limits the whole network adaptor and not just a single node program. I'm sure there would be ways to limit the network bandwidth of the node program using a secondary tool, but I think adding a download speed limit would be fitting for a downloader library like this.

Additional context

There are some packages on npm that can limit streams, like speed-limiter or throttled-reader. However, I'm not sure if they will actually impact TCP's flow control, of if the download will use the same bandwidth, caching the data before sending it through the throttled stream.

Would love to discuss this with you!

downloads keep getting aborted at random points

I noticed a problem, that my downloads keep getting aborted at random points now, which I have not encountered before. I am still investigating if it's due to a shaky internet connection or if the download gets aborted when a Bot message comes in (e.g. new pack announcement). I suspect the latter, but don't know for sure.

Log:

> connected to : <NETWORK>
  > joined: [ #CHANNEL1 #CHANNEL2 ]
    > sending command: /MSG <BOT NAME> xdcc send <PACKAGE NUMBER>
        @<BOT NAME>: ** Sending you pack #<PACKAGE NUMBER> ("<PACKAGE NAME>") ...
     [i] downloading : <PACKAGE NAME>
      | [=============       ] ETA: 3 minutes 8s @ 14.98 MB/s - 68%[X] Connection error: read ECONNRESET
     [X] Connection error: read ECONNRESET
      [i] retrying: 1/1
[X] Connection error: read ECONNRESET
     [X] Connection error: read ECONNRESET
      [X] skipped pack: <PACKAGE NUMBER>
      [X] couldn't download pack: <PACKAGE NUMBER> from <BOT NAME>

Originally posted by @mikeputh in #500 (comment)

Profile saved but not detected

it appears there might be some issue with setting up profiles, it seems to save the profile but it does not detect it
I have removed and reinstalled xdccjs with the same issue. streaming now works on vlc.
Untitled

Originally posted by @omgbox in #229 (comment)

PassivePort parameter isn't optional

Describe the bug
Omitting passivePort in the constructor results in this error : unexpected type of 'passivePort': an array of numbers was expected

To Reproduce

const XDCC = require('xdccjs').default
let opts = {
    host: 'IRC.rizon.NET',
    nick: 'xipai',
    chan: ['horriblesubs'],
    path: 'downloads',
    port: 6667,
    verbose: true,
    randomizeNick: true,
}
const xdccJS = new XDCC(opts)

Expected behavior

  • No errors
  • When omitted, passivePort must be automaticaly set to it's default value : [5001]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.