removed useless _ folders

This commit is contained in:
Fred Beckhusen
2015-08-09 16:54:31 -05:00
parent fde850293c
commit 948a44dfba
5204 changed files with 2425579 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
<Project name="Open Product Updater" guid="a313ad5e-a3b5-426f-81b5-6ab922f85987">
<Object name="Update Server" guid="da8d75c1-282d-4e04-b51a-561219a8cc82" active="true" description="9304f04d-8167-4edd-a1c2-9b1178e34b2c">
<Script name="Product Updater Client.lsl" guid="faefa55d-29e5-4d17-a559-6702cc9bab17">
</Script>
<Script name="Product Updater Server .lsl" guid="db0f211c-f2ac-448a-bf60-53b0636891a7">
</Script>
</Object>
</Project>

View File

@@ -0,0 +1,144 @@
// :CATEGORY:Updater
// :NAME:Open Updater
// :AUTHOR:Ferd Frederix
// :KEYWORDS:
// :CREATED:2013-09-06
// :EDITED:2014-02-24
// :ID:586
// :NUM:802
// :REV:1.1
// :WORLD:Second Life, OpenSim
// :DESCRIPTION:
// Grid-wide Updater for products. This is the Client
// :CODE:
// Script by Ferd Frederix
// fred@mitsi.com
// License: CC-BY-NC
// This means you must leave the headers in this script intact, and it is not to be sold by itself, not even for a Linden
// You are allowed to use and sell Products that use this script.
//
// Open Update Client
// Updater that goes into any product.
// Rev 1.0 5/24/2013 Initial release
// Rev 1.1 2/21/2014 changed UUID to a valid one as people do not know how to read instructions.
// Put this script into any prim and give the prim to someone.
// When that product is rezzed, it will check for updates from a Server prim
// You must make the name of the Prim "Name-VN", where N is a version number such as 1, 1.0, 2 and so on.
// The Name must not have a | in it.
// The product MUST have a name followed by -V and a version number
//
// Examples: Horsie-V1.0 ( Same as V1)
// Horsie-V1 ( Same as V1.0)
// Horsie-V1.1 ( if inside the updater, this will be sent if the version of Horsie is less than 1.1 )
// Horsie-V4.1.1 ( This is an illegal number as it has 2 decimals, and will not update as you expect)
// Horsie|From Me-V4.1 ( This is an illegal name as it has a "|" in it)
//////////////////////////////////////////////////////////
// IMPORTANT CONFIGURATION //
//////////////////////////////////////////////////////////
// You MUST put in a UUID from this web site here and put the same UUID in the updater script
// Get a UUID from Latif Khalifa at:
//
// http://gridurl.appspot.com/random
//
// You only need to do this once for the server that has the same key. That server has to have a copy of the object in it.
// You can run more than one server, just make sure that the product goes into the correct server and that the key inside this script in that product matches the key inside the server
string UUID = "92e723e8-3653-451c-816d-23f920cd02c8"; // You MUST change this
integer CHATTY = TRUE; // When TRUE, tells the prim owner it is checking for updates. If FALSE, this script is silent.
//////////////////////////////////////////////////////////
// CODE BEGINS, Move on, nothing here to change //
//////////////////////////////////////////////////////////
// Just for Debugging
integer debug = FALSE; // Show what is happenning in chat if TRUE
DEBUG(string msg)
{
if (debug)
llOwnerSay(llGetScriptName() + " : " + msg);
}
// globals
key http_request_id; // this key of for the update request
key URL_request_id; // this key is for the HTTP-In
string serverURL; // This will become out HTTP-I URL
key Request(string cmd)
{
DEBUG("Sending:"+serverURL+"?"+cmd);
return llHTTPRequest( serverURL+"?"+cmd, [HTTP_METHOD, "GET"], "");
}
CheckForUpdate()
{
// Check for an update from the server prim
string AvatarName = llKey2Name(llGetOwner());
string AvatarNameESC = llEscapeURL(AvatarName);
string ProductName = llEscapeURL(llGetObjectName());
//Product Name|UUID|Avatar Name is the message
string query = "?q=" + ProductName + "|"+ (string) llGetOwner() +"|" + AvatarName;
DEBUG("URL:" + serverURL);
http_request_id = llHTTPRequest(serverURL + query,[HTTP_METHOD,"POST"],"");
}
default
{
on_rez(integer param)
{
llResetScript();
}
state_entry()
{
if (CHATTY)
llOwnerSay( "Checking for updates");
string keyURL = "http://gridurl.appspot.com/get/"+ llEscapeURL(UUID);
DEBUG(keyURL);
URL_request_id = llHTTPRequest(keyURL, [HTTP_METHOD, "GET"], ""); // find the server
}
http_response(key request_id, integer status, list metadata, string body)
{
if (URL_request_id == request_id)
{
URL_request_id = NULL_KEY; // the same event sometimes shows up more then once
if(status == 200)
{
DEBUG("Server URL is :" + body);
serverURL = body;
CheckForUpdate(); // let's see if there is an update by connecting to the URL we just got
}
}
else if (http_request_id == request_id)
{
if(status == 200)
{
DEBUG("Success response:" + body); // report what was returned from update request
}
else
{
DEBUG("Fail response:" + body); // report what was returned from update request
}
}
}
}

View File

@@ -0,0 +1,258 @@
// :CATEGORY:Update
// :NAME:Open Updater
// :AUTHOR:Ferd Frederix
// :KEYWORDS:
// :CREATED:2013-09-06
// :EDITED:2014-02-24
// :ID:586
// :NUM:803
// :REV:1.1
// :WORLD:Second Life, OpenSim
// :DESCRIPTION:
// Grid-wide Updater for products. This is the Server
// :CODE:
// Script by Ferd Frederix
// fred@mitsi.com
// License: CC-BY-NC
// This means you must leave the headers in this script intact, and it is not to be sold by itself, not even for a Linden
// You are allowed to use and sell Products that use this script.
//
// Open Update server
// Rev 1.0 5/24/2013
// Rev 1.1 1/21/2014 missing llUrlUnesacape - Thxxx Linn!
// Put Products in a box inside the prim that has this script. Put the Product Updater scipt in products that get rezzed, and not the box that holds them.
// You must make the name of the box that you put in this server "Name-VN", where N is a version number such as 1, 1.0, 2 and so on.
// The Name must not have a | in it.
// The box MUST have a name followed by -V and a version number
//
// Examples: Horsie-V1.0 ( Same as V1 )
// Horsie-V1 ( Same as V1.0, V1.000 etc. )
// Horsie-V1.1 ( his will be sent if the product is named Horsie-V0.99999 or lower )
// Horsie-V4.1.1 ( This is an illegal number as it has 2 decimals, and will not update as you expect)
// Horsie|From Me-V4.1 ( This is an illegal name as it has a "|" in it)
//////////////////////////////////////////////////////////
// IMPORTANT CONFIGURATION //
//////////////////////////////////////////////////////////
// You MUST put in a UUID from this web site here and put the same UUID in the updater script in your products
// Get one from Latif Khalifa at
// http://gridurl.appspot.com/random
//
string UUID = "92e723e8-3653-451c-816d-23f920cd02c8"; // You MUST change this here and in the products upadter script that you put in your products.
// Debugging and setup things that can be changed
integer debug = FALSE; // Show what is happening in chat
integer ENABLED = TRUE; // If TRUE, issue updates to clients, if FALSE, do everything but actually give inventory
float HoverText = 1.0; // Set to 0.0 to turn hovertext status updates off
//////////////////////////////////////////////////////////
// CODE BEGINS, Move on, nothing here to change //
//////////////////////////////////////////////////////////
// global vars
integer nServed; // how many updates sent, starts at zero
// HTTP-IN and other web traffic stuff
key URLReq = NULL_KEY;
string url; // sop we can release HTTP-In keys
key urlRequestId; // the key of the request for a HTTP-In URL
key http_RequestID; // the key of th4e Post to outselves
integer CHECKTIMER = 600; // run a self-test every 5 minutes. if this fails, request a new URL
RequestHTTPInURL()
{
llSetTimerEvent(0); // Do not run diags unless we have a valid URL
llReleaseURL(url); // there is a limit to the number of URLS, so we always release them.
url = "";
urlRequestId = llRequestURL(); // get a HTTP-In URL
}
DEBUG(string msg)
{
if (debug)
llOwnerSay(llGetScriptName() + " : " + msg);
}
key Request(string URL)
{
llSetText("Registering",<0,0,1>,HoverText); // blue
string url = "http://gridurl.appspot.com/reg?service=" + UUID + "&url=" + llEscapeURL(URL) + "/";
return llHTTPRequest( url, [HTTP_METHOD, "GET"], "");
}
default
{
// When rezzed, lets start everything from scratch
on_rez(integer param)
{
llResetScript();
}
// when reset, we get a HTTP-IN URL. Without this, we can do nothing
state_entry()
{
llSetText("Initializing",<0,0,1>,HoverText); // blue
RequestHTTPInURL();
}
// This event will occur whenever a URL is granted or the web server it created gets a POST or GET
http_request(key id, string method, string body)
{
if (method == URL_REQUEST_GRANTED)
{
DEBUG(body);
url = body; // save body response, which is our actual URL, so we can release it.
llSetText("Update Server is Starting",<0,0,1>,HoverText);
URLReq = Request(body); // send it to the server so the gadgets in the field know where to go to get updates.
llSetTimerEvent(2); // check server just to be certain
}
else if (method == URL_REQUEST_DENIED)
{
llSetText("ERROR: URL request was denied, retrying in 1 minute",<1,0,0>,HoverText);
llSleep(60);
RequestHTTPInURL();
}
else if (id == URLReq)
{
if (body == "OK")
{
llSetText("Test passed ",<0,0,1>,HoverText);
llSleep(1);
}
else
{
llSetText("Unable to register, please check your UUID",<1,0,0>,HoverText);
}
}
else if(method == "GET")
{
DEBUG("GET ACK");
llHTTPResponse(id, 200, "ACK");
}
else if(method == "POST")
{
DEBUG("POST received");
string resp = llGetHTTPHeader(id, "x-query-string");
// Product Name|Ver|UUID|Avatar Name is the message
resp = llUnescapeURL(resp);
DEBUG("Query String = " + resp);
list info = llParseString2List(resp,["|"],[]);
DEBUG(llDumpList2String(info,"|"));
// get rid of the q= at the beginning of the name
string name= llList2String(info,0);
list names = llParseString2List(name,["="],[]);
string shortName = llList2String(names,1);
DEBUG("shortName:" + shortName);
names = llParseString2List(shortName,["-V"],["-V"]);
float VerWanted = (float) llList2String(names,1);
DEBUG("Version of product:" + (string) VerWanted);
string productName = llList2String(names,0);
DEBUG("productName:" + productName);
key Theirkey = (key) llList2String(info,1);
DEBUG("Owner key:" + (string) Theirkey);
string Avatar = llList2String(info,2);
// should look like this for a version 1 Object
// Object-1|1.0|10000000-0000-0000-0000-000000000000|SecondLife OwnerName
integer count = llGetInventoryNumber(INVENTORY_OBJECT);
while (count--)
{
string fullname = llGetInventoryName(INVENTORY_OBJECT,count); // obj 1 = 0
list parts = llParseString2List(fullname,["-V"],["-V"]);
string invName = llList2String(parts,0);
float invVersion = (float) llList2String(parts,1);
DEBUG("Inv Name :" + (string) invName);
DEBUG("Inv Version:" + (string) invVersion);
if (productName == invName && invVersion > VerWanted )
{
DEBUG("Giving:" + invName);
nServed++; // counter for products dispensed
if (ENABLED) llGiveInventory(Theirkey,fullname);
llSetText(Avatar + " got " + fullname + "\nTotal Items Updated:" + (string) nServed, <1,1,1>,1.0 );
}
}
llHTTPResponse(id, 200, "ACK");
}
else
{
llSetText("Unknown command received",<1,0,0>,HoverText);
llHTTPResponse(id, 501, "Not Implemented "+method);
}
}
// This even will run when a web page is fetched
http_response(key request_id, integer status, list metadata, string body)
{
// This would be the response from Grispot that out URL was accepted.
if(URLReq == request_id)
{
URLReq = NULL_KEY;
if(status == 200)
{
llSetText("Server is OK",<0,1,0>,HoverText);
}
else
{
llSetText("The internet is broken - retrying",<1,0,0>,HoverText);
llSleep(60); // be nice
RequestHTTPInURL(); // try again
}
}
// this occurs when we test ourselves. We should have gotten an ACK to keep us happy.
// if no ACK, we need a new URL
else if (request_id == http_RequestID)
{
if (body != "ACK")
{
llSetText("The internet is broken - retrying",<1,0,0>,HoverText);
llSleep(60); // be nice to ourserver, the server has probably run out of URLS.
RequestHTTPInURL();
}
else
{
llSetText("Server is ready",<0,1,0>,HoverText);
}
}
}
// run a self test every so often by GETing from ourselves
// This also resets the timer to CHECKTIMER, as the very first one of these happens at startup in a few seconds.
timer()
{
llSetText("Update Server is checking itself",<0,0,1>,HoverText);
http_RequestID = llHTTPRequest(url,[HTTP_METHOD,"GET"],"");
llSetTimerEvent(CHECKTIMER); // check server just to be certain
}
}

3
Open Updater/Updater.sol Normal file
View File

@@ -0,0 +1,3 @@
<Solution name="Updater">
<Project name="Open Product Updater" path="Open Product Updater\Open Product Updater.prj" active="true"/>
</Solution>