NATION

PASSWORD

Script Rules Revision

Bug reports, general help, ideas for improvements, and questions about how things are meant to work.
User avatar
Eluvatar
Director of Technology
 
Posts: 3086
Founded: Mar 31, 2006
New York Times Democracy

Script Rules Revision

Postby Eluvatar » Sun Mar 20, 2016 9:08 pm

Following a recent incident, Admin attention has been drawn to the Script Rules not requiring a User Agent for non-API requests, which is if anything more helpful with tracking non-API script usage than API script usage.

The below section has therefore been added to the Script Rules, bringing them into line with the API terms of use.

Euroslavia wrote:User Agent

You must set your script's UserAgent to something informative, such as the URL of your site. This allows us to contact you if something goes wrong with your script.
To Serve and Protect: UDL

Eluvatar - Taijitu member

User avatar
Caelapes
Ambassador
 
Posts: 1543
Founded: Apr 30, 2007
Ex-Nation

Postby Caelapes » Mon Mar 21, 2016 7:37 am

What about client-side scripts that change the look or functionality of a page through Javascript? Should useragents be set for these?
    
The Rose Commune of Caelapes
Ego vero custos fratris mei sum.
aka Misley

User avatar
Leppikania
Minister
 
Posts: 2332
Founded: Apr 13, 2015
Left-wing Utopia

Postby Leppikania » Mon Mar 21, 2016 7:38 am

Caelapes wrote:What about client-side scripts that change the look or functionality of a page through Javascript? Should useragents be set for these?

Those would already set user agents, because the script is bound to the web browser.
INTP, -4.25 Economic Left/Right, -4.1 Social Libertarian/Authoritarian, tastes like chicken.
I do use NS stats, thank you very much.
Funny Quotes
Pie charts for industries
Request an Embassy

User avatar
Eluvatar
Director of Technology
 
Posts: 3086
Founded: Mar 31, 2006
New York Times Democracy

Postby Eluvatar » Mon Mar 21, 2016 8:40 am

Caelapes wrote:What about client-side scripts that change the look or functionality of a page through Javascript? Should useragents be set for these?


If your script does not make http requests of nationstates.net, it does not need to set a User Agent.

If your script is completely unable to set a User Agent, it needs to identify itself in some other manner, like in the below example for googlescripts:
Eluvatar wrote:
Eluvatar wrote:I'm updating all the active gdocs I have edit privileges in to add the below to all API request URLs: :)
Code: Select all
"&gdoc="+SpreadsheetApp.getActiveSpreadsheet().getId()+"&useremail="+Session.getUser().getUserLoginId()


Because getUserLoginId() is being deprecated I would suggest changing the above code to something like:

Code: Select all
  var url = "http://www.nationstates.net/cgi-bin/api.cgi?param_name1=" + param_value1
    + ...
    + "&gdoc=" + SpreadsheetApp.getActiveSpreadsheet().getId() + "&useremail="
    + Session.getUser().getEmail();


For scripts triggered by anonymous user action, I would suggest either not having them, or substituting the sheet owner's email instead:

Code: Select all
  var url = "http://www.nationstates.net/cgi-bin/api.cgi?param_name1=" + param_value1
    + ...
    + "&gdoc=" + SpreadsheetApp.getActiveSpreadsheet().getId() + "&owneremail="
    + SpreadsheetApp.getActiveSpreadsheet().getOwner().getEmail();


Leppikania wrote:
Caelapes wrote:What about client-side scripts that change the look or functionality of a page through Javascript? Should useragents be set for these?

Those would already set user agents, because the script is bound to the web browser.

A generic user-agent is inadequate. The point of the rule is to require scripts to identify themselves.
Last edited by Eluvatar on Mon Mar 21, 2016 8:58 am, edited 1 time in total.
To Serve and Protect: UDL

Eluvatar - Taijitu member

User avatar
Caelapes
Ambassador
 
Posts: 1543
Founded: Apr 30, 2007
Ex-Nation

Postby Caelapes » Mon Mar 21, 2016 8:57 am

Eluvatar wrote:
Caelapes wrote:What about client-side scripts that change the look or functionality of a page through Javascript? Should useragents be set for these?


If your script does not make http requests of nationstates.net, it does not need to set a User Agent.

It does not make an HTTP request. It uses Javascript to, at the script-legal rate of one click per action, activates a button on the NationStates page (e.g. like an RMB post, unsuppress an RMB post, etc.). What is the preferred method to ensure these types of scripts are fully script-legal with this revision?
    
The Rose Commune of Caelapes
Ego vero custos fratris mei sum.
aka Misley

User avatar
Eluvatar
Director of Technology
 
Posts: 3086
Founded: Mar 31, 2006
New York Times Democracy

Postby Eluvatar » Mon Mar 21, 2016 7:53 pm

Caelapes wrote:
Eluvatar wrote:
If your script does not make http requests of nationstates.net, it does not need to set a User Agent.

It does not make an HTTP request. It uses Javascript to, at the script-legal rate of one click per action, activates a button on the NationStates page (e.g. like an RMB post, unsuppress an RMB post, etc.). What is the preferred method to ensure these types of scripts are fully script-legal with this revision?

Two things.

Firstly, the script you are describing (in somewhat more detail in other contexts) could easily run afoul of this rule:
Euroslavia wrote:A tool may never execute restricted actions simultaneously. It must wait for the completion of each command--a complete response from the NationStates server--before issuing the next one. A tool should never spawn background processes to enable multiple simultaneous server connections that each perform a restricted action.


Your button should not cause anything to happen until the previous thing has completed.

Secondly, in such a case you are not required to set a User Agent. It is, after all, impossible.

You should however add a field of this form to the parameters: script=An%20identifying%20string
While this may not be required in this particular edge case, it may soon be, and it's helpful to admin in general.

Since you can't legally just call click() on the other buttons you want to click as that doesn't prevent simultaneous requests (which are illegal for a tool to execute) this isn't much extra work regardless.
Last edited by Eluvatar on Mon Mar 21, 2016 7:55 pm, edited 1 time in total.
To Serve and Protect: UDL

Eluvatar - Taijitu member

User avatar
Tim-Opolis
Negotiator
 
Posts: 6197
Founded: Feb 17, 2010
Iron Fist Consumerists

Postby Tim-Opolis » Mon Mar 21, 2016 8:06 pm

Quick question, would our NS Nation be fine as a useragent or would you prefer an e-mail or some other way of contact. I've been just using Tim-Opolis as my useragent on Auralia's Auto-Login Interface, but can certainly change that to say " Tim-Opolis | "myemail" " if that is preferable for the administrative team.

Thanks!
Want to be a hero? Join The Grey Wardens - Help Us Save Nationstates
( ͡° ͜ʖ ͡°) Commended by Security Council Resolution #420 ( ͡° ͜ʖ ͡°)

Author of SC#74, SC #203, SC #222, and SC #238 | Co-Author of SC#191
Founder of Spiritus | Three-Time Delegate of Osiris | Pharaoh of the Islamic Republics of Iran | Hero of Greece
<Koth - 06/30/2020> I mean as far as GPers go, Tim is one of the most iconic

User avatar
Eluvatar
Director of Technology
 
Posts: 3086
Founded: Mar 31, 2006
New York Times Democracy

Postby Eluvatar » Mon Mar 21, 2016 9:39 pm

Tim-Opolis wrote:Quick question, would our NS Nation be fine as a useragent or would you prefer an e-mail or some other way of contact. I've been just using Tim-Opolis as my useragent on Auralia's Auto-Login Interface, but can certainly change that to say " Tim-Opolis | "myemail" " if that is preferable for the administrative team.

Thanks!


Yes, so long as your nation has an email you regularly check set and/or you check your nation's telegrams regularly.

Regarding the aforementioned simultaneity rule, I've composed a post seeking to help people comply with it.
To Serve and Protect: UDL

Eluvatar - Taijitu member

User avatar
Aptenia
Lobbyist
 
Posts: 23
Founded: Mar 16, 2014
Ex-Nation

Postby Aptenia » Sat Apr 02, 2016 2:52 pm

There should be a new notice in the News section that directs questions here


Advertisement

Remove ads

Return to Technical

Who is online

Users browsing this forum: Asgareth, Improper Classifications, Orifna, Plunia, Tepertopia

Advertisement

Remove ads