This commit is contained in:
JW
2023-12-19 17:29:16 +01:00
parent 7d36f36cee
commit 05c49c4545
21 changed files with 372 additions and 32 deletions

View File

@@ -1,3 +1,25 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.webviewer;

View File

@@ -1,3 +1,25 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.webviewer.services;
import io.github.jwdeveloper.tiktok.tools.TikTokLiveTools;

View File

@@ -1,3 +1,25 @@
/*
* Copyright (c) 2023-2023 jwdeveloper jacekwoln@gmail.com
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
package io.github.jwdeveloper.tiktok.webviewer.services;
import io.github.jwdeveloper.tiktok.messages.webcast.WebcastResponse;

View File

@@ -25,7 +25,6 @@ var data =
}
dropDown("usersDropDown", () => `${baseUrl}/tiktok/users`, async (e) => {
data.user = e;
update();
@@ -51,28 +50,15 @@ function update() {
}
async function updateAsync() {
console.log(data);
console.log("Updating", data);
await updateConnectionButton()
await updateDataNamesList(async (dataName) => {
data.dataName = dataName;
data.page = 0;
await updateContent();
await updateContent(`${baseUrl}/tiktok/data?name=${data.dataName}&type=${data.dataType}&page=${data.page}`);
await updatePagination(async (page, link) => {
data.page = page;
let response = await fetch(link);
let json = await response.text();
console.log(link)
let root = JSON.parse(json);
editor.setValue(root.content);
if(data.dataType === 'message')
{
console.log("sending proto version")
let response2 = await fetch(`${link}&asProto=true`);
let json2 = await response2.text();
let root2 = JSON.parse(json2);
editor2.setValue(root2.content);
}
await updateContent(link)
});
});
await fetch(`${baseUrl}/tiktok/update?user=${data.user}&session=${data.sessionTag}`);
@@ -100,21 +86,30 @@ async function updatePagination(onSelect) {
});
}
async function updateContent() {
async function updateContent(link) {
console.log("updating content", data)
let response = await fetch(`${baseUrl}/tiktok/data?name=${data.dataName}&type=${data.dataType}&page=${data.page}`);
let response = await fetch(link);
let json = await response.text();
console.log(link)
let root = JSON.parse(json);
editor.setValue(root.content);
if(data.dataType === 'message')
{
$("#editor2").hide()
if (data.dataType === 'message') {
console.log("sending proto version")
let response2 = await fetch(`${baseUrl}/tiktok/data?name=${data.dataName}&type=${data.dataType}&page=${data.page}&asProto=true`);
let response2 = await fetch(`${link}&asProto=true`);
let json2 = await response2.text();
let root2 = JSON.parse(json2);
editor2.setValue(root2.content);
$("#editor2").show()
}
if (data.dataType === 'response' && data.dataName === 'Http') {
var content = JSON.parse(root.content);
var body = JSON.parse(content.request.body)
var asJson = JSON.stringify(body, null, 2)
editor2.setValue(asJson);
$("#editor2").show()
}
}
@@ -194,9 +189,9 @@ async function updateConnectionButton() {
async function connect() {
let name = document.getElementById('name').value;
let session = document.getElementById('sessionTag').value;
let session = document.getElementById('sessionTag').value;
data.collector.name = name
data.collector.sessionTag =session
data.collector.sessionTag = session
let response = await fetch(`${baseUrl}/tiktok/connect?name=${data.collector.name}&session=${data.collector.sessionTag}`);
let greeting = await response.text();