NATION

PASSWORD

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

Bug reports, general help, ideas for improvements, and questions about how things are meant to work.
User avatar
Auralia
Senator
 
Posts: 4982
Founded: Dec 15, 2011
Ex-Nation

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

Postby Auralia » Wed Jan 25, 2017 10:32 pm

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.
Last edited by Auralia on Sat Dec 23, 2017 9:09 am, edited 2 times in total.
Catholic Commonwealth of Auralia
"Amor sequitur cognitionem."

User avatar
Orioni 2
Envoy
 
Posts: 289
Founded: May 05, 2004
Scandinavian Liberal Paradise

Postby Orioni 2 » Sat Jan 28, 2017 7:02 am

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:
Last edited by Orioni 2 on Sat Jan 28, 2017 7:02 am, edited 1 time in total.
Last edited by Orioni 2 on Tue Jan 19, 2038 03:14 am, edited 1.618 times in total.


The Beautiful Empire of OrioniEurth RP
Seek nothing and you will find everything

User avatar
Auralia
Senator
 
Posts: 4982
Founded: Dec 15, 2011
Ex-Nation

Postby Auralia » Sat Jan 28, 2017 7:58 am

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.
Catholic Commonwealth of Auralia
"Amor sequitur cognitionem."

User avatar
Orioni 2
Envoy
 
Posts: 289
Founded: May 05, 2004
Scandinavian Liberal Paradise

Postby Orioni 2 » Sun Jan 29, 2017 2:12 am

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.
Last edited by Orioni 2 on Tue Jan 19, 2038 03:14 am, edited 1.618 times in total.


The Beautiful Empire of OrioniEurth RP
Seek nothing and you will find everything

User avatar
CoraSpia
Postmaster-General
 
Posts: 13458
Founded: Mar 01, 2014
Ex-Nation

Postby CoraSpia » Sun Jan 29, 2017 2:45 am

Just clicked start and it seems to be doing nothing? Is it live?

Edit: it just doesn't work on IE
Last edited by CoraSpia on Sun Jan 29, 2017 4:21 am, edited 1 time in total.
GVH has a puppet. It supports #NSTransparency and hosts a weekly zoom call for nsers that you should totally check out

User avatar
Auralia
Senator
 
Posts: 4982
Founded: Dec 15, 2011
Ex-Nation

Postby Auralia » Sun Jan 29, 2017 12:43 pm

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.
Catholic Commonwealth of Auralia
"Amor sequitur cognitionem."

User avatar
Rejak
Political Columnist
 
Posts: 5
Founded: Jan 14, 2008
Ex-Nation

Postby Rejak » Tue Jan 31, 2017 12:21 am

It also seems to work on Edge.

User avatar
Parhe
Powerbroker
 
Posts: 8305
Founded: May 10, 2011
Anarchy

[APPLICATION] nslogin-web

Postby Parhe » Wed Feb 01, 2017 8:30 am

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! :)
Last edited by Parhe on Wed Feb 01, 2017 9:34 am, edited 2 times in total.
Hey, it is Parhe :D I am always open to telegrams.
I know it is a Work-In-Progress, but I would love it if y'all looked at my new factbook and gave me some feedback!

BRING BACK THE ICE CLIMBERS

User avatar
Flanderlion
Minister
 
Posts: 2226
Founded: Nov 25, 2013
Psychotic Dictatorship

Postby Flanderlion » Wed Feb 01, 2017 6:44 pm

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.
As always, I'm representing myself.
Information
Wishlist

User avatar
Parhe
Powerbroker
 
Posts: 8305
Founded: May 10, 2011
Anarchy

[APPLICATION] nslogin-web

Postby Parhe » Wed Feb 01, 2017 7:37 pm

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.
Last edited by Parhe on Wed Feb 01, 2017 7:37 pm, edited 1 time in total.
Hey, it is Parhe :D I am always open to telegrams.
I know it is a Work-In-Progress, but I would love it if y'all looked at my new factbook and gave me some feedback!

BRING BACK THE ICE CLIMBERS

User avatar
Red Dusk
Envoy
 
Posts: 262
Founded: Jun 13, 2013
Corrupt Dictatorship

Postby Red Dusk » Thu Apr 06, 2017 2:38 pm

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/
Last edited by Red Dusk on Thu Apr 06, 2017 2:39 pm, edited 1 time in total.

User avatar
Auralia
Senator
 
Posts: 4982
Founded: Dec 15, 2011
Ex-Nation

Postby Auralia » Sat Apr 22, 2017 3:32 pm

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.
Catholic Commonwealth of Auralia
"Amor sequitur cognitionem."

User avatar
Red Dusk
Envoy
 
Posts: 262
Founded: Jun 13, 2013
Corrupt Dictatorship

Postby Red Dusk » Sat Apr 22, 2017 5:37 pm

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.
Last edited by Red Dusk on Sat Apr 22, 2017 5:37 pm, edited 1 time in total.

User avatar
Red Dusk
Envoy
 
Posts: 262
Founded: Jun 13, 2013
Corrupt Dictatorship

Postby Red Dusk » Tue Apr 25, 2017 4:56 pm

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' }

Last edited by Red Dusk on Tue Apr 25, 2017 6:08 pm, edited 1 time in total.

User avatar
Parhe
Powerbroker
 
Posts: 8305
Founded: May 10, 2011
Anarchy

[APPLICATION] nslogin-web

Postby Parhe » Thu Apr 27, 2017 3:06 am

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.
Hey, it is Parhe :D I am always open to telegrams.
I know it is a Work-In-Progress, but I would love it if y'all looked at my new factbook and gave me some feedback!

BRING BACK THE ICE CLIMBERS

User avatar
Auralia
Senator
 
Posts: 4982
Founded: Dec 15, 2011
Ex-Nation

Postby Auralia » Thu May 25, 2017 7:47 am

I've managed to reproduce this issue at least once, so I'll investigate.
Catholic Commonwealth of Auralia
"Amor sequitur cognitionem."

User avatar
Auralia
Senator
 
Posts: 4982
Founded: Dec 15, 2011
Ex-Nation

Postby Auralia » Sun Jun 11, 2017 2:35 pm

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.
Catholic Commonwealth of Auralia
"Amor sequitur cognitionem."

User avatar
Red Dusk
Envoy
 
Posts: 262
Founded: Jun 13, 2013
Corrupt Dictatorship

Postby Red Dusk » Tue Jun 13, 2017 1:12 am

Great to hear. Thanks for fixing it!

User avatar
Nakari
Spokesperson
 
Posts: 123
Founded: Feb 16, 2017
Democratic Socialists

Postby Nakari » Fri Mar 30, 2018 2:41 pm

*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
Your role is Chamberlain of the Grey Wardens. Your job is to break hearts and make bad puns.

You have the position of Legislator in the South Pacific. You have 2 bullets.

You are spending the night as a Citizen of the Rejected Realms. Have a good time!

User avatar
Auralia
Senator
 
Posts: 4982
Founded: Dec 15, 2011
Ex-Nation

Postby Auralia » Tue Apr 03, 2018 7:50 am

I can't reproduce this, unfortunately -- I can successfully restore nations.
Catholic Commonwealth of Auralia
"Amor sequitur cognitionem."

User avatar
Cuba and Jamaica
Civil Servant
 
Posts: 6
Founded: May 10, 2018
Ex-Nation

Postby Cuba and Jamaica » Fri May 18, 2018 8:45 am

I start it, and mothing happen.( On the phone. Don't have tested on pc)

User avatar
Jadis and Marthburg
Bureaucrat
 
Posts: 50
Founded: Aug 03, 2018
Ex-Nation

Postby Jadis and Marthburg » Thu Sep 13, 2018 1:52 pm

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?

User avatar
All Wild Things
Diplomat
 
Posts: 526
Founded: Apr 24, 2017
Inoffensive Centrist Democracy

Postby All Wild Things » Thu Sep 13, 2018 2:49 pm

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.
Browse The NewsStand
Watch the Wild Life

User avatar
Jadis and Marthburg
Bureaucrat
 
Posts: 50
Founded: Aug 03, 2018
Ex-Nation

Postby Jadis and Marthburg » Thu Sep 13, 2018 2:58 pm

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.

User avatar
Frisbeeteria
Senior Game Moderator
 
Posts: 27796
Founded: Dec 16, 2003
Capitalizt

Postby Frisbeeteria » Thu Sep 13, 2018 7:21 pm

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.

Next

Advertisement

Remove ads

Return to Technical

Who is online

Users browsing this forum: Coding and socialism, Comrade Itsuka Kotori, Elegarth, Escapania, Lycanria, Tepertopia, Vimar

Advertisement

Remove ads