Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
D
deadlock-theia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
deadlock-public
deadlock-theia
Commits
b44b3745
Commit
b44b3745
authored
Dec 8, 2021
by
Alexandra
Browse files
Options
Downloads
Patches
Plain Diff
fix: marked module not include in bundle
parent
b4708de1
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
deadlock-plugins/deadlock-extension/src/view/briefingView.ts
+27
-26
27 additions, 26 deletions
deadlock-plugins/deadlock-extension/src/view/briefingView.ts
with
27 additions
and
26 deletions
deadlock-plugins/deadlock-extension/src/view/briefingView.ts
+
27
−
26
View file @
b44b3745
import
View
from
"
./view
"
;
import
View
from
'
./view
'
;
import
*
as
vscode
from
"
vscode
"
;
import
*
as
vscode
from
'
vscode
'
;
import
{
marked
}
from
'
marked
'
;
import
*
as
path
from
'
path
'
;
// eslint-disable-next-line @typescript-eslint/no-var-requires
const
marked
=
require
(
"
marked
"
);
const
fs
=
require
(
"
fs
"
);
import
*
as
path
from
"
path
"
;
const
fs
=
require
(
'
fs
'
);
import
{
DOCS_PATH
,
BRIEFING_FILE_NAME
}
from
"
../core/config
"
;
import
{
WebviewBase
}
from
"
./webviewBase
"
;
import
{
OPEN_BRIEFING_COMMAND
}
from
"
../theia/command
"
;
import
{
DOCS_PATH
,
BRIEFING_FILE_NAME
}
from
'
../core/config
'
;
import
{
WebviewBase
}
from
'
./webviewBase
'
;
import
{
OPEN_BRIEFING_COMMAND
}
from
'
../theia/command
'
;
import
{
userConfig
}
from
"
../extension
"
;
import
{
setInterval
}
from
"
timers
"
;
import
{
userConfig
}
from
'
../extension
'
;
import
{
setInterval
}
from
'
timers
'
;
export
const
BRIEFING_ID
=
"
brefingView
"
;
export
const
BRIEFING_ID
=
'
brefingView
'
;
export
default
class
BriefingView
extends
WebviewBase
{
private
briefingContent
:
string
|
undefined
;
...
...
@@ -23,12 +24,12 @@ export default class BriefingView extends WebviewBase {
private
loadingBriefing
:
boolean
=
false
;
constructor
()
{
super
(
BRIEFING_ID
,
"
Briefing
"
,
OPEN_BRIEFING_COMMAND
);
super
(
BRIEFING_ID
,
'
Briefing
'
,
OPEN_BRIEFING_COMMAND
);
}
toBase64
(
file
:
string
)
{
const
result
=
fs
.
readFileSync
(
path
.
join
(
DOCS_PATH
,
file
),
{
encoding
:
"
base64
"
,
encoding
:
'
base64
'
,
});
return
result
;
}
...
...
@@ -37,8 +38,8 @@ export default class BriefingView extends WebviewBase {
const
imageRegex
=
/
\!\[(
.*
?)\]\(\b(
image:
)(
.*
?\))?
/g
return
text
.
replace
(
imageRegex
,
(
match
,
title
,
imagePrefix
,
img
)
=>
{
const
fileName
=
img
.
replace
(
"
)
"
,
""
);
const
extension
=
fileName
.
split
(
"
\
.
"
);
const
fileName
=
img
.
replace
(
'
)
'
,
''
);
const
extension
=
fileName
.
split
(
'
.
'
);
return
`);
}
catch
(
e
)
{
console
.
error
(
e
);
this
.
briefingContent
=
"
Error while parsing your briefing.
"
this
.
briefingContent
=
'
Error while parsing your briefing.
'
}
this
.
show
();
},
(
error
)
=>
{
console
.
error
(
"
Cannot load briefing
"
,
error
);
console
.
error
(
'
Cannot load briefing
'
,
error
);
this
.
errorLoadingBriefing
=
true
;
}
);
...
...
@@ -76,7 +77,7 @@ export default class BriefingView extends WebviewBase {
}
render
()
{
let
output
=
""
;
let
output
=
''
;
if
(
userConfig
.
isProfessor
())
{
output
+=
`
...
...
@@ -94,32 +95,32 @@ export default class BriefingView extends WebviewBase {
if
(
this
.
briefingContent
)
{
output
+=
`<h1>Mission Goal 🕶</h1>
${
marked
(
this
.
briefingContent
)}
`
;
}
else
if
(
this
.
errorLoadingBriefing
)
{
output
+=
"
Cannot load briefing.
"
;
output
+=
'
Cannot load briefing.
'
;
}
else
{
output
+=
"
Loading briefing..
"
;
output
+=
'
Loading briefing..
'
;
}
output
+=
"
<br/>
"
;
output
+=
'
<br/>
'
;
if
(
userConfig
.
getUsername
())
{
output
+=
this
.
renderUserChallengeConfig
();
}
else
{
output
+=
"
Loading help..
"
;
output
+=
'
Loading help..
'
;
}
return
output
;
}
private
renderUserChallengeConfig
()
{
let
adresses
=
""
;
let
adresses
=
''
;
let
pathsLength
=
0
;
const
paths
=
userConfig
.
getPaths
();
for
(
const
key
in
paths
)
{
if
(
key
!==
"
3000
"
)
{
if
(
key
!==
'
3000
'
)
{
pathsLength
++
;
const
path
=
paths
[
key
];
if
(
userConfig
.
getHost
()
===
"
localhost
"
)
{
if
(
userConfig
.
getHost
()
===
'
localhost
'
)
{
adresses
+=
`<li>
${
key
}
binded on <a href="http://
${
userConfig
.
getHost
()}
:
${
path
}
">
${
path
}
</a></li>`
;
}
else
{
adresses
+=
`<li>
${
key
}
binded on <a href="https://
${
userConfig
.
getHost
()}
/
${
path
}
/">
${
path
}
</a></li>`
;
...
...
@@ -131,6 +132,6 @@ export default class BriefingView extends WebviewBase {
return
`<h3>Configuration</h3>You have the following adresses availables for your challenge : <ul>
${
adresses
}
</ul>`
;
}
return
""
;
return
''
;
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment