mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-08-11 14:30:23 +02:00
fix(#186): use a different name for the hostname configuration
This commit is contained in:
@@ -416,20 +416,24 @@ angular
|
|||||||
scope: { file: "=" },
|
scope: { file: "=" },
|
||||||
controller: function ($element, $scope, $http) {
|
controller: function ($element, $scope, $http) {
|
||||||
function renderNotebookJSON(json) {
|
function renderNotebookJSON(json) {
|
||||||
$element.html("");
|
|
||||||
const notebook = nb.parse(json);
|
const notebook = nb.parse(json);
|
||||||
try {
|
try {
|
||||||
const rendered = notebook.render();
|
$element.html("");
|
||||||
$element.append(rendered);
|
$element.append(notebook.render());
|
||||||
Prism.highlightAll();
|
Prism.highlightAll();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
$element.html("Unable to render the notebook.");
|
$element.html("Unable to render the notebook.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function render() {
|
function render() {
|
||||||
// $element.html("");
|
|
||||||
if ($scope.$parent.content) {
|
if ($scope.$parent.content) {
|
||||||
renderNotebookJSON(JSON.parse($scope.$parent.content));
|
try {
|
||||||
|
renderNotebookJSON(JSON.parse($scope.$parent.content));
|
||||||
|
} catch (error) {
|
||||||
|
$element.html(
|
||||||
|
"Unable to render the notebook invalid notebook format."
|
||||||
|
);
|
||||||
|
}
|
||||||
} else if ($scope.file) {
|
} else if ($scope.file) {
|
||||||
$http
|
$http
|
||||||
.get($scope.file.download_url)
|
.get($scope.file.download_url)
|
||||||
|
|||||||
@@ -108,26 +108,26 @@ export function anonymizeContent(
|
|||||||
new RegExp(
|
new RegExp(
|
||||||
`https://github.com/${
|
`https://github.com/${
|
||||||
repository.source.githubRepository.fullName
|
repository.source.githubRepository.fullName
|
||||||
}/blob/${repository.source.branch?.name || "HEAD"}\\b`,
|
}/blob/${repository.source.branch?.name || "main"}\\b`,
|
||||||
"gi"
|
"gi"
|
||||||
),
|
),
|
||||||
`https://${config.HOSTNAME}/r/${repository.repoId}`
|
`https://${config.APP_HOSTNAME}/r/${repository.repoId}`
|
||||||
);
|
);
|
||||||
content = content.replace(
|
content = content.replace(
|
||||||
new RegExp(
|
new RegExp(
|
||||||
`https://github.com/${
|
`https://github.com/${
|
||||||
repository.source.githubRepository.fullName
|
repository.source.githubRepository.fullName
|
||||||
}/tree/${(repository.source as GitHubBase).branch?.name || "HEAD"}\\b`,
|
}/tree/${(repository.source as GitHubBase).branch?.name || "main"}\\b`,
|
||||||
"gi"
|
"gi"
|
||||||
),
|
),
|
||||||
`https://${config.HOSTNAME}/r/${repository.repoId}`
|
`https://${config.APP_HOSTNAME}/r/${repository.repoId}`
|
||||||
);
|
);
|
||||||
content = content.replace(
|
content = content.replace(
|
||||||
new RegExp(
|
new RegExp(
|
||||||
`https://github.com/${repository.source.githubRepository.fullName}`,
|
`https://github.com/${repository.source.githubRepository.fullName}`,
|
||||||
"gi"
|
"gi"
|
||||||
),
|
),
|
||||||
`https://${config.HOSTNAME}/r/${repository.repoId}`
|
`https://${config.APP_HOSTNAME}/r/${repository.repoId}`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user