Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: link with protocol on shared ports#12908

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
f0ssel merged 7 commits intomainfromf0ssel/sp-proto-fe
Apr 10, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletioncoderd/workspaceapps/apptest/apptest.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -1165,6 +1165,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
appDetails := setupProxyTest(t, &DeploymentOptions{
ServeHTTPS: true,
})
// using the fact that Apps.Port and Apps.PortHTTPS are the same port here
port, err := strconv.ParseInt(appDetails.Apps.Port.AppSlugOrPort, 10, 32)
require.NoError(t, err)
_, err = appDetails.SDKClient.UpsertWorkspaceAgentPortShare(ctx, appDetails.Workspace.ID, codersdk.UpsertWorkspaceAgentPortShareRequest{
Expand All@@ -1178,7 +1179,7 @@ func Run(t *testing.T, appHostIsPrimary bool, factory DeploymentFactory) {
publicAppClient := appDetails.AppClient(t)
publicAppClient.SetSessionToken("")

resp, err := requestWithRetries(ctx, t, publicAppClient, http.MethodGet, appDetails.SubdomainAppURL(appDetails.Apps.Port).String(), nil)
resp, err := requestWithRetries(ctx, t, publicAppClient, http.MethodGet, appDetails.SubdomainAppURL(appDetails.Apps.PortHTTPS).String(), nil)
require.NoError(t, err)
defer resp.Body.Close()
require.Equal(t, http.StatusOK, resp.StatusCode)
Expand Down
7 changes: 7 additions & 0 deletionscoderd/workspaceapps/apptest/setup.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -116,6 +116,7 @@ type Details struct {
Authenticated App
Public App
Port App
PortHTTPS App
}
}

Expand DownExpand Up@@ -247,6 +248,12 @@ func setupProxyTestWithFactory(t *testing.T, factory DeploymentFactory, opts *De
AgentName: agnt.Name,
AppSlugOrPort: strconv.Itoa(int(opts.port)),
}
details.Apps.PortHTTPS = App{
Username: me.Username,
WorkspaceName: workspace.Name,
AgentName: agnt.Name,
AppSlugOrPort: strconv.Itoa(int(opts.port)) + "s",
}

return details
}
Expand Down
3 changes: 2 additions & 1 deletioncoderd/workspaceapps/appurl/appurl.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -90,9 +90,10 @@ func (a ApplicationURL) Path() string {
//
// Subdomains should be in the form:
//
//({PREFIX}---)?{PORT/APP_SLUG}--{AGENT_NAME}--{WORKSPACE_NAME}--{USERNAME}
//({PREFIX}---)?{PORT{s?}/APP_SLUG}--{AGENT_NAME}--{WORKSPACE_NAME}--{USERNAME}
//e.g.
// https://8080--main--dev--dean.hi.c8s.io
// https://8080s--main--dev--dean.hi.c8s.io
// https://app--main--dev--dean.hi.c8s.io
// https://prefix---8080--main--dev--dean.hi.c8s.io
// https://prefix---app--main--dev--dean.hi.c8s.io
Expand Down
4 changes: 0 additions & 4 deletionscoderd/workspaceapps/request.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -350,10 +350,6 @@ func (r Request) getDatabase(ctx context.Context, db database.Store) (*databaseR
}
// No port share found, so we keep default to owner.
} else {
if ps.Protocol == database.PortShareProtocolHttps {
// Apply HTTPS protocol if specified.
appURL = fmt.Sprintf("https://127.0.0.1:%d", portUint)
}
appSharingLevel = ps.ShareLevel
}
} else {
Expand Down
1 change: 1 addition & 0 deletionssite/src/modules/resources/PortForwardButton.tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -393,6 +393,7 @@ export const PortForwardPopoverView: FC<PortForwardPopoverViewProps> = ({
agent.name,
workspaceName,
username,
share.protocol === "https",
);
const label = share.port;
return (
Expand Down
6 changes: 3 additions & 3 deletionssite/src/utils/portForward.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -4,12 +4,12 @@ export const portForwardURL = (
agentName: string,
workspaceName: string,
username: string,
https = false,
): string => {
const { location } = window;
const suffix = https ? "s" : "";

const subdomain = `${
isNaN(port) ? 3000 : port
}--${agentName}--${workspaceName}--${username}`;
const subdomain = `${port}${suffix}--${agentName}--${workspaceName}--${username}`;
return `${location.protocol}//${host}`.replace("*", subdomain);
};

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp