improved uri parsing

This commit is contained in:
Fabian Freund
2026-02-27 08:31:19 +01:00
parent d24675094d
commit d25229cb95
19 changed files with 1132 additions and 95 deletions
+2 -2
View File
@@ -18,12 +18,12 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const _supportedSchemes = {'https', 'http', 'ftp', 'file', 'content', 'about'};
import 'package:weblibre/utils/uri_policy.dart';
extension UriX on Uri {
Uri get base => Uri.parse('$scheme://$authority');
bool get hasSupportedScheme => _supportedSchemes.contains(scheme);
bool get hasSupportedScheme => allSupportedSchemes.any((s) => s.name == scheme);
bool get isHttp => isScheme('http');
bool get isHttps => isScheme('https');