mirror of
https://forge.fsky.io/oneflux/omegafox.git
synced 2026-02-11 02:32:04 -08:00
Merge pull request #140 from vihangatheturtle/main
Encode Camoufox server config before passing into NodeJS Playwright
This commit is contained in:
commit
f679be90aa
2 changed files with 5 additions and 4 deletions
|
|
@ -13,7 +13,7 @@ function collectData() {
|
||||||
});
|
});
|
||||||
|
|
||||||
process.stdin.on('end', () => {
|
process.stdin.on('end', () => {
|
||||||
resolve(JSON.parse(data));
|
resolve(JSON.parse(Buffer.from(data, "base64").toString()));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,6 +2,7 @@ import subprocess
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, Dict, NoReturn, Tuple, Union
|
from typing import Any, Dict, NoReturn, Tuple, Union
|
||||||
|
|
||||||
|
import base64
|
||||||
import orjson
|
import orjson
|
||||||
from playwright._impl._driver import compute_driver_executable
|
from playwright._impl._driver import compute_driver_executable
|
||||||
|
|
||||||
|
|
@ -47,7 +48,7 @@ def launch_server(**kwargs) -> NoReturn:
|
||||||
config = launch_options(**kwargs)
|
config = launch_options(**kwargs)
|
||||||
nodejs = get_nodejs()
|
nodejs = get_nodejs()
|
||||||
|
|
||||||
data = orjson.dumps(to_camel_case_dict(config)).decode()
|
data = orjson.dumps(to_camel_case_dict(config))
|
||||||
|
|
||||||
process = subprocess.Popen( # nosec
|
process = subprocess.Popen( # nosec
|
||||||
[
|
[
|
||||||
|
|
@ -60,7 +61,7 @@ def launch_server(**kwargs) -> NoReturn:
|
||||||
)
|
)
|
||||||
# Write data to stdin and close the stream
|
# Write data to stdin and close the stream
|
||||||
if process.stdin:
|
if process.stdin:
|
||||||
process.stdin.write(data)
|
process.stdin.write(base64.b64encode(data).decode())
|
||||||
process.stdin.close()
|
process.stdin.close()
|
||||||
|
|
||||||
# Wait forever
|
# Wait forever
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue