From 8d84611cf3222d6c9e7c70c189d986f094c952d8 Mon Sep 17 00:00:00 2001 From: Loïc Collignon Date: Fri, 15 Dec 2017 09:59:30 +0100 Subject: removed unrelated files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ie034281d2933cb7de0cf8cf6a2175376847acd9c Signed-off-by: Loïc Collignon --- ll-auth-binding/htdocs/AFB-websock.js | 174 ----------------------------- ll-auth-binding/htdocs/CMakeLists.txt | 43 ------- ll-auth-binding/htdocs/IdentityBinding.js | 88 --------------- ll-auth-binding/htdocs/IdentityBinding2.js | 96 ---------------- ll-auth-binding/htdocs/auth.html | 38 ------- ll-auth-binding/htdocs/auth2.html | 27 ----- ll-auth-binding/htdocs/index.html | 12 -- 7 files changed, 478 deletions(-) delete mode 100644 ll-auth-binding/htdocs/AFB-websock.js delete mode 100644 ll-auth-binding/htdocs/CMakeLists.txt delete mode 100644 ll-auth-binding/htdocs/IdentityBinding.js delete mode 100644 ll-auth-binding/htdocs/IdentityBinding2.js delete mode 100644 ll-auth-binding/htdocs/auth.html delete mode 100644 ll-auth-binding/htdocs/auth2.html delete mode 100644 ll-auth-binding/htdocs/index.html (limited to 'll-auth-binding/htdocs') diff --git a/ll-auth-binding/htdocs/AFB-websock.js b/ll-auth-binding/htdocs/AFB-websock.js deleted file mode 100644 index 08a7ffe..0000000 --- a/ll-auth-binding/htdocs/AFB-websock.js +++ /dev/null @@ -1,174 +0,0 @@ -AFB = function(base, initialtoken){ - -var urlws = "ws://"+window.location.host+"/"+base; -var urlhttp = "http://"+window.location.host+"/"+base; - -/*********************************************/ -/**** ****/ -/**** AFB_context ****/ -/**** ****/ -/*********************************************/ -var AFB_context; -{ - var UUID = undefined; - var TOKEN = initialtoken; - - var context = function(token, uuid) { - this.token = token; - this.uuid = uuid; - } - - context.prototype = { - get token() {return TOKEN;}, - set token(tok) {if(tok) TOKEN=tok;}, - get uuid() {return UUID;}, - set uuid(id) {if(id) UUID=id;} - }; - - AFB_context = new context(); -} -/*********************************************/ -/**** ****/ -/**** AFB_websocket ****/ -/**** ****/ -/*********************************************/ -var AFB_websocket; -{ - var CALL = 2; - var RETOK = 3; - var RETERR = 4; - var EVENT = 5; - - var PROTO1 = "x-afb-ws-json1"; - - AFB_websocket = function(onopen, onabort) { - var u = urlws; - if (AFB_context.token) { - u = u + '?x-afb-token=' + AFB_context.token; - if (AFB_context.uuid) - u = u + '&x-afb-uuid=' + AFB_context.uuid; - } - this.ws = new WebSocket(u, [ PROTO1 ]); - this.pendings = {}; - this.awaitens = {}; - this.counter = 0; - this.ws.onopen = onopen.bind(this); - this.ws.onerror = onerror.bind(this); - this.ws.onclose = onclose.bind(this); - this.ws.onmessage = onmessage.bind(this); - this.onopen = onopen; - this.onabort = onabort; - this.onclose = onabort; - } - - function onerror(event) { - var f = this.onabort; - if (f) { - delete this.onopen; - delete this.onabort; - f && f(this); - } - this.onerror && this.onerror(this); - } - - function onopen(event) { - var f = this.onopen; - delete this.onopen; - delete this.onabort; - f && f(this); - } - - function onclose(event) { - for (var id in this.pendings) { - var ferr = this.pendings[id].onerror; - ferr && ferr(null, this); - } - this.pendings = {}; - this.onclose && this.onclose(); - } - - function fire(awaitens, name, data) { - var a = awaitens[name]; - if (a) - a.forEach(function(handler){handler(data);}); - var i = name.indexOf("/"); - if (i >= 0) { - a = awaitens[name.substring(0,i)]; - if (a) - a.forEach(function(handler){handler(data);}); - } - a = awaitens["*"]; - if (a) - a.forEach(function(handler){handler(data);}); - } - - function reply(pendings, id, ans, offset) { - if (id in pendings) { - var p = pendings[id]; - delete pendings[id]; - var f = p[offset]; - f(ans); - } - } - - function onmessage(event) { - var obj = JSON.parse(event.data); - var code = obj[0]; - var id = obj[1]; - var ans = obj[2]; - AFB_context.token = obj[3]; - switch (code) { - case RETOK: - reply(this.pendings, id, ans, 0); - break; - case RETERR: - reply(this.pendings, id, ans, 1); - break; - case EVENT: - default: - fire(this.awaitens, id, ans); - break; - } - } - - function close() { - this.ws.close(); - this.onabort(); - } - - function call(method, request) { - return new Promise((function(resolve, reject){ - var id, arr; - do { - id = String(this.counter = 4095 & (this.counter + 1)); - } while (id in this.pendings); - this.pendings[id] = [ resolve, reject ]; - arr = [CALL, id, method, request ]; - if (AFB_context.token) arr.push(AFB_context.token); - this.ws.send(JSON.stringify(arr)); - }).bind(this)); - } - - function onevent(name, handler) { - var id = name; - var list = this.awaitens[id] || (this.awaitens[id] = []); - list.push(handler); - } - - AFB_websocket.prototype = { - close: close, - call: call, - onevent: onevent - }; -} -/*********************************************/ -/**** ****/ -/**** ****/ -/**** ****/ -/*********************************************/ -return { - context: AFB_context, - ws: AFB_websocket -}; -}; - diff --git a/ll-auth-binding/htdocs/CMakeLists.txt b/ll-auth-binding/htdocs/CMakeLists.txt deleted file mode 100644 index 5bdb47f..0000000 --- a/ll-auth-binding/htdocs/CMakeLists.txt +++ /dev/null @@ -1,43 +0,0 @@ -########################################################################### -# Copyright 2015, 2016, 2017 IoT.bzh -# -# author: Fulup Ar Foll -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -########################################################################### - - - -################################################## -# HTML Testing Files -################################################## -PROJECT_TARGET_ADD(www_test) - - file(GLOB SOURCE_FILES "*.html" "*.js" "*.jpg") - - add_custom_target(${TARGET_NAME} - DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - ) - - add_custom_command( - DEPENDS ${SOURCE_FILES} - OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - COMMAND mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - COMMAND touch ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - COMMAND cp -r ${SOURCE_FILES} ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME} - ) - - SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES - LABELS "HTDOCS" - OUTPUT_NAME ${TARGET_NAME} - ) diff --git a/ll-auth-binding/htdocs/IdentityBinding.js b/ll-auth-binding/htdocs/IdentityBinding.js deleted file mode 100644 index 4d0d98f..0000000 --- a/ll-auth-binding/htdocs/IdentityBinding.js +++ /dev/null @@ -1,88 +0,0 @@ - var afb = new AFB("api", "mysecret"); - var ws; - var evtidx=0; - - function getParameterByName(name, url) { - if (!url) { - url = window.location.href; - } - name = name.replace(/[\[\]]/g, "\\$&"); - var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), - results = regex.exec(url); - if (!results) return null; - if (!results[2]) return ''; - return decodeURIComponent(results[2].replace(/\+/g, " ")); - } - - // default soundcard is "PCH" - var devid=getParameterByName("devid"); - if (!devid) devid="hw:0"; - - var sndname=getParameterByName("sndname"); - if (!sndname) sndname="PCH"; - - var quiet=getParameterByName("quiet"); - if (!quiet) quiet="99"; - - function init() { - ws = new afb.ws(onopen, onabort); - } - - function onopen() { - document.getElementById("main").style.visibility = "visible"; - document.getElementById("connected").innerHTML = "Binder WS Active"; - document.getElementById("connected").style.background = "lightgreen"; - ws.onevent("*", gotevent); - } - - function onabort() { - document.getElementById("main").style.visibility = "hidden"; - document.getElementById("connected").innerHTML = "Connected Closed"; - document.getElementById("connected").style.background = "red"; - - } - - function replyok(obj) { - console.log("replyok:" + JSON.stringify(obj)); - document.getElementById("output").innerHTML = "OK: "+JSON.stringify(obj); - } - - function replyerr(obj) { - console.log("replyerr:" + JSON.stringify(obj)); - document.getElementById("output").innerHTML = "ERROR: "+JSON.stringify(obj); - } - - function gotevent(obj) { - console.log("gotevent:" + JSON.stringify(obj)); - document.getElementById("outevt").innerHTML = (evtidx++) +": "+JSON.stringify(obj); - - document.getElementById("message").innerHTML = ""; - - if (obj.event == "ll-auth/login") { - document.getElementById("userid").innerHTML = obj.data.user; - document.getElementById("device").innerHTML = obj.data.device; - } - - if (obj.event == "ll-auth/logout") { - document.getElementById("userid").innerHTML = ""; - document.getElementById("device").innerHTML = ""; - } - - if (obj.event == "ll-auth/failed") { - document.getElementById("message").innerHTML = obj.data.message; - } - } - - function send(message) { - var api = document.getElementById("api").value; - var verb = document.getElementById("verb").value; - document.getElementById("question").innerHTML = "subscribe: "+api+"/"+verb + " (" + JSON.stringify(message) +")"; - ws.call(api+"/"+verb, {data:message}).then(replyok, replyerr); - } - - - function callbinder(api, verb, query) { - console.log ("subscribe api="+api+" verb="+verb+" query=" +query); - document.getElementById("question").innerHTML = "apicall: " + api+"/"+verb +" ("+ JSON.stringify(query)+")"; - ws.call(api+"/"+verb, query).then(replyok, replyerr); - } diff --git a/ll-auth-binding/htdocs/IdentityBinding2.js b/ll-auth-binding/htdocs/IdentityBinding2.js deleted file mode 100644 index 695b872..0000000 --- a/ll-auth-binding/htdocs/IdentityBinding2.js +++ /dev/null @@ -1,96 +0,0 @@ - var afb = new AFB("api", "mysecret"); - var ws; - var evtidx=0; - - function getParameterByName(name, url) { - if (!url) { - url = window.location.href; - } - name = name.replace(/[\[\]]/g, "\\$&"); - var regex = new RegExp("[?&]" + name + "(=([^&#]*)|&|#|$)"), - results = regex.exec(url); - if (!results) return null; - if (!results[2]) return ''; - return decodeURIComponent(results[2].replace(/\+/g, " ")); - } - - // default soundcard is "PCH" - var devid=getParameterByName("devid"); - if (!devid) devid="hw:0"; - - var sndname=getParameterByName("sndname"); - if (!sndname) sndname="PCH"; - - var quiet=getParameterByName("quiet"); - if (!quiet) quiet="99"; - - function init() { - ws = new afb.ws(onopen, onabort); - } - - function onopen() { - document.getElementById("background").style.background = "lightgray"; - document.getElementById("main").style.visibility = "visible"; - callbinder("ll-auth", "getuser", ""); - ws.onevent("*", gotevent); - } - - function onabort() { - document.getElementById("background").style.background = "IndianRed"; - } - - function replyok(obj) { - console.log("replyok:" + JSON.stringify(obj)); - document.getElementById("output").innerHTML = "OK: "+JSON.stringify(obj); - - document.getElementById("usertitle").innerHTML = "A valid user is logged in"; - document.getElementById("userid").innerHTML = obj.response.user; - document.getElementById("userdevice").innerHTML = obj.response.device; - document.getElementById("background").style.background = "lightgreen"; - } - - function replyerr(obj) { - console.log("replyerr:" + JSON.stringify(obj)); - document.getElementById("output").innerHTML = "ERROR: "+JSON.stringify(obj); - } - - function gotevent(obj) { - console.log("gotevent:" + JSON.stringify(obj)); - document.getElementById("outevt").innerHTML = (evtidx++) +": "+JSON.stringify(obj); - - document.getElementById("question").innerHTML = ""; - document.getElementById("output").innerHTML = ""; - document.getElementById("message").innerHTML = ""; - - if (obj.event == "ll-auth/login") { - document.getElementById("usertitle").innerHTML = "A valid user is logged in"; - document.getElementById("userid").innerHTML = obj.data.user; - document.getElementById("userdevice").innerHTML = obj.data.device; - document.getElementById("background").style.background = "lightgreen"; - } - - if (obj.event == "ll-auth/logout") { - document.getElementById("usertitle").innerHTML = "No user"; - document.getElementById("userid").innerHTML = ""; - document.getElementById("userdevice").innerHTML = ""; - document.getElementById("background").style.background = "lightgray"; - } - - if (obj.event == "ll-auth/failed") { - document.getElementById("message").innerHTML = obj.data.message; - } - } - - function send(message) { - var api = document.getElementById("api").value; - var verb = document.getElementById("verb").value; - document.getElementById("question").innerHTML = "subscribe: "+api+"/"+verb + " (" + JSON.stringify(message) +")"; - ws.call(api+"/"+verb, {data:message}).then(replyok, replyerr); - } - - - function callbinder(api, verb, query) { - console.log ("subscribe api="+api+" verb="+verb+" query=" +query); - document.getElementById("question").innerHTML = "apicall: " + api+"/"+verb +" ("+ JSON.stringify(query)+")"; - ws.call(api+"/"+verb, query).then(replyok, replyerr); - } diff --git a/ll-auth-binding/htdocs/auth.html b/ll-auth-binding/htdocs/auth.html deleted file mode 100644 index ac48ff9..0000000 --- a/ll-auth-binding/htdocs/auth.html +++ /dev/null @@ -1,38 +0,0 @@ - - - ll-auth-binding test - - - - - -

Identity Binding

- -
-
    - -
  1. -
-
-
-
-

User:

-
    -
  1. id:
  2. -
  3. device:
  4. -
-
-
- - - diff --git a/ll-auth-binding/htdocs/auth2.html b/ll-auth-binding/htdocs/auth2.html deleted file mode 100644 index 356be1c..0000000 --- a/ll-auth-binding/htdocs/auth2.html +++ /dev/null @@ -1,27 +0,0 @@ - - - ll-auth-binding test - - - - - - -
-

No user

-
    -
  • User Id :
  • -
  • Device :
  • -
-
-
- - - diff --git a/ll-auth-binding/htdocs/index.html b/ll-auth-binding/htdocs/index.html deleted file mode 100644 index 1c90ae5..0000000 --- a/ll-auth-binding/htdocs/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - Identity Binding tests - - -

Identity Binding tests

-
    -
  1. Auth
  2. -
  3. Auth2
  4. -
- - -- cgit 1.2.3-korg