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

fix: use url-parse for url construction#15670

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
sreya merged 18 commits intomainfromjon/codeql
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
18 commits
Select commitHold shift + click to select a range
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
4 changes: 3 additions & 1 deletionofflinedocs/package.json
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,13 +26,15 @@
"react-icons": "4.12.0",
"react-markdown": "9.0.1",
"rehype-raw": "7.0.0",
"remark-gfm": "4.0.0"
"remark-gfm": "4.0.0",
"sanitize-html": "2.13.1"
},
"devDependencies": {
"@types/lodash": "4.17.13",
"@types/node": "20.17.6",
"@types/react": "18.3.12",
"@types/react-dom": "18.3.1",
"@types/sanitize-html": "2.13.0",
"eslint": "8.57.1",
"eslint-config-next": "14.2.16",
"prettier": "3.3.3",
Expand Down
7 changes: 2 additions & 5 deletionsofflinedocs/pages/[[...slug]].tsx
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -38,6 +38,7 @@ import { MdMenu } from "react-icons/md";
import ReactMarkdown from "react-markdown";
import rehypeRaw from "rehype-raw";
import remarkGfm from "remark-gfm";
import sanitizeHtml from "sanitize-html";

type FilePath = string;
type UrlPath = string;
Expand DownExpand Up@@ -194,10 +195,6 @@ const getNavigation = (manifest: Manifest): Nav => {
return navigation;
};

const removeHtmlComments = (string: string) => {
return string.replace(/<!--[\s\S]*?-->/g, "");
};

export const getStaticPaths: GetStaticPaths = () => {
const manifest = getManifest();
const routes = mapRoutes(manifest);
Expand All@@ -221,7 +218,7 @@ export const getStaticProps: GetStaticProps = (context) => {
const route = routes[urlPath];
const { body } = fm(readContentFile(route.path));
// Serialize MDX to support custom components
const content =removeHtmlComments(body);
const content =sanitizeHtml(body);
const navigation = getNavigation(manifest);
const version = manifest.versions[0];

Expand Down
89 changes: 86 additions & 3 deletionsofflinedocs/pnpm-lock.yaml
View file
Open in desktop

Some generated files are not rendered by default. Learn more abouthow customized files appear on GitHub.

7 changes: 6 additions & 1 deletionsite/src/utils/apps.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -29,7 +29,12 @@ export const createAppLinkHref = (
}

if (appsHost && app.subdomain && app.subdomain_name) {
href = `${protocol}//${appsHost}/`.replace("*", app.subdomain_name);
const baseUrl = `${protocol}//${appsHost}`;
const url = new URL(baseUrl);
url.hostname = appsHost.replace("*", app.subdomain_name);
url.pathname = "/";

href = url.toString();
}
return href;
};
7 changes: 6 additions & 1 deletionsite/src/utils/portForward.ts
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,12 @@ export const portForwardURL = (
const suffix = protocol === "https" ? "s" : "";

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

const baseUrl = `${location.protocol}//${host}`;
const url = new URL(baseUrl);
url.hostname = host.replace("*", subdomain);

return url.toString();
};

// openMaybePortForwardedURL tries to open the provided URI through the
Expand Down
Loading

[8]ページ先頭

©2009-2025 Movatter.jp