fix: slow get recipe memo
- fix: cannot adb command from blocking suspicious cmd - change: logging to logtape lib - change: adb payload handler format to send payload size as header for exact match payload Signed-off-by: pakintada@gmail.com <Pakin>
This commit is contained in:
parent
aa6414b1cc
commit
3cda8aa60b
12 changed files with 494 additions and 174 deletions
|
|
@ -121,6 +121,7 @@
|
|||
try {
|
||||
addNotification('WARN:Load recipe from app memories ...');
|
||||
|
||||
logger.info('sending request get recipe');
|
||||
sendToAndroid({
|
||||
type: 'get_recipe',
|
||||
payload: {}
|
||||
|
|
@ -290,11 +291,14 @@
|
|||
if (instance) {
|
||||
try {
|
||||
// bypass
|
||||
await adb.executeCmd('echo -n hurr > /sdcard/coffeevending/ignore_pass');
|
||||
await adb.executeCmd('echo -n hurr > /sdcard/coffeevending/ignore_pass', {
|
||||
bypass: true
|
||||
});
|
||||
} catch (e) {}
|
||||
|
||||
let result = await adb.executeCmd(
|
||||
'am start -n com.forthvending.coffeemain/com.forthvending.coffeemain.MainActivity'
|
||||
'am start -n com.forthvending.coffeemain/com.forthvending.coffeemain.MainActivity',
|
||||
{ bypass: true }
|
||||
);
|
||||
// if (result?.output) {
|
||||
// toast.success('Open app success!');
|
||||
|
|
@ -315,13 +319,15 @@
|
|||
|
||||
try {
|
||||
// bypass
|
||||
await adb.executeCmd('echo -n hurr > /sdcard/coffeevending/ignore_pass');
|
||||
await adb.executeCmd('echo -n hurr > /sdcard/coffeevending/ignore_pass', {
|
||||
bypass: true
|
||||
});
|
||||
} catch (e) {}
|
||||
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
// bypass
|
||||
await adb.executeCmd('input tap 336 795');
|
||||
await adb.executeCmd('input tap 336 795', { bypass: true });
|
||||
} catch (e) {}
|
||||
}, 3000);
|
||||
}
|
||||
|
|
@ -846,57 +852,6 @@
|
|||
recipeAutoLoadAttempted = true;
|
||||
void loadBrewDataFromConnectedAdb();
|
||||
});
|
||||
|
||||
$effect(() => {
|
||||
const brewAppStatusInterval = setInterval(async () => {
|
||||
// schedule status from .brew_web_status.log
|
||||
let inst = adb.getAdbInstance();
|
||||
if (inst && devRecipe && !recipeLoading) {
|
||||
await adb.executeCmd(
|
||||
'tail -n 1 /sdcard/coffeevending/.brew_web_status.log > /sdcard/coffeevending/.brew_web_status.latest.log'
|
||||
);
|
||||
|
||||
const latestStatusPath = env.PUBLIC_BREW_WEB_LATEST_STATUS;
|
||||
if (!latestStatusPath) return;
|
||||
|
||||
let brew_status_log = await adb.pull(latestStatusPath);
|
||||
if (brew_status_log) {
|
||||
let latest_log = brew_status_log;
|
||||
|
||||
if (brew_status !== latest_log) {
|
||||
brew_status = latest_log;
|
||||
|
||||
// noti from machine
|
||||
if (latest_log.includes('!!!')) {
|
||||
let log = latest_log.split('!!!');
|
||||
let noti_cfg = log[1];
|
||||
|
||||
if (noti_cfg.includes('=')) {
|
||||
let noti_level = noti_cfg.split('=')[1];
|
||||
|
||||
let spl = log[0].split(':');
|
||||
let pure_msg = spl[spl.length - 1];
|
||||
|
||||
// case special message
|
||||
if (pure_msg.includes('starting retry process')) {
|
||||
// is waiting/idle process
|
||||
pure_msg = 'Wait for brewing';
|
||||
}
|
||||
|
||||
addNotification(`${noti_level}:${pure_msg}`);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (inst && !devRecipe) {
|
||||
// try again
|
||||
// await startFetchRecipeFromMachine();
|
||||
}
|
||||
}, 1000);
|
||||
return () => {
|
||||
clearInterval(brewAppStatusInterval);
|
||||
};
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class="mx-8 flex">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue