mirror of
https://github.com/MirageNetwork/MirageServer.git
synced 2026-04-22 15:47:14 +08:00
@@ -650,13 +650,40 @@ function isInvalidTag(tag) {
|
||||
</dl>
|
||||
<dl class="flex text-sm">
|
||||
<dt class="text-gray-500 w-1/3 md:w-1/4 mr-1 shrink-0">蜃境客户端版本</dt>
|
||||
<dd class="min-w-0 truncate">
|
||||
<dd class="min-w-0">
|
||||
<div class="flex items-center">
|
||||
{{
|
||||
currentMachine.ipnVersion.split("-")[1].indexOf("t") != -1
|
||||
? currentMachine.ipnVersion.split("-")[0]
|
||||
: currentMachine.ipnVersion
|
||||
}}
|
||||
<div
|
||||
v-if="currentMachine.availableUpdateVersion"
|
||||
class="ml-1 tooltip"
|
||||
:data-tip="'可更新' + currentMachine.availableUpdateVersion"
|
||||
>
|
||||
<a
|
||||
:href="'/downloads#/' + currentMachine.os"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
><svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="1.125em"
|
||||
height="1.125em"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
aria-label="Update available for steam-win"
|
||||
class="text-gray-400"
|
||||
>
|
||||
<circle cx="12" cy="12" r="10"></circle>
|
||||
<polyline points="16 12 12 8 8 12"></polyline>
|
||||
<line x1="12" y1="16" x2="12" y2="8"></line></svg
|
||||
></a>
|
||||
</div>
|
||||
</div>
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
@@ -312,7 +312,7 @@ function copyMIPv6() {
|
||||
设备
|
||||
</th>
|
||||
<th class="hidden md:table-cell md:w-1/4">IP</th>
|
||||
<th class="hidden md:table-cell w-1/4 lg:w-1/5">系统</th>
|
||||
<th class="hidden md:table-cell w-1/4 lg:w-1/5">版本</th>
|
||||
<th class="hidden lg:table-cell md:flex-auto">状态</th>
|
||||
<th class="table-cell justify-end ml-auto md:ml-0 relative w-1/6 lg:w-12">
|
||||
<span class="sr-only">设备操作菜单</span>
|
||||
@@ -547,14 +547,42 @@ function copyMIPv6() {
|
||||
</td>
|
||||
<td class="hidden md:table-cell w-1/4 lg:w-1/5">
|
||||
<div class="flex items-center relative">
|
||||
<div>{{ m.os }}</div>
|
||||
<div
|
||||
v-if="m.availableUpdateVersion"
|
||||
class="absolute top-0.5 -left-6 tooltip"
|
||||
:data-tip="'可更新' + m.availableUpdateVersion"
|
||||
>
|
||||
<a
|
||||
:href="'/downloads#/' + m.os"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
><svg
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
width="1.125em"
|
||||
height="1.125em"
|
||||
viewBox="0 0 24 24"
|
||||
fill="none"
|
||||
stroke="currentColor"
|
||||
stroke-width="2"
|
||||
stroke-linecap="round"
|
||||
stroke-linejoin="round"
|
||||
class="text-gray-400"
|
||||
>
|
||||
<circle cx="12" cy="12" r="10"></circle>
|
||||
<polyline points="16 12 12 8 8 12"></polyline>
|
||||
<line x1="12" y1="16" x2="12" y2="8"></line></svg
|
||||
></a>
|
||||
</div>
|
||||
<div>
|
||||
{{
|
||||
m.ipnVersion.split("-")[1].indexOf("t") != -1
|
||||
? m.ipnVersion.split("-")[0]
|
||||
: m.ipnVersion
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="text-sm text-gray-600">
|
||||
{{
|
||||
m.ipnVersion.split("-")[1].indexOf("t") != -1
|
||||
? m.ipnVersion.split("-")[0]
|
||||
: m.ipnVersion
|
||||
}}
|
||||
{{ m.os }}
|
||||
</div>
|
||||
</td>
|
||||
<td class="hidden lg:table-cell md:flex-auto">
|
||||
|
||||
@@ -11,9 +11,9 @@ import Android from './downloads/Android.vue'
|
||||
const routes = [
|
||||
{ path: '/', redirect: '/windows' },
|
||||
{ path: '/windows', component: Windows },
|
||||
{ path: '/ios', component: IOS },
|
||||
{ path: '/iOS', component: IOS },
|
||||
{ path: '/linux', component: Linux },
|
||||
{ path: '/mac', component: Mac },
|
||||
{ path: '/macOS', component: Mac },
|
||||
{ path: '/android', component: Android },
|
||||
]
|
||||
const router = createRouter({
|
||||
|
||||
@@ -117,10 +117,10 @@ const currentRoute = computed(() => {
|
||||
class="flex-grow flex-shrink-0 mx-1 block cursor-pointer select-none rounded pt-3 px-4 pb-2 font-normal text-center leading-normal align-middle focus:outline-none active:outline-none"
|
||||
:class="{
|
||||
'bg-blue-100 focus:bg-blue-100 active:bg-blue-100':
|
||||
currentRoute == '/mac',
|
||||
'focus:bg-blue-50 active:bg-blue-50': currentRoute != '/mac',
|
||||
currentRoute == '/macOS',
|
||||
'focus:bg-blue-50 active:bg-blue-50': currentRoute != '/macOS',
|
||||
}"
|
||||
to="/mac"
|
||||
to="/macOS"
|
||||
><svg class="inline-block mb-1" style="width: 32px; height: 20px">
|
||||
<use href="/img/platform-icons.svg#macos"></use>
|
||||
</svg>
|
||||
@@ -130,10 +130,10 @@ const currentRoute = computed(() => {
|
||||
class="flex-grow flex-shrink-0 mx-1 block cursor-pointer select-none rounded pt-3 px-4 pb-2 font-normal text-center leading-normal align-middle focus:outline-none active:outline-none"
|
||||
:class="{
|
||||
'bg-blue-100 focus:bg-blue-100 active:bg-blue-100':
|
||||
currentRoute == '/ios',
|
||||
'focus:bg-blue-50 active:bg-blue-50': currentRoute != '/ios',
|
||||
currentRoute == '/iOS',
|
||||
'focus:bg-blue-50 active:bg-blue-50': currentRoute != '/iOS',
|
||||
}"
|
||||
to="/ios"
|
||||
to="/iOS"
|
||||
><svg class="inline-block mb-1" style="width: 32px; height: 20px">
|
||||
<use href="/img/platform-icons.svg#apple"></use>
|
||||
</svg>
|
||||
|
||||
@@ -156,6 +156,17 @@ func (c *Cockpit) BuildLinuxClient() {
|
||||
log.Error().Caller().Err(err).Msg("记录Linux客户端最近一次构建成功信息未能完成!")
|
||||
}
|
||||
log.Info().Msg("Linux客户端构建成功!")
|
||||
if c.serviceState {
|
||||
newCfg, err := c.GetSysCfg().toSrvConfig()
|
||||
if err != nil {
|
||||
log.Error().Caller().Err(err).Msg("Linux构建成功向控制器更新系统配置失败")
|
||||
return
|
||||
}
|
||||
c.CtrlChn <- CtrlMsg{
|
||||
Msg: "update-config",
|
||||
SysCfg: newCfg,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func gitCloneRepo(repo, target string) error {
|
||||
|
||||
@@ -53,19 +53,20 @@ type machineData struct {
|
||||
}
|
||||
|
||||
type machineItem struct {
|
||||
Id string `json:"id"` //done
|
||||
StableId string `json:"stableId"` //未实现
|
||||
Name string `json:"name"` //done
|
||||
Fqdn string `json:"fqdn"` //未实现
|
||||
User string `json:"user"` //done
|
||||
UserNameHead string `json:"usernamehead"` // TODO
|
||||
Addresses []string `json:"addresses"` //done
|
||||
Os string `json:"os"` //done
|
||||
Hostname string `json:"hostname"` //done
|
||||
IpnVersion string `json:"ipnVersion"` //done
|
||||
ConnectedToControl bool `json:"connectedToControl"` //done
|
||||
LastSeen string `json:"lastSeen"` //done
|
||||
Created string `json:"created"` //done
|
||||
Id string `json:"id"` //done
|
||||
StableId string `json:"stableId"` //未实现
|
||||
Name string `json:"name"` //done
|
||||
Fqdn string `json:"fqdn"` //未实现
|
||||
User string `json:"user"` //done
|
||||
UserNameHead string `json:"usernamehead"` // TODO
|
||||
Addresses []string `json:"addresses"` //done
|
||||
Os string `json:"os"` //done
|
||||
Hostname string `json:"hostname"` //done
|
||||
IpnVersion string `json:"ipnVersion"` //done
|
||||
ConnectedToControl bool `json:"connectedToControl"` //done
|
||||
AvailableUpdateVersion string `json:"availableUpdateVersion"` //未实现
|
||||
LastSeen string `json:"lastSeen"` //done
|
||||
Created string `json:"created"` //done
|
||||
|
||||
IsExternal bool `json:"isExternal"`
|
||||
IsEphemeral bool `json:"isEphemeral"`
|
||||
@@ -90,6 +91,19 @@ type machineItem struct {
|
||||
AutomaticNameMode bool `json:"automaticNameMode"`
|
||||
}
|
||||
|
||||
func IsUpdateAvailable(cur, latest string) bool {
|
||||
curV := strings.Split(strings.Split(cur, "-")[0], ".")
|
||||
latestV := strings.Split(strings.Split(latest, "-")[0], ".")
|
||||
for i := 0; i < len(latestV); i++ {
|
||||
curInt, _ := strconv.Atoi(curV[i])
|
||||
latestInt, _ := strconv.Atoi(latestV[i])
|
||||
if curInt < latestInt {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// 控制台获取设备信息列表的API
|
||||
func (h *Mirage) ConsoleMachinesAPI(
|
||||
w http.ResponseWriter,
|
||||
@@ -132,6 +146,34 @@ func (h *Mirage) ConsoleMachinesAPI(
|
||||
Endpoints: machine.Endpoints,
|
||||
AutomaticNameMode: machine.AutoGenName,
|
||||
}
|
||||
|
||||
switch machine.HostInfo.OS {
|
||||
case "linux":
|
||||
if IsUpdateAvailable(machine.HostInfo.IPNVersion, h.cfg.ClientVersion.Linux.Version) {
|
||||
tmpMachine.AvailableUpdateVersion = strings.Split(h.cfg.ClientVersion.Linux.Version, "-")[0]
|
||||
}
|
||||
case "windows":
|
||||
if IsUpdateAvailable(machine.HostInfo.IPNVersion, h.cfg.ClientVersion.Win.Version) {
|
||||
tmpMachine.AvailableUpdateVersion = strings.Split(h.cfg.ClientVersion.Win.Version, "-")[0]
|
||||
}
|
||||
case "macOS":
|
||||
if h.cfg.ClientVersion.MacStore.Version != "" && IsUpdateAvailable(machine.HostInfo.IPNVersion, h.cfg.ClientVersion.MacStore.Version) {
|
||||
tmpMachine.AvailableUpdateVersion = strings.Split(h.cfg.ClientVersion.MacStore.Version, "-")[0]
|
||||
} else if IsUpdateAvailable(machine.HostInfo.IPNVersion, h.cfg.ClientVersion.MacTestFlight.Version) {
|
||||
tmpMachine.AvailableUpdateVersion = strings.Split(h.cfg.ClientVersion.MacTestFlight.Version, "-")[0]
|
||||
}
|
||||
case "iOS":
|
||||
if h.cfg.ClientVersion.IOSStore.Version != "" && IsUpdateAvailable(machine.HostInfo.IPNVersion, h.cfg.ClientVersion.IOSStore.Version) {
|
||||
tmpMachine.AvailableUpdateVersion = strings.Split(h.cfg.ClientVersion.IOSStore.Version, "-")[0]
|
||||
} else if IsUpdateAvailable(machine.HostInfo.IPNVersion, h.cfg.ClientVersion.IOSTestFlight.Version) {
|
||||
tmpMachine.AvailableUpdateVersion = strings.Split(h.cfg.ClientVersion.IOSTestFlight.Version, "-")[0]
|
||||
}
|
||||
case "android":
|
||||
if IsUpdateAvailable(machine.HostInfo.IPNVersion, h.cfg.ClientVersion.Android.Version) {
|
||||
tmpMachine.AvailableUpdateVersion = strings.Split(h.cfg.ClientVersion.Android.Version, "-")[0]
|
||||
}
|
||||
}
|
||||
|
||||
if machine.User.Organization.EnableMagic {
|
||||
tmpMachine.Fqdn = machine.GivenName + "." + machine.User.Organization.MagicDnsDomain
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user