Page 1 of 2

[APP] nslogin-web (web app to log into/restore nations)

PostPosted: Wed Jan 25, 2017 10:32 pm
by Auralia
nslogin-web

nslogin-web is a free and open source web application that allows you to automatically log into and semi-automatically restore NationStates nations. This is useful to maintain a large number of puppet nations by preventing them from ceasing to exist or easily restoring them if they have ceased to exist.

Usage

The latest version of nslogin-web can be accessed here. Usage should be fairly self-explanatory; however, if you have any questions, you can ask them here and I'll answer them as soon as I can.

You can also view the source code on GitHub.

License

nslogin-web is licensed under the Apache License 2.0.

PostPosted: Sat Jan 28, 2017 7:02 am
by Orioni 2
Interesting solution. This is certainly preferable to the previous builds that required frameworks. I've added this to my watchlist on Github.

As always, the major concerns remains security. Uploading a list of nations and passwords leads to questions of privacy. Then again, your history with building the previous Nation Manager lends credibility. :clap:

PostPosted: Sat Jan 28, 2017 7:58 am
by Auralia
Orioni 2 wrote:As always, the major concerns remains security. Uploading a list of nations and passwords leads to questions of privacy.

You're not uploading anything, actually. The usernames and passwords don't leave your browser (aside from going to NationStates, obviously). Everything happens client-side.

It's also completely open source -- you can verify pretty easily that I'm not doing anything underhanded.

PostPosted: Sun Jan 29, 2017 2:12 am
by Orioni 2
Auralia wrote:It's also completely open source -- you can verify pretty easily that I'm not doing anything underhanded.

Certainly. First thing I did was review your code. :geek: Very pleased with your creation. Let me know if there is any way I can contribute.

PostPosted: Sun Jan 29, 2017 2:45 am
by CoraSpia
Just clicked start and it seems to be doing nothing? Is it live?

Edit: it just doesn't work on IE

PostPosted: Sun Jan 29, 2017 12:43 pm
by Auralia
CoraSpia wrote:Edit: it just doesn't work on IE


That's very possible. If I have time I'll investigate, but I'd recommend using Chrome or Firefox in the meantime.

PostPosted: Tue Jan 31, 2017 12:21 am
by Rejak
It also seems to work on Edge.

[APPLICATION] nslogin-web

PostPosted: Wed Feb 01, 2017 8:30 am
by Parhe
Great app! My puppets were set to CTE in a couple of days and the perl script I was using suddenly stopped working, so I decided to give this a try. The closest thing to an issue I had is that the page apparently ran out of memory after 2558 nations but that's hardly an issue, as I could just run the rest of my nations separately later. I'm so bad at computers that I do not even know on whose side that error is coming from.

Thank you! :)

PostPosted: Wed Feb 01, 2017 6:44 pm
by Flanderlion
Parhe wrote:Great app! My puppets were set to CTE in a couple of days and the perl script I was using suddenly stopped working, so I decided to give this a try. The closest thing to an issue I had is that the page apparently ran out of memory after 2558 nations but that's hardly an issue, as I could just run the rest of my nations separately later. I'm so bad at computers that I do not even know on whose side that error is coming from.

Thank you! :)

The Perl script you've got to switch the url to https rather than http due to the site update.

[APPLICATION] nslogin-web

PostPosted: Wed Feb 01, 2017 7:37 pm
by Parhe
Flanderlion wrote:
Parhe wrote:Great app! My puppets were set to CTE in a couple of days and the perl script I was using suddenly stopped working, so I decided to give this a try. The closest thing to an issue I had is that the page apparently ran out of memory after 2558 nations but that's hardly an issue, as I could just run the rest of my nations separately later. I'm so bad at computers that I do not even know on whose side that error is coming from.

Thank you! :)

The Perl script you've got to switch the url to https rather than http due to the site update.

Thank you <3 Didn't notice.

PostPosted: Thu Apr 06, 2017 2:38 pm
by Red Dusk
So I've been running into an error recently that breaks the nslogin application after about the 14th nation in my list. Google Chrome Ver, 57.0.2987.133 on Windows 10, no other Nationstates applications actively interfacing with the API (I have Adagar's NS Telegrammer open, but I had stopped it's process and waited about 5 minutes before starting up nslogin)

Here's the error code I get with verbose mode (removed my IP for security reasons)
Code: Select all
error: { [Error: Request failed: API returned HTTP response code 429]
  responseMetadata:
   { _readableState:
      { objectMode: false,
        highWaterMark: 16384,
        buffer: [Object],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: true,
        ended: true,
        endEmitted: true,
        reading: false,
        sync: false,
        needReadable: false,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: false,
     _events: { end: [Object], error: [Function], data: [Function] },
     _maxListeners: undefined,
     _mode: 'fetch',
     headers: { 'content-type': 'text/html; charset=utf-8' },
     rawHeaders: [ 'content-type', 'text/html; charset=utf-8' ],
     trailers: {},
     rawTrailers: [],
     _fetchResponse: {},
     url: 'https://www.nationstates.net/cgi-bin/api.cgi?userAgent=node-nsapi%200.1.13%20(maintained%20by%20Auralia%2C%20currently%20used%20by%20%22Red%20Dusk%22)&q=nextissuetime&nation=dusk_falls%207&v=9',
     statusCode: 429,
     statusMessage: '' },
  responseText: '\n
Too Many Requests From Your IP Address
\n
Your IP address [IP removed] has sent more than 50 requests in 30 seconds. Access to the API has been blocked for the next 16 minutes. Please do not send bursts of traffic!

Requests should be spaced out to avoid hitting the rate limit and compromising server performance. Please ask for assistance in the Technical forum if you are unsure how to do this.\n

Error: 429 Too Many Requests\n

The NationStates API Documentation\n' }


Just figured I should post this so that Auralia knows about it. o/

PostPosted: Sat Apr 22, 2017 3:32 pm
by Auralia
Red Dusk wrote:snip

Are you sure you're not making any requests to the API while using the application? nslogin-web is configured to respect the API rate limit, but it assumes that nobody else is using the API at the same time.

PostPosted: Sat Apr 22, 2017 5:37 pm
by Red Dusk
Auralia wrote:
Red Dusk wrote:snip

Are you sure you're not making any requests to the API while using the application? nslogin-web is configured to respect the API rate limit, but it assumes that nobody else is using the API at the same time.

The only client that accesses the API I have on my computer is Adagar's auto-telegrammer. I've also encountered the issue on my phone, using data. I'll replicate it on my phone's data later tonight, if needed.

PostPosted: Tue Apr 25, 2017 4:56 pm
by Red Dusk
Performed a test after manually killing all tasks that were accessing the internet, and still get the error.

Code: Select all
error: { [Error: Request failed: API returned HTTP response code 429]
  responseMetadata:
   { _readableState:
      { objectMode: false,
        highWaterMark: 16384,
        buffer: [Object],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: true,
        ended: true,
        endEmitted: true,
        reading: false,
        sync: false,
        needReadable: false,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: false,
     _events: { end: [Object], error: [Function], data: [Function] },
     _maxListeners: undefined,
     _mode: 'fetch',
     headers: { 'content-type': 'text/html; charset=utf-8' },
     rawHeaders: [ 'content-type', 'text/html; charset=utf-8' ],
     trailers: {},
     rawTrailers: [],
     _fetchResponse: {},
     url: 'https://www.nationstates.net/cgi-bin/api.cgi?userAgent=node-nsapi%200.1.13%20(maintained%20by%20Auralia%2C%20currently%20used%20by%20%22Red%20Dusk%22)&q=lastlogin&nation=dusk_falls%2011&v=9',
     statusCode: 429,
     statusMessage: '' },
  responseText: '\n
Too Many Requests From Your IP Address
\n
Your IP address [removed] has sent more than 50 requests in 30 seconds. Access to the API has been blocked for the next 16 minutes. Please do not send bursts of traffic!

Requests should be spaced out to avoid hitting the rate limit and compromising server performance. Please ask for assistance in the Technical forum if you are unsure how to do this.\n

Error: 429 Too Many Requests\n

The NationStates API Documentation\n' }


Will test from phone* in 20 minutes and edit in the error log if I get one there, but shouldn't affect it. (As in, on phone data. I'm waiting 20 minutes just so that I can't run into problems with NS admins for trying to circumnavigate a temp-ban on my IP)

Same result:
Code: Select all
error: { [Error: Request failed: API returned HTTP response code 429]
  responseMetadata:
   { _readableState:
      { objectMode: false,
        highWaterMark: 16384,
        buffer: [Object],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: true,
        ended: true,
        endEmitted: true,
        reading: false,
        sync: false,
        needReadable: false,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: false,
     _events: { end: [Object], error: [Function], data: [Function] },
     _maxListeners: undefined,
     _mode: 'fetch',
     headers: { 'content-type': 'text/html; charset=utf-8' },
     rawHeaders: [ 'content-type', 'text/html; charset=utf-8' ],
     trailers: {},
     rawTrailers: [],
     _fetchResponse: {},
     url: 'https://www.nationstates.net/cgi-bin/api.cgi?userAgent=node-nsapi%200.1.13%20(maintained%20by%20Auralia%2C%20currently%20used%20by%20%22Red%20Dusk%22)&q=lastlogin&nation=dusk_falls%2011&v=9',
     statusCode: 429,
     statusMessage: '' },
  responseText: '\n
Too Many Requests From Your IP Address
\n
Your IP address [removed] has sent more than 50 requests in 30 seconds. Access to the API has been blocked for the next 16 minutes. Please do not send bursts of traffic!

Requests should be spaced out to avoid hitting the rate limit and compromising server performance. Please ask for assistance in the Technical forum if you are unsure how to do this.\n

Error: 429 Too Many Requests\n

The NationStates API Documentation\n' }


[APPLICATION] nslogin-web

PostPosted: Thu Apr 27, 2017 3:06 am
by Parhe
Red Dusk wrote:Performed a test after manually killing all tasks that were accessing the internet, and still get the error.

Code: Select all
error: { [Error: Request failed: API returned HTTP response code 429]
  responseMetadata:
   { _readableState:
      { objectMode: false,
        highWaterMark: 16384,
        buffer: [Object],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: true,
        ended: true,
        endEmitted: true,
        reading: false,
        sync: false,
        needReadable: false,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: false,
     _events: { end: [Object], error: [Function], data: [Function] },
     _maxListeners: undefined,
     _mode: 'fetch',
     headers: { 'content-type': 'text/html; charset=utf-8' },
     rawHeaders: [ 'content-type', 'text/html; charset=utf-8' ],
     trailers: {},
     rawTrailers: [],
     _fetchResponse: {},
     url: 'https://www.nationstates.net/cgi-bin/api.cgi?userAgent=node-nsapi%200.1.13%20(maintained%20by%20Auralia%2C%20currently%20used%20by%20%22Red%20Dusk%22)&q=lastlogin&nation=dusk_falls%2011&v=9',
     statusCode: 429,
     statusMessage: '' },
  responseText: '\n
Too Many Requests From Your IP Address
\n
Your IP address [removed] has sent more than 50 requests in 30 seconds. Access to the API has been blocked for the next 16 minutes. Please do not send bursts of traffic!

Requests should be spaced out to avoid hitting the rate limit and compromising server performance. Please ask for assistance in the Technical forum if you are unsure how to do this.\n

Error: 429 Too Many Requests\n

The NationStates API Documentation\n' }


Will test from phone* in 20 minutes and edit in the error log if I get one there, but shouldn't affect it. (As in, on phone data. I'm waiting 20 minutes just so that I can't run into problems with NS admins for trying to circumnavigate a temp-ban on my IP)

Same result:
Code: Select all
error: { [Error: Request failed: API returned HTTP response code 429]
  responseMetadata:
   { _readableState:
      { objectMode: false,
        highWaterMark: 16384,
        buffer: [Object],
        length: 0,
        pipes: null,
        pipesCount: 0,
        flowing: true,
        ended: true,
        endEmitted: true,
        reading: false,
        sync: false,
        needReadable: false,
        emittedReadable: false,
        readableListening: false,
        resumeScheduled: false,
        defaultEncoding: 'utf8',
        ranOut: false,
        awaitDrain: 0,
        readingMore: false,
        decoder: null,
        encoding: null },
     readable: false,
     _events: { end: [Object], error: [Function], data: [Function] },
     _maxListeners: undefined,
     _mode: 'fetch',
     headers: { 'content-type': 'text/html; charset=utf-8' },
     rawHeaders: [ 'content-type', 'text/html; charset=utf-8' ],
     trailers: {},
     rawTrailers: [],
     _fetchResponse: {},
     url: 'https://www.nationstates.net/cgi-bin/api.cgi?userAgent=node-nsapi%200.1.13%20(maintained%20by%20Auralia%2C%20currently%20used%20by%20%22Red%20Dusk%22)&q=lastlogin&nation=dusk_falls%2011&v=9',
     statusCode: 429,
     statusMessage: '' },
  responseText: '\n
Too Many Requests From Your IP Address
\n
Your IP address [removed] has sent more than 50 requests in 30 seconds. Access to the API has been blocked for the next 16 minutes. Please do not send bursts of traffic!

Requests should be spaced out to avoid hitting the rate limit and compromising server performance. Please ask for assistance in the Technical forum if you are unsure how to do this.\n

Error: 429 Too Many Requests\n

The NationStates API Documentation\n' }


I seem to have received the same error tonight. The first ~850 nations logged in perfectly fine but then the app stopped without giving a reason, so I reloaded the page and started over from where it last stopped. Only worked for a little bit before giving me the above message.

PostPosted: Thu May 25, 2017 7:47 am
by Auralia
I've managed to reproduce this issue at least once, so I'll investigate.

PostPosted: Sun Jun 11, 2017 2:35 pm
by Auralia
Figured it out! Some browsers send a preflight CORS request before sending the actual request -- this turns what the API thinks is a single request into two requests for the purposes of the rate limit.

I'm going to up the delay to 1200 ms and let people configure the rate limit manually as a temporary workaround. Long term either my library will have to deal with this or [violet] will have to exempt OPTIONS requests from the rate limit.

PostPosted: Tue Jun 13, 2017 1:12 am
by Red Dusk
Great to hear. Thanks for fixing it!

PostPosted: Fri Mar 30, 2018 2:41 pm
by Nakari
*hopes it isn't gravedigging to bring up an issue*

Recently while trying to restore nations using this, I've been getting an error that the nation doesn't exist. As verbose mode puts it so eloquently:

info: metropolitan_3: Nation exists
info: metropolitan_3: Nation does not exist
info: metropolitan_3: Waiting for confirmation...
info: metropolitan_3: Confirmation received, restoring...
error: metropolitan_3: Restore failed
error: { [Error: Request failed: API returned HTTP response code 404]
responseMetadata:
{ _readableState:
{ objectMode: false,
highWaterMark: 16384,
buffer: [Object],
length: 0,
pipes: null,
pipesCount: 0,
flowing: true,
ended: true,
endEmitted: true,
reading: false,
sync: true,
needReadable: false,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
destroyed: false,
defaultEncoding: 'utf8',
awaitDrain: 0,
readingMore: false,
decoder: null,
encoding: null },
readable: false,
_events: { end: [Object], error: [Function], data: [Function] },
_maxListeners: undefined,
_mode: 'fetch',
headers: { 'content-type': 'text/html; charset=utf-8' },
rawHeaders: [ 'content-type', 'text/html; charset=utf-8' ],
trailers: {},
rawTrailers: [],
_fetchResponse: {},
url: 'https://www.nationstates.net/cgi-bin/api.cgi?userAgent=node-nsapi%200.1.14%20(maintained%20by%20Auralia%2C%20currently%20used%20by%20%22nakari%22)&q=name&nation=metropolitan_3&v=9',
statusCode: 404,
statusMessage: '' },
responseText: '\n
Unknown nation: "metropolitan_3".
\n
Error: 404 Not Found\n

The NationStates API Documentation\n' }


Metropolitan 3 definitely exists and can be refounded, but the autologin doesn't seem to recognise that it ever existed. I've been getting this for every nation I try to restore. Posting this partially to ask if there's a possible fix, partially in case I'm just running it wrong - either way, it's a good app otherwise and thanks for the work on it :P

PostPosted: Tue Apr 03, 2018 7:50 am
by Auralia
I can't reproduce this, unfortunately -- I can successfully restore nations.

PostPosted: Fri May 18, 2018 8:45 am
by Cuba and Jamaica
I start it, and mothing happen.( On the phone. Don't have tested on pc)

PostPosted: Thu Sep 13, 2018 1:52 pm
by Jadis and Marthburg
I recently used nstg-web, and every time i shut my computer the process stopped. I wish to know, the process of logging in stop when i shut my computer?

PostPosted: Thu Sep 13, 2018 2:49 pm
by All Wild Things
I had a similar problem with a light bulb. Every time I put the switch in the off position, the bulb stopped producing light. I wanted to get in touch with the manufacturer to see if this was expected behaviour for the light bulb, but unfortunately I couldn't find their contact details.

PostPosted: Thu Sep 13, 2018 2:58 pm
by Jadis and Marthburg
All Wild Things wrote:I had a similar problem with a light bulb. Every time I put the switch in the off position, the bulb stopped producing light. I wanted to get in touch with the manufacturer to see if this was expected behaviour for the light bulb, but unfortunately I couldn't find their contact details.

I meant lowering the screen of the pc, so it blocks the screen.

PostPosted: Thu Sep 13, 2018 7:21 pm
by Frisbeeteria
Jadis and Marthburg wrote:I meant lowering the screen of the pc, so it blocks the screen.

Closing the lid on a laptop puts it into either Sleep or Hibernation mode. It doesn't process anything in those modes.