Skip to content

Commit

Permalink
machine-setup: only pack machine-setup-linux & fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pandadtdyy committed Oct 29, 2024
1 parent e2a7791 commit fc876ce
Show file tree
Hide file tree
Showing 9 changed files with 43 additions and 24 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,13 @@ jobs:
with:
node-version: 20
- run: yarn
- name: Build
- name: Build Tools Core
run: yarn build
- name: Build Machine Setup App
run: |
cd packages/machine-setup
yarn neu update
yarn neu build --clean
release:
needs: build
Expand All @@ -42,13 +47,16 @@ jobs:
run: tar -czvf /tmp/xcpc-tools-macos.tar.gz dist/pkg/xcpc-tools-macos
- name: Create Tar for Linux
run: tar -czvf /tmp/xcpc-tools-linux.tar.gz dist/pkg/xcpc-tools-linux
- name: Build Machine Setup package
- name: Build Machine Setup App
run: |
cd packages/machine-setup
yarn neu update
yarn neu build --clean
- name: Create Tar for Machine Setup
run: tar -czvf /tmp/xcpc-tools-machine-setup.tar.gz packages/machine-setup/dist/hydro-xcpctools-machine-setup
run: |
cd packages/machine-setup/dist/hydro-xcpctools-machine-setup
chmod +x hydro-xcpctools-machine-setup-linux_*
tar -czvf /tmp/xcpc-tools-machine-setup-linux.tar.gz resources.neu hydro-xcpctools-machine-setup-linux_*
- name: Get release version and commit
id: tag
run: |
Expand All @@ -63,6 +71,6 @@ jobs:
/tmp/xcpc-tools-win.zip
/tmp/xcpc-tools-macos.tar.gz
/tmp/xcpc-tools-linux.tar.gz
/tmp/xcpc-tools-machine-setup.tar.gz
/tmp/xcpc-tools-machine-setup-linux.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion packages/machine-setup/frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/png" href="/hydro.png" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<script src="__neutralino_globals.js"></script>
<title>@Hydro/XCPC-TOOLS/MACHINE-SETUP</title>
Expand Down
Binary file added packages/machine-setup/frontend/public/hydro.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion packages/machine-setup/frontend/public/vite.svg

This file was deleted.

21 changes: 14 additions & 7 deletions packages/machine-setup/frontend/src/components/BasicInfo.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
<template>
<n-grid x-gap="6" :cols="2">
<n-grid x-gap="6" :cols="2" style="margin-bottom: .25em;">
<n-gi>
<n-card bordered shadow="always" style="margin-bottom: .25em;" class="text-center">
<h2 style="margin: .5em 0;">@Hydro/XCPC-TOOLS</h2>
<h1 style="margin: .25em 0;">Setup Tool</h1>
<div style="display: flex; justify-content: center; align-items: center;">
<h1 style="margin: .25em 0;">Setup Tool</h1>
<img src="/hydro.png" alt="logo" style="width: 3em; height: 3em; margin-left: .25em;" />
</div>
</n-card>
<n-card bordered shadow="always">
<n-input placeholder="请输入座位号" v-model:value="editSeat" type="text" size="large" style="width: 100%; margin-bottom: .5em;" />
Expand All @@ -18,7 +21,7 @@
</n-card>
</n-gi>
<n-gi>
<n-card bordered shadow="always">
<n-card bordered shadow="always" style="margin-bottom: .25em;">
<n-popconfirm @positive-click="checkAll(false)" positive-text="开始检查" negative-text="强制开始" @negative-click="checkAll(true)">
<template #trigger>
<n-button type="primary" style="width: 100%;">完成设备配置</n-button>
Expand All @@ -30,8 +33,11 @@
</n-popconfirm>
</n-card>
<n-card bordered shadow="always" class="text-center">
<h1 style="margin: 0;">座位号</h1>
<h1 style="font-size: 5em; margin: 0;">{{ nowSeat || 'XX-XX' }}</h1>
<div style="display: flex; justify-content: center; align-items: center;">
<h1 style="margin: 0;">座位号</h1>
<n-tag v-if="!nowSeat" type="error" style="margin-left: .5em;">未设置座位号</n-tag>
</div>
<h1 style="font-size: 45px; margin: .35em 0;">{{ nowSeat || 'XXXX-XXX' }}</h1>
</n-card>
</n-gi>
</n-grid>
Expand Down Expand Up @@ -63,7 +69,7 @@ const saveSeat = async () => {
const showSeat = async () => {
try {
console.log('show seat', nowSeat.value);
const res = await os.execCommand(`zenity --info --text "<span font='256'>${nowSeat.value}</span>"`);
const res = await os.execCommand(`zenity --info --text "<span font='${nowSeat.value.length > 4 ? 128 : 256}'>${nowSeat.value}</span>" > /dev/null 2>&1 &`);
if (res.stdErr) throw new Error(res.stdErr);
} catch (error) {
console.error(error);
Expand All @@ -72,6 +78,7 @@ const showSeat = async () => {
};
const checkAll = async (force = false) => {
window.$notification.info({ title: '海内存知己,天涯若比邻', content: '正在检查设备配置,请稍后...', duration: 3000 });
if (force) {
if (!nowSeat.value) {
window.$notification.error({ title: '未设置座位号', content: '请先设置座位号', duration: 3000 });
Expand All @@ -91,7 +98,7 @@ const checkAll = async (force = false) => {
await os.execCommand(`systemctl enable heartbeat.timer --now`);
window.$notification.success({ title: '已成功完成配置', content: '5s后程序自动关闭', duration: 5000 });
setTimeout(() => app.exit(), 5000);
os.execCommand(`zenity --info --text "<span font='256'>${nowSeat.value}\n</span><span font='128'>${window.ip}</span>" > /dev/null 2>&1 &`);
os.execCommand(`zenity --info --text "<span font='${nowSeat.value.length > 4 ? 128 : 256}'>${nowSeat.value}\n</span><span font='128'>${window.ip}</span>" > /dev/null 2>&1 &`);
};
const getIp = () => window.ip;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<n-card bordered shadow="always">
<n-card bordered shadow="always" style="margin-bottom: .25em;">
<n-grid x-gap="12" :cols="2">
<n-gi>
<n-tag :type="!nowHeartbeat ? 'error' : 'success'">{{ nowHeartbeat || 'no center' }}</n-tag>
<p><n-tag :type="!nowHeartbeat ? 'error' : 'success'">{{ nowHeartbeat || 'no center' }}</n-tag></p>
<n-space>
<n-tag :type="onHeartbeat ? 'success' : 'error'">{{ onHeartbeat ? '已开启上报' : '未开启上报' }}</n-tag>
<n-button type="warning" size="small" @click="getHeartbeatVersion(nowHeartbeat)">中心状态</n-button>
Expand Down Expand Up @@ -85,8 +85,8 @@ const saveHeartbeat = async (force = false) => {
}
console.log('save heartbeat', url);
await filesystem.writeFile('/etc/default/icpc-heartbeat', `HEARTBEATURL=${url}`);
const res2 = await os.execCommand('systemctl enable heartbeat.timer --now');
console.log('run enable heartbeat on save', res2);
const res = await os.execCommand('systemctl enable heartbeat.timer --now');
console.log('run enable heartbeat on save', res);
nowHeartbeat.value = url;
onHeartbeat.value = true;
window.$notification.success({ title: '保存心跳上报URL成功', content: '请查看心跳上报状态', duration: 3000 });
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<n-card bordered title="Machine Info" shadow="always">
<n-card bordered title="Machine Info" shadow="always" style="margin-bottom: .25em;">
<n-grid x-gap="12" :cols="2">
<n-gi>
<p>CPU: {{ cpuInfo }}</p>
Expand Down
15 changes: 10 additions & 5 deletions packages/machine-setup/frontend/src/components/VideoInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,24 @@
<n-card bordered shadow="always">
<n-grid x-gap="12" :cols="2">
<n-gi>
<n-space>
<div style="display: flex; justify-content: center; align-items: center;">
<p>摄像头服务:</p>
<n-tag :type="hasCamera ? 'success' : 'error'">{{ hasCamera ? '已连接' : '未连接' }}</n-tag>
<n-tag :type="runCamera ? 'success' : 'error'">{{ runCamera ? '运行中' : '未运行' }}</n-tag>
</n-space>
<n-space>
<n-tag :type="hasCamera ? 'success' : 'error'">{{ hasCamera ? '已连接' : '未连接' }}</n-tag>
<n-tag :type="runCamera ? 'success' : 'error'">{{ runCamera ? '运行中' : '未运行' }}</n-tag>
</n-space>
</div>
<n-space>
<n-button size="small" type="primary" @click="runService('vlc-webcam', 'restart')">启动</n-button>
<n-button size="small" type="error" @click="runService('vlc-webcam', 'stop')">停止</n-button>
<n-button size="small" type="info" @click="runVLC('webcam')">测试</n-button>
<n-button size="small" type="warning" @click="runService('vlc-webcam', 'enable')">激活</n-button>
<n-button size="small" @click="statusService('vlc-webcam')">状态</n-button>
</n-space>
<p>屏幕捕获服务:<n-tag :type="runScreen ? 'success' : 'error'">{{ runScreen ? '运行中' : '未运行' }}</n-tag></p>
<div style="display: flex; justify-content: center; align-items: center;">
<p>屏幕捕获服务:</p>
<n-tag :type="runScreen ? 'success' : 'error'">{{ runScreen ? '运行中' : '未运行' }}</n-tag>
</div>
<n-space>
<n-button size="small" type="primary" @click="runService('vlc-screen', 'restart')">启动</n-button>
<n-button size="small" type="error" @click="runService('vlc-screen', 'stop')">停止</n-button>
Expand Down
2 changes: 1 addition & 1 deletion packages/machine-setup/neutralino.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"center": true,
"fullScreen": false,
"alwaysOnTop": false,
"icon": "/frontend/public/vite.svg",
"icon": "/frontend/public/hydro.png",
"enableInspector": false,
"borderless": false,
"maximize": false,
Expand Down

0 comments on commit fc876ce

Please sign in to comment.