Skip to content

Commit

Permalink
Don't use fragment anymore for urls
Browse files Browse the repository at this point in the history
  • Loading branch information
Rexios80 committed Aug 1, 2024
1 parent af1f90e commit 7e1da0a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pub_stats/lib/controller/data_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class DataController {
// Don't wait for this since it might take a while
instance._getCompletion();

await instance._parsePath(_url.uri.path);
await instance._parsePath(_url.uri.toString());

return instance;
}
Expand Down
2 changes: 1 addition & 1 deletion pub_stats/lib/repo/url_repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class UrlRepo {
final _url = UrlService.forPlatform();

void setPackages(List<String> packages) {
_url.setPath('/packages/${packages.join(',')}');
_url.setPath('packages/${packages.join(',')}');
}

Uri get uri => _url.uri;
Expand Down
8 changes: 2 additions & 6 deletions pub_stats/lib/service/url_service/url_service_web.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,11 @@ class UrlServiceImpl extends UrlService {

@override
void setPath(String path) {
web.window.history.pushState(null, 'pubstats.dev', '#$path');
web.window.history.pushState(null, '', path);
}

@override
Uri get uri {
final uri = Uri.parse(web.window.location.toString());
// Convert fragmented url to a normal one so parsing is easier
return Uri.parse('${uri.scheme}://${uri.host}${uri.fragment}');
}
Uri get uri => Uri.parse(web.window.location.toString());

@override
Stream<Uri> get uriStream => _uriController.stream;
Expand Down
2 changes: 1 addition & 1 deletion pub_stats_collector/lib/repo/discord_repo.dart
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class DiscordRepo {
Embed(
title: package,
color: color,
url: 'https://pub.dev/packages/$package',
url: 'https://pubstats.dev/packages/$package',
fields: [
...changes.entries.map(
(e) => EmbedField(
Expand Down

0 comments on commit 7e1da0a

Please sign in to comment.