mirror of
https://github.com/linux-odyssey/linux-odyssey.git
synced 2026-11-07 19:10:12 +08:00
6 files changed
+36
-16
No files matched your search
@@ -74,7 +74,7 @@ const genOption = (nodes, edges) => ({
|
|||||||
symbolSize: [fullwidth / 13, fullwidth / 30],
|
symbolSize: [fullwidth / 13, fullwidth / 30],
|
||||||
roam: 'move',
|
roam: 'move',
|
||||||
zoom: 1.5,
|
zoom: 1.5,
|
||||||
center: ['150%', '50%'],
|
center: ['120%', '30%'],
|
||||||
label: {
|
label: {
|
||||||
show: true,
|
show: true,
|
||||||
fontSize: fullwidth / 90,
|
fontSize: fullwidth / 90,
|
||||||
|
|||||||
@@ -121,6 +121,6 @@ li.discovered {
|
|||||||
}
|
}
|
||||||
|
|
||||||
a.pwd {
|
a.pwd {
|
||||||
box-shadow: 0 0 10px rgba(255, 255, 255, 0.5);
|
box-shadow: 0 0 40px rgba(255, 255, 0, 20);
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -13,12 +13,11 @@ class SocketTerminal {
|
|||||||
disableStdin: false, // 是否应禁用输入
|
disableStdin: false, // 是否应禁用输入
|
||||||
// cursorStyle: "underline", //光标样式
|
// cursorStyle: "underline", //光标样式
|
||||||
cursorBlink: true, // 光标闪烁
|
cursorBlink: true, // 光标闪烁
|
||||||
theme: {
|
foreground: '#ECECEC', // 字体
|
||||||
foreground: '#ECECEC', // 字体
|
background: '#000000', // 背景色
|
||||||
background: '#000000', // 背景色
|
cursor: 'help', // 设置光标
|
||||||
cursor: 'help', // 设置光标
|
fontSize: 18,
|
||||||
lineHeight: 20,
|
fontWeight: 'normal',
|
||||||
},
|
|
||||||
})
|
})
|
||||||
this.fitAddon = new FitAddon()
|
this.fitAddon = new FitAddon()
|
||||||
this.term.loadAddon(this.fitAddon)
|
this.term.loadAddon(this.fitAddon)
|
||||||
|
|||||||
@@ -48,10 +48,10 @@ async function handleCommand(command) {
|
|||||||
|
|
||||||
async function handleResponse({ responses, hints, end }) {
|
async function handleResponse({ responses, hints, end }) {
|
||||||
if (responses) {
|
if (responses) {
|
||||||
await printResponses(responses, 60)
|
await printResponses(responses, 90)
|
||||||
}
|
}
|
||||||
if (hints) {
|
if (hints) {
|
||||||
await printHints(hints, 60)
|
await printHints(hints, 90)
|
||||||
}
|
}
|
||||||
if (end) {
|
if (end) {
|
||||||
console.log(colorize('Quest completed!', 'blue'))
|
console.log(colorize('Quest completed!', 'blue'))
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ const RETURN_SYMBOL = '\u21B5'
|
|||||||
|
|
||||||
// ANSI color map
|
// ANSI color map
|
||||||
const ANSI_COLORS = {
|
const ANSI_COLORS = {
|
||||||
|
default: 0,
|
||||||
black: 30,
|
black: 30,
|
||||||
red: 31,
|
red: 31,
|
||||||
green: 32,
|
green: 32,
|
||||||
@@ -16,10 +17,13 @@ const ANSI_COLORS = {
|
|||||||
white: 37,
|
white: 37,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function colorCode(color) {
|
||||||
|
return `\x1b[${ANSI_COLORS[color]}m`
|
||||||
|
}
|
||||||
|
|
||||||
function colorize(content, color) {
|
function colorize(content, color) {
|
||||||
const colorCode = ANSI_COLORS[color]
|
if (!color) return content
|
||||||
if (!colorCode) return content
|
return `${colorCode(color)}${content}${colorCode('default')}`
|
||||||
return `\x1b[${colorCode}m${content}\x1b[0m`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
process.stdin.setRawMode(true)
|
process.stdin.setRawMode(true)
|
||||||
@@ -36,8 +40,25 @@ function waitForEnter() {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function formatLine(content, color) {
|
||||||
|
let result = colorCode(color)
|
||||||
|
let codeBlock = false
|
||||||
|
for (const c of content) {
|
||||||
|
switch (c) {
|
||||||
|
case '`':
|
||||||
|
result += colorCode(codeBlock ? color : 'green')
|
||||||
|
codeBlock = !codeBlock
|
||||||
|
break
|
||||||
|
|
||||||
|
default:
|
||||||
|
result += c
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result + colorCode('default') + RETURN_SYMBOL
|
||||||
|
}
|
||||||
|
|
||||||
function printLine(content, delay, color) {
|
function printLine(content, delay, color) {
|
||||||
const printContent = `${colorize(content, color)}${RETURN_SYMBOL}`
|
const printContent = formatLine(content, color)
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
let i = 0
|
let i = 0
|
||||||
const timer = setInterval(() => {
|
const timer = setInterval(() => {
|
||||||
|
|||||||
@@ -25,8 +25,8 @@ export function createContainer(name, questId) {
|
|||||||
Image: getQuestImage(questId),
|
Image: getQuestImage(questId),
|
||||||
}
|
}
|
||||||
const { hostPwd, mountQuest } = config.docker
|
const { hostPwd, mountQuest } = config.docker
|
||||||
if (!config.isProduction && hostPwd && mountQuest) {
|
if (!config.isProduction && hostPwd && mountQuest === questId) {
|
||||||
logger.debug('Mounting quest folder', mountQuest)
|
logger.info('Mounting quest folder', mountQuest)
|
||||||
option.HostConfig.Binds = [
|
option.HostConfig.Binds = [
|
||||||
`${hostPwd}/quests/${mountQuest}/home:/home/commander`,
|
`${hostPwd}/quests/${mountQuest}/home:/home/commander`,
|
||||||
`${hostPwd}/packages/container:/usr/local/lib/container`,
|
`${hostPwd}/packages/container:/usr/local/lib/container`,
|
||||||
|
|||||||
Reference in new issue
Block a user