-
-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import moment from 'moment'; | ||
Check warning on line 1 in src/util/swimlane.js
|
||
import { seconds_to_duration } from './time'; | ||
Check warning on line 2 in src/util/swimlane.js
|
||
import DOMPurify from 'dompurify'; | ||
import _ from 'lodash'; | ||
Check warning on line 4 in src/util/swimlane.js
|
||
|
||
const sanitize = DOMPurify.sanitize; | ||
|
||
export function getSwimlane(bucket, color, groupBy, e) { | ||
// WARNING: XSS risk, make sure to sanitize properly | ||
// FIXME: Not actually tested against XSS attacks, implementation needs to be verified in tests. | ||
let subgroup = 'unknown'; | ||
|
||
if (groupBy == 'category') { | ||
subgroup = sanitize(color); | ||
} else if (groupBy == 'bucketType') { | ||
if (bucket.type == 'currentwindow') { | ||
subgroup = sanitize(e.data.app); | ||
} else if (bucket.type == 'web.tab.current') { | ||
subgroup = sanitize((new URL(e.data.url)).hostname.replace('www.','')); | ||
Check warning on line 19 in src/util/swimlane.js
|
||
} else if (bucket.type.startsWith('app.editor')) { | ||
subgroup = sanitize(e.data.language); | ||
} else if (bucket.type.startsWith('general.stopwatch')) { | ||
subgroup = sanitize(e.data.label); | ||
} | ||
Check warning on line 24 in src/util/swimlane.js
|
||
} | ||
|
||
return subgroup; | ||
} |
0d15764
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are screenshots of this commit:
Screenshots using aw-server v0.12.3b11 (click to expand)
Screenshots using aw-server-rust master (click to expand)
Screenshots using aw-server-rust v0.12.3b11 (click to expand)