mirror of
https://github.com/mivodev/mivo.git
synced 2026-01-26 05:25:42 +07:00
Chore: Bump version to v1.1.0 and implement automated release system
This commit is contained in:
@@ -20,6 +20,7 @@ class Config {
|
||||
|
||||
if ($router) {
|
||||
return [
|
||||
'id' => $router['id'],
|
||||
'ip' => $router['ip_address'],
|
||||
'ip_address' => $router['ip_address'], // Alias
|
||||
'user' => $router['username'],
|
||||
|
||||
@@ -74,7 +74,7 @@ class Logo {
|
||||
$exists = $this->getById($id);
|
||||
} while ($exists);
|
||||
|
||||
$uploadDir = ROOT . '/public/assets/img/logos/';
|
||||
$uploadDir = ROOT . '/public/uploads/logos/';
|
||||
if (!file_exists($uploadDir)) {
|
||||
mkdir($uploadDir, 0777, true);
|
||||
}
|
||||
@@ -86,7 +86,7 @@ class Logo {
|
||||
$this->db->query("INSERT INTO {$this->table} (id, name, path, type, size) VALUES (:id, :name, :path, :type, :size)", [
|
||||
'id' => $id,
|
||||
'name' => $file['name'],
|
||||
'path' => '/assets/img/logos/' . $filename,
|
||||
'path' => '/uploads/logos/' . $filename,
|
||||
'type' => $extension,
|
||||
'size' => $file['size']
|
||||
]);
|
||||
@@ -98,7 +98,7 @@ class Logo {
|
||||
|
||||
public function syncFiles() {
|
||||
// One-time sync: scan folder, if file not in DB, add it.
|
||||
$logoDir = ROOT . '/public/assets/img/logos/';
|
||||
$logoDir = ROOT . '/public/uploads/logos/';
|
||||
if (!file_exists($logoDir)) return;
|
||||
|
||||
$files = [];
|
||||
@@ -112,7 +112,7 @@ class Logo {
|
||||
$extension = pathinfo($filename, PATHINFO_EXTENSION);
|
||||
|
||||
// Check if file is registered (maybe by path match)
|
||||
$webPath = '/assets/img/logos/' . $filename;
|
||||
$webPath = '/uploads/logos/' . $filename;
|
||||
$stmt = $this->db->query("SELECT COUNT(*) FROM {$this->table} WHERE path = :path", ['path' => $webPath]);
|
||||
|
||||
if ($stmt->fetchColumn() == 0) {
|
||||
|
||||
@@ -6,9 +6,9 @@ use App\Core\Database;
|
||||
|
||||
class QuickPrintModel {
|
||||
|
||||
public function getAllBySession($sessionName) {
|
||||
public function getAllByRouterId($routerId) {
|
||||
$db = Database::getInstance();
|
||||
$stmt = $db->query("SELECT * FROM quick_prints WHERE session_name = ?", [$sessionName]);
|
||||
$stmt = $db->query("SELECT * FROM quick_prints WHERE router_id = ?", [$routerId]);
|
||||
return $stmt->fetchAll();
|
||||
}
|
||||
|
||||
@@ -20,17 +20,22 @@ class QuickPrintModel {
|
||||
|
||||
public function add($data) {
|
||||
$db = Database::getInstance();
|
||||
$sql = "INSERT INTO quick_prints (session_name, name, server, profile, prefix, char_length, price, time_limit, data_limit, comment, color)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
// Insert router_id. session_name is kept for legacy/redundancy if needed, or we can drop it.
|
||||
// Let's write both for now to be safe during transition, or user requirement "diubah saja" implies replacement using ID.
|
||||
// But the table still has session_name column (we added router_id, didn't drop session_name).
|
||||
$sql = "INSERT INTO quick_prints (router_id, session_name, name, server, profile, prefix, char_length, price, selling_price, time_limit, data_limit, comment, color)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
|
||||
|
||||
return $db->query($sql, [
|
||||
$data['session_name'],
|
||||
$data['router_id'],
|
||||
$data['session_name'], // Keep filling it for now
|
||||
$data['name'],
|
||||
$data['server'],
|
||||
$data['server'] ?? 'all',
|
||||
$data['profile'],
|
||||
$data['prefix'] ?? '',
|
||||
$data['char_length'] ?? 4,
|
||||
$data['price'] ?? 0,
|
||||
$data['selling_price'] ?? ($data['price'] ?? 0),
|
||||
$data['time_limit'] ?? '',
|
||||
$data['data_limit'] ?? '',
|
||||
$data['comment'] ?? '',
|
||||
@@ -40,15 +45,15 @@ class QuickPrintModel {
|
||||
|
||||
public function update($id, $data) {
|
||||
$db = Database::getInstance();
|
||||
$sql = "UPDATE quick_prints SET name=?, server=?, profile=?, prefix=?, char_length=?, price=?, time_limit=?, data_limit=?, comment=?, color=?, updated_at=CURRENT_TIMESTAMP WHERE id=?";
|
||||
$sql = "UPDATE quick_prints SET name=?, profile=?, prefix=?, char_length=?, price=?, selling_price=?, time_limit=?, data_limit=?, comment=?, color=?, updated_at=CURRENT_TIMESTAMP WHERE id=?";
|
||||
|
||||
return $db->query($sql, [
|
||||
$data['name'],
|
||||
$data['server'],
|
||||
$data['profile'],
|
||||
$data['prefix'] ?? '',
|
||||
$data['char_length'] ?? 4,
|
||||
$data['price'] ?? 0,
|
||||
$data['selling_price'] ?? ($data['price'] ?? 0),
|
||||
$data['time_limit'] ?? '',
|
||||
$data['data_limit'] ?? '',
|
||||
$data['comment'] ?? '',
|
||||
|
||||
@@ -12,10 +12,9 @@ class VoucherTemplateModel {
|
||||
return $stmt->fetchAll();
|
||||
}
|
||||
|
||||
public function getBySession($sessionName) {
|
||||
// Templates can be global or session specific, but allow session filtering
|
||||
public function getAllByRouterId($routerId) {
|
||||
$db = Database::getInstance();
|
||||
$stmt = $db->query("SELECT * FROM voucher_templates WHERE session_name = ? OR session_name = 'global'", [$sessionName]);
|
||||
$stmt = $db->query("SELECT * FROM voucher_templates WHERE router_id = ?", [$routerId]);
|
||||
return $stmt->fetchAll();
|
||||
}
|
||||
|
||||
@@ -27,8 +26,9 @@ class VoucherTemplateModel {
|
||||
|
||||
public function add($data) {
|
||||
$db = Database::getInstance();
|
||||
$sql = "INSERT INTO voucher_templates (session_name, name, content) VALUES (?, ?, ?)";
|
||||
$sql = "INSERT INTO voucher_templates (router_id, session_name, name, content) VALUES (?, ?, ?, ?)";
|
||||
return $db->query($sql, [
|
||||
$data['router_id'],
|
||||
$data['session_name'],
|
||||
$data['name'],
|
||||
$data['content']
|
||||
|
||||
Reference in New Issue
Block a user