update: add 'hasCap(flag)' function to WTVClientSessionData for easier client-capabilities checking (see wtv-home/home.js for an example)
This commit is contained in:
@@ -29,12 +29,22 @@ function go() {
|
|||||||
<form name=access onsubmit="go()">
|
<form name=access onsubmit="go()">
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="client:relog">client:relog (direct)</a> ~ <a href="wtv-tricks:/blastcache?return_to=wtv-home:/home">Clear Cache</a></li>
|
<li><a href="client:relog">client:relog (direct)</a> ~ <a href="wtv-tricks:/blastcache?return_to=wtv-home:/home">Clear Cache</a></li>
|
||||||
<li><a href="client:diskhax">DiskHax</a> ~ <a href="client:vfathax">VFatHax</a></li>
|
|
||||||
<li><a href="wtv-flashrom:/willie" selected>Ultra Willies</a> ~ <a href="wtv-tricks:/info">Tricks Info</a></li>
|
<li><a href="wtv-flashrom:/willie" selected>Ultra Willies</a> ~ <a href="wtv-tricks:/info">Tricks Info</a></li>
|
||||||
<li><a href="wtv-music:/demo/index">MIDI Music Demo</a></li>
|
<li><a href="wtv-music:/demo/index">MIDI Music Demo</a></li>
|
||||||
<li>Old MSNTV DealerDemo: <a href="wtv-update:/DealerDemo">Download</a> ~ <a href="file://Disk/Demo/index.html">Access (after Download)</a></li>
|
`;
|
||||||
<li><a href="http://duckduckgo.com/lite/">DuckDuckGo Lite</a></li>`
|
if (ssid_sessions[socket.ssid].hasCap("client-has-disk")) {
|
||||||
if (ssid_sessions[socket.ssid].get('wtv-need-upgrade') != 'true') {
|
// only show disk stuff if client has disk
|
||||||
|
data += "<li><a href=\"client:diskhax\">DiskHax</a> ~ <a href=\"client:vfathax\">VFatHax</a></li>\n";
|
||||||
|
if (ssid_sessions[socket.ssid].hasCap("client-can-do-macromedia-flash2")) {
|
||||||
|
// only show demo if client can do flash2
|
||||||
|
data += "<li>Old MSNTV DealerDemo: <a href=\"wtv-update:/DealerDemo\">Download</a> ~ <a href=\"file://Disk/Demo/index.html\"> Access (after Download)</a></li>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data += `<li><a href="http://duckduckgo.com/lite/">DuckDuckGo Lite</a></li>`
|
||||||
|
|
||||||
|
if (ssid_sessions[socket.ssid].hasCap("client-can-do-javascript")) {
|
||||||
|
// URL access form requires javascript, hide if client does not support
|
||||||
data += `<li><input name=url `;
|
data += `<li><input name=url `;
|
||||||
|
|
||||||
if (request_headers.query.url) {
|
if (request_headers.query.url) {
|
||||||
@@ -43,7 +53,7 @@ if (ssid_sessions[socket.ssid].get('wtv-need-upgrade') != 'true') {
|
|||||||
|
|
||||||
data += `width=250 height=10 bgcolor=#444444 text=#ffdd33 cursor=#cc9933>
|
data += `width=250 height=10 bgcolor=#444444 text=#ffdd33 cursor=#cc9933>
|
||||||
<input type=submit value="Access URL">
|
<input type=submit value="Access URL">
|
||||||
</form>`
|
</form>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
data += "</li >\n</ul>";
|
data += "</li >\n</ul>";
|
||||||
|
|||||||
@@ -9,11 +9,19 @@ class WTVClientSessionData {
|
|||||||
\***********************************/
|
\***********************************/
|
||||||
|
|
||||||
data_store = null;
|
data_store = null;
|
||||||
|
capabilities = null;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.data_store = new Array();
|
this.data_store = new Array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
hasCap(cap) {
|
||||||
|
if (this.capabilities) {
|
||||||
|
return this.capabilities[cap] || false;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
get(key = null) {
|
get(key = null) {
|
||||||
if (typeof (this.data_store) === 'undefined') return null;
|
if (typeof (this.data_store) === 'undefined') return null;
|
||||||
else if (key === null) return this.data_store;
|
else if (key === null) return this.data_store;
|
||||||
|
|||||||
@@ -730,7 +730,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
|||||||
if (!ssid_sessions[socket.ssid]) {
|
if (!ssid_sessions[socket.ssid]) {
|
||||||
ssid_sessions[socket.ssid] = new WTVClientSessionData();
|
ssid_sessions[socket.ssid] = new WTVClientSessionData();
|
||||||
}
|
}
|
||||||
if (!ssid_sessions[socket.ssid].data_store.capabilities) ssid_sessions[socket.ssid].data_store.capabilities = new WTVClientCapabilities(headers["wtv-capability-flags"]);
|
if (!ssid_sessions[socket.ssid].capabilities) ssid_sessions[socket.ssid].capabilities = new WTVClientCapabilities(headers["wtv-capability-flags"]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user