feat: new channel

This commit is contained in:
hashbro
2026-08-15 03:51:34 +08:00
parent 74067e7b54
commit a18f3dceb7
5 changed files with 241 additions and 51 deletions
@@ -42,10 +42,10 @@ class DeviceController extends Controller
$q = $this->filteredQuery($filters);
$sortable = ['id', 'device_id', 'channel_id', 'device_model', 'ios_version', 'ip', 'has_wallet', 'created_at', 'updated_at'];
$field = (string) $request->query('field', 'updated_at');
$field = (string) $request->query('field', 'created_at');
$order = strtolower((string) $request->query('order', 'desc')) === 'asc' ? 'asc' : 'desc';
if (! in_array($field, $sortable, true)) {
$field = 'updated_at';
$field = 'created_at';
}
$q->orderBy('devices.'.$field, $order);
+20 -2
View File
@@ -412,17 +412,19 @@ class ChannelProjectService
: 'coruna.channel_builder.python';
$configured = trim((string) config($configKey, ''));
if ($configured !== '') {
// Trust .env: do not is_file() — venv python is usually a symlink to
// /usr/bin/python*, which fatals under panel open_basedir.
return $configured;
}
$venv = $this->builderCwd($builderType).'/.venv/bin/python';
if (is_file($venv)) {
if ($this->venvPythonExists($venv)) {
return $venv;
}
if ($builderType === self::BUILDER_NEW) {
$fallback = base_path('channel-builder/.venv/bin/python');
if (is_file($fallback)) {
if ($this->venvPythonExists($fallback)) {
return $fallback;
}
}
@@ -430,6 +432,22 @@ class ChannelProjectService
return 'python3';
}
/**
* Detect .venv/bin/python without following the symlink into /usr/bin
* (open_basedir typically allows the project root only).
*/
private function venvPythonExists(string $path): bool
{
clearstatcache(true, $path);
// is_link() checks the link inode inside the project; does not resolve target.
if (@is_link($path)) {
return true;
}
return @is_file($path);
}
private function builderScript(string $name, string $builderType): string
{
$path = $this->builderCwd($builderType).'/tools/'.$name;