Polish messages. Keep the newest message in an easy to see field in JSON
This commit is contained in:
parent
37200bb89e
commit
09c0e4df0b
2
@types/src/request.d.ts
vendored
2
@types/src/request.d.ts
vendored
|
@ -19,6 +19,7 @@ export default class ScreenshotRequest {
|
||||||
processing_took: number | null;
|
processing_took: number | null;
|
||||||
waiting_took: number | null;
|
waiting_took: number | null;
|
||||||
process: ChildProcessWithoutNullStreams;
|
process: ChildProcessWithoutNullStreams;
|
||||||
|
current_action: string;
|
||||||
constructor(url: string, domains: string[]);
|
constructor(url: string, domains: string[]);
|
||||||
getJobsAhead(): number;
|
getJobsAhead(): number;
|
||||||
getJSON(): Promise<{
|
getJSON(): Promise<{
|
||||||
|
@ -36,6 +37,7 @@ export default class ScreenshotRequest {
|
||||||
waiting_took: number | null;
|
waiting_took: number | null;
|
||||||
elapsed_time_s: number;
|
elapsed_time_s: number;
|
||||||
zip_url: string | null;
|
zip_url: string | null;
|
||||||
|
current_action: string;
|
||||||
}>;
|
}>;
|
||||||
getGoodImages(): Image[];
|
getGoodImages(): Image[];
|
||||||
setFinished(): void;
|
setFinished(): void;
|
||||||
|
|
|
@ -4,13 +4,13 @@ source ./ephemeral-x.sh
|
||||||
source ./annotate_header.sh
|
source ./annotate_header.sh
|
||||||
source ./utils.sh
|
source ./utils.sh
|
||||||
|
|
||||||
echo "{\"current_action\": \"Setting up X environment...\"}"
|
echo "{\"current_action\": \"Uruchamianie serwera X\"}"
|
||||||
|
|
||||||
echo "{\"current_action\": \"Starting firefox...\"}"
|
echo "{\"current_action\": \"Wczytywanie Firefoxa....\"}"
|
||||||
start_firefox
|
start_firefox
|
||||||
grab start_firefox
|
grab start_firefox
|
||||||
prepare_firefox
|
prepare_firefox
|
||||||
grab prepare_firefox
|
grab prepare_firefox
|
||||||
echo "{\"current_action\": \"Firefox started, waiting for URL. Run run-analysis.sh in this container to continue\", \"code\": \"ready\"}"
|
echo "{\"current_action\": \"Oczekiwanie na URL do analizy...\", \"code\": \"ready\"}"
|
||||||
./eternal-sleep.sh &
|
./eternal-sleep.sh &
|
||||||
wait
|
wait
|
||||||
|
|
|
@ -14,7 +14,7 @@ DOMAINS=`node array-to-lines.js "$(echo $INPUT | jq .third_party_domains)"`
|
||||||
|
|
||||||
source ./utils.sh
|
source ./utils.sh
|
||||||
|
|
||||||
PREVIEW="FALSE" # set to "TRUE" in order to enable automatic screenshots kept in preview.png
|
PREVIEW="TRUE" # set to "TRUE" in order to enable automatic screenshots kept in preview.png
|
||||||
|
|
||||||
if [ "$PREVIEW" = "TRUE" ];
|
if [ "$PREVIEW" = "TRUE" ];
|
||||||
then
|
then
|
||||||
|
@ -27,7 +27,6 @@ fi
|
||||||
|
|
||||||
ORIGIN_DOMAIN=$(sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/' <<< "$URL")
|
ORIGIN_DOMAIN=$(sed -e 's/[^/]*\/\/\([^@]*@\)\?\([^:/]*\).*/\2/' <<< "$URL")
|
||||||
|
|
||||||
echo "DOMAINS ARE $DOMAINS"
|
|
||||||
|
|
||||||
while IFS= read -r DOMAIN; do
|
while IFS= read -r DOMAIN; do
|
||||||
load_website "$DOMAIN"
|
load_website "$DOMAIN"
|
||||||
|
@ -56,7 +55,7 @@ while IFS= read -r DOMAIN; do
|
||||||
if [ "$DOMAIN" = "" ]; then
|
if [ "$DOMAIN" = "" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
echo "{\"current_action\": \"scanning for requests from $DOMAIN...\"}"
|
echo "{\"current_action\": \"Skanowanie skryptów z domeny $DOMAIN...\"}"
|
||||||
network_inspector_search "domain:$DOMAIN " # can filter with more granularity: https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor/request_list#filtering_by_properties
|
network_inspector_search "domain:$DOMAIN " # can filter with more granularity: https://developer.mozilla.org/en-US/docs/Tools/Network_Monitor/request_list#filtering_by_properties
|
||||||
|
|
||||||
# grab ni_search
|
# grab ni_search
|
||||||
|
@ -86,7 +85,7 @@ then
|
||||||
kill $refresher_pid;
|
kill $refresher_pid;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "{\"current_action\": \"awaiting al background processes...\"}"
|
echo "{\"current_action\": \"Kończenie...\"}"
|
||||||
|
|
||||||
for PID in "${pids[@]}"
|
for PID in "${pids[@]}"
|
||||||
do
|
do
|
||||||
|
|
|
@ -166,14 +166,14 @@ load_website(){
|
||||||
xdotool key Return
|
xdotool key Return
|
||||||
grab enter
|
grab enter
|
||||||
sleep 1
|
sleep 1
|
||||||
echo "{\"current_action\": \"waiting for $WEBSITE_URL to load...\"}"
|
echo "{\"current_action\": \"Wczytywanie strony $WEBSITE_URL...\"}"
|
||||||
wait_for_website_to_load
|
wait_for_website_to_load
|
||||||
sleep 0.3
|
sleep 0.3
|
||||||
wait_for_website_to_load
|
wait_for_website_to_load
|
||||||
sleep 0.3
|
sleep 0.3
|
||||||
wait_for_website_to_load
|
wait_for_website_to_load
|
||||||
sleep 7 # sometimes the consent modal needs a little time to show up
|
sleep 7 # sometimes the consent modal needs a little time to show up
|
||||||
echo "{\"current_action\": \"website loaded\"}"
|
echo "{\"current_action\": \"Strona wczytana\"}"
|
||||||
}
|
}
|
||||||
|
|
||||||
open_network_inspector(){
|
open_network_inspector(){
|
||||||
|
|
|
@ -24,6 +24,7 @@ export default class ScreenshotRequest {
|
||||||
public processing_took: number | null = null;
|
public processing_took: number | null = null;
|
||||||
public waiting_took: number | null = null;
|
public waiting_took: number | null = null;
|
||||||
public process: ChildProcessWithoutNullStreams;
|
public process: ChildProcessWithoutNullStreams;
|
||||||
|
public current_action = "Inicjalizowaine...";
|
||||||
|
|
||||||
constructor(public url: string, public domains: string[]) {
|
constructor(public url: string, public domains: string[]) {
|
||||||
q.push(async () => {
|
q.push(async () => {
|
||||||
|
@ -62,9 +63,12 @@ export default class ScreenshotRequest {
|
||||||
waiting_took: number | null;
|
waiting_took: number | null;
|
||||||
elapsed_time_s: number;
|
elapsed_time_s: number;
|
||||||
zip_url: string | null;
|
zip_url: string | null;
|
||||||
|
current_action: string;
|
||||||
}> {
|
}> {
|
||||||
return {
|
return {
|
||||||
url: this.url,
|
url: this.url,
|
||||||
|
current_action:
|
||||||
|
this.status == "finished" ? "Zakończono!" : this.current_action,
|
||||||
domains: this.domains,
|
domains: this.domains,
|
||||||
jobs_ahead: this.getJobsAhead(),
|
jobs_ahead: this.getJobsAhead(),
|
||||||
id: this.id,
|
id: this.id,
|
||||||
|
@ -89,6 +93,14 @@ export default class ScreenshotRequest {
|
||||||
}
|
}
|
||||||
|
|
||||||
getGoodImages(): Image[] {
|
getGoodImages(): Image[] {
|
||||||
|
/* find the best set of screenshots, that is: a set of screenshots that
|
||||||
|
contain all the header values that appear in the headers, but with as little
|
||||||
|
screenshots as possible.
|
||||||
|
|
||||||
|
The current approach is to sort the screenshots by which ones contain the
|
||||||
|
most highlighted information, and then go through them one by one and check
|
||||||
|
off the data that they provide and stop once all the values are checked off
|
||||||
|
*/
|
||||||
const result: Image[] = [];
|
const result: Image[] = [];
|
||||||
const domains = Array.from(
|
const domains = Array.from(
|
||||||
new Set(this.images.map((image) => image.domain))
|
new Set(this.images.map((image) => image.domain))
|
||||||
|
@ -200,6 +212,12 @@ export default class ScreenshotRequest {
|
||||||
) {
|
) {
|
||||||
this.images.push(parsed.new_file as Image);
|
this.images.push(parsed.new_file as Image);
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
is(parsed, predicates.object) &&
|
||||||
|
is(parsed.current_action, predicates.string)
|
||||||
|
) {
|
||||||
|
this.current_action = parsed.current_action;
|
||||||
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
//noop
|
//noop
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user