mirror of
https://github.com/lightpanda-io/browser.git
synced 2025-12-16 08:18:59 +00:00
url/location host getter
This commit is contained in:
@@ -233,7 +233,7 @@ fn getUserInfo(raw: [:0]const u8) ?[]const u8 {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
fn getHost(raw: [:0]const u8) []const u8 {
|
pub fn getHost(raw: [:0]const u8) []const u8 {
|
||||||
const scheme_end = std.mem.indexOf(u8, raw, "://") orelse return "";
|
const scheme_end = std.mem.indexOf(u8, raw, "://") orelse return "";
|
||||||
|
|
||||||
var authority_start = scheme_end + 3;
|
var authority_start = scheme_end + 3;
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ pub fn getHostname(self: *const Location) []const u8 {
|
|||||||
return self._url.getHostname();
|
return self._url.getHostname();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn getHost(self: *const Location) []const u8 {
|
||||||
|
return self._url.getHost();
|
||||||
|
}
|
||||||
|
|
||||||
pub fn getPort(self: *const Location) []const u8 {
|
pub fn getPort(self: *const Location) []const u8 {
|
||||||
return self._url.getPort();
|
return self._url.getPort();
|
||||||
}
|
}
|
||||||
@@ -61,6 +65,7 @@ pub const JsApi = struct {
|
|||||||
pub const hash = bridge.accessor(Location.getHash, null, .{});
|
pub const hash = bridge.accessor(Location.getHash, null, .{});
|
||||||
pub const pathname = bridge.accessor(Location.getPathname, null, .{});
|
pub const pathname = bridge.accessor(Location.getPathname, null, .{});
|
||||||
pub const hostname = bridge.accessor(Location.getHostname, null, .{});
|
pub const hostname = bridge.accessor(Location.getHostname, null, .{});
|
||||||
|
pub const host = bridge.accessor(URL.getHost, null, .{});
|
||||||
pub const port = bridge.accessor(Location.getPort, null, .{});
|
pub const port = bridge.accessor(Location.getPort, null, .{});
|
||||||
pub const origin = bridge.accessor(Location.getOrigin, null, .{});
|
pub const origin = bridge.accessor(Location.getOrigin, null, .{});
|
||||||
pub const protocol = bridge.accessor(Location.getProtocol, null, .{});
|
pub const protocol = bridge.accessor(Location.getProtocol, null, .{});
|
||||||
|
|||||||
@@ -62,6 +62,10 @@ pub fn getHostname(self: *const URL) []const u8 {
|
|||||||
return U.getHostname(self._raw);
|
return U.getHostname(self._raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn getHost(self: *const URL) []const u8 {
|
||||||
|
return U.getHost(self._raw);
|
||||||
|
}
|
||||||
|
|
||||||
pub fn getPort(self: *const URL) []const u8 {
|
pub fn getPort(self: *const URL) []const u8 {
|
||||||
return U.getPort(self._raw);
|
return U.getPort(self._raw);
|
||||||
}
|
}
|
||||||
@@ -180,6 +184,7 @@ pub const JsApi = struct {
|
|||||||
pub const username = bridge.accessor(URL.getUsername, null, .{});
|
pub const username = bridge.accessor(URL.getUsername, null, .{});
|
||||||
pub const password = bridge.accessor(URL.getPassword, null, .{});
|
pub const password = bridge.accessor(URL.getPassword, null, .{});
|
||||||
pub const hostname = bridge.accessor(URL.getHostname, null, .{});
|
pub const hostname = bridge.accessor(URL.getHostname, null, .{});
|
||||||
|
pub const host = bridge.accessor(URL.getHost, null, .{});
|
||||||
pub const port = bridge.accessor(URL.getPort, null, .{});
|
pub const port = bridge.accessor(URL.getPort, null, .{});
|
||||||
pub const origin = bridge.accessor(URL.getOrigin, null, .{});
|
pub const origin = bridge.accessor(URL.getOrigin, null, .{});
|
||||||
pub const protocol = bridge.accessor(URL.getProtocol, null, .{});
|
pub const protocol = bridge.accessor(URL.getProtocol, null, .{});
|
||||||
|
|||||||
Reference in New Issue
Block a user