Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add brave and opera to browser appnames #131

Merged
merged 1 commit into from Jul 11, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 8 additions & 4 deletions src/queries.js
Expand Up @@ -64,8 +64,12 @@ export function appQuery(appbucket, limit) {
return _.map(lines, (l) => l + ";");
}

const chrome_appnames = ["Google-chrome", "chrome.exe", "Chromium", "Google Chrome", "Chromium-browser", "Chromium-browser-chromium", "Google-chrome-beta", "Google-chrome-unstable"];
const firefox_appnames = ["Firefox", "Firefox.exe", "firefox", "firefox.exe", "Firefox Developer Edition", "Firefox Beta", "Nightly"]
const appnames = {
"chrome": ["Google-chrome", "chrome.exe", "Chromium", "Google Chrome", "Chromium-browser", "Chromium-browser-chromium", "Google-chrome-beta", "Google-chrome-unstable"],
"firefox": ["Firefox", "Firefox.exe", "firefox", "firefox.exe", "Firefox Developer Edition", "Firefox Beta", "Nightly"],
"opera": ["opera.exe", "Opera"],
"brave": ["brave.exe"],
};

export function browserSummaryQuery(browserbuckets, windowbucket, afkbucket, limit, filterAFK) {
// Escape `"`
Expand All @@ -83,13 +87,13 @@ export function browserSummaryQuery(browserbuckets, windowbucket, afkbucket, lim
not_afk = filter_keyvals(not_afk, "status", ["not-afk"]);` : ''
);

_.each(["chrome", "firefox"], (browserName) => {
_.each(["chrome", "firefox", "opera", "brave"], (browserName) => {
let bucketId = _.filter(browserbuckets, (buckets) => buckets.indexOf(browserName) !== -1)[0];
if(bucketId === undefined) {
// Skip browser if specific bucket not available
return;
}
let appnames_str = JSON.stringify(browserName == 'chrome' ? chrome_appnames : firefox_appnames);
let appnames_str = JSON.stringify(appnames[browserName]);
code += (
`events_${browserName} = flood(query_bucket("${bucketId}"));
window_${browserName} = filter_keyvals(window, "app", ${appnames_str});`
Expand Down