Skip to content

Replace unmaintained useragent dependency with my-ua-parser#68

Merged
Marsup merged 9 commits intohapijs:masterfrom
johnwatson484:my-ua-parser
Mar 15, 2026
Merged

Replace unmaintained useragent dependency with my-ua-parser#68
Marsup merged 9 commits intohapijs:masterfrom
johnwatson484:my-ua-parser

Conversation

@johnwatson484
Copy link
Contributor

useragent is no longer actively maintained and has several outstanding vulnerabilities within itself and an outdated version of tmp.

@damusix
Copy link

damusix commented Mar 12, 2026

@johnwatson484 Would it be too much to ask if perhaps you could add type augmentations? And, if you could improve this plugin by make it more ergonomic for developer use, how would you do it? Now would be the best time. It might be as simple as server.decorate('request', 'userAgent', function() { return this.plugins.scooter }. With type augmentations, of couse!

Just some thoughts, not required. If you want some references: https://github.com/hapijs/hapi/blob/master/typescript.md#typed-plugin-decorations

@johnwatson484
Copy link
Contributor Author

@johnwatson484 Would it be too much to ask if perhaps you could add type augmentations? And, if you could improve this plugin by make it more ergonomic for developer use, how would you do it? Now would be the best time. It might be as simple as server.decorate('request', 'userAgent', function() { return this.plugins.scooter }. With type augmentations, of couse!

Just some thoughts, not required. If you want some references: https://github.com/hapijs/hapi/blob/master/typescript.md#typed-plugin-decorations

Yeah good idea. Happy to do that.

I think the sever decoration function is a good idea. Makes it a bit more intuitive and aligns well with approaches taken in other Hapi plugins.

I've declared the types in a file similar to other Hapi plugins.

Let me know what you think about the approaches I've taken.

@damusix
Copy link

damusix commented Mar 12, 2026

@Marsup your blessing good sir

@Marsup
Copy link
Contributor

Marsup commented Mar 12, 2026

Looks good, but I wouldn't necessarily pin the dependency's version.

@johnwatson484
Copy link
Contributor Author

Looks good, but I wouldn't necessarily pin the dependency's version.

@Marsup - Unpinned 😁

@Marsup Marsup changed the base branch from master to next March 15, 2026 20:36
@Marsup Marsup changed the base branch from next to master March 15, 2026 20:37
@Marsup Marsup self-assigned this Mar 15, 2026
@Marsup Marsup added the breaking changes Change that can breaking existing code label Mar 15, 2026
@Marsup Marsup added this to the 8.0.0 milestone Mar 15, 2026
@Marsup Marsup merged commit 3c58a9e into hapijs:master Mar 15, 2026
@Marsup Marsup added the dependency Update module dependency label Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking changes Change that can breaking existing code dependency Update module dependency

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants