Move "clapper_src" dir to "src"

The "clapper_src" directory name was unusual. This was done to make it work as a widget for other apps. Now that this functionality got removed it can be named simply "src" as recommended by guidelines.
This commit is contained in:
Rafał Dzięgiel
2021-01-21 14:19:04 +01:00
parent 79abc661bc
commit 340cb36ecd
32 changed files with 65 additions and 65 deletions

30
src/webHelpers.js Normal file
View File

@@ -0,0 +1,30 @@
const { Soup } = imports.gi;
const ByteArray = imports.byteArray;
const Debug = imports.src.debug;
const { debug } = Debug;
function parseData(dataType, bytes)
{
if(dataType !== Soup.WebsocketDataType.TEXT) {
debug('ignoring non-text WebSocket message');
return [false];
}
let parsedMsg = null;
const msg = bytes.get_data();
try {
parsedMsg = JSON.parse(ByteArray.toString(msg));
}
catch(err) {
debug(err);
}
if(!parsedMsg || !parsedMsg.action) {
debug('no "action" in parsed WebSocket message');
return [false];
}
return [true, parsedMsg];
}