Skip to content

Commit

Permalink
feat: pass locale to template & bump htmx to v2
Browse files Browse the repository at this point in the history
  • Loading branch information
Cat committed Jun 21, 2024
1 parent 611b03e commit 844095e
Show file tree
Hide file tree
Showing 9 changed files with 106 additions and 103 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ NeXT Panel is a multipurpose proxy service management system designed for Shadow
- Refactored store system, support billing modes including but not limited to annual/monthly, pay-as-you-go, access type billing, etc.
- Refactored scheduled task system, one command can automatically complete all scheduled tasks
- Deep integration of large language models, support intelligent replies to tickets, document generation, and other functions
- One-click access to OpenAI, Google AI, Vertex AI, Hugging Face Hosted API, Cloudflare Workers AI, Anthropic, and other large language model services
- One-click access to OpenAI, Google AI, Vertex AI, Hugging Face Hosted API, Cloudflare Workers AI, Anthropic, AWS Bedrock and other large language model services

## Installation

Expand Down
2 changes: 1 addition & 1 deletion app/predefine.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
// Global constants
const BASE_PATH = __DIR__ . '/..';
const PANEL_NAME = 'NeXT-Panel';
const PANEL_VERSION = '24.4.0';
const PANEL_VERSION = '24.5.0';
const OTA_API_URL = 'https://api.nextpanel.dev/v1/version/latest';
185 changes: 92 additions & 93 deletions composer.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions resources/views/tabler/admin/header.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html lang="zh">
<html lang="{$user->locale}">

<head>
<meta charset="utf-8"/>
Expand All @@ -14,7 +14,7 @@
<script src="//{$config['jsdelivr_url']}/npm/qrcode_js@latest/qrcode.min.js"></script>
<script src="//{$config['jsdelivr_url']}/npm/clipboard@latest/dist/clipboard.min.js"></script>
<script src="//{$config['jsdelivr_url']}/npm/jquery/dist/jquery.min.js"></script>
<script src="//{$config['jsdelivr_url']}/npm/htmx.org@latest/dist/htmx.min.js"></script>
<script src="//{$config['jsdelivr_url']}/npm/htmx.org@v2/dist/htmx.min.js"></script>
<style>
.home-subtitle {
font-size: 14px;
Expand Down
4 changes: 2 additions & 2 deletions resources/views/tabler/header.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html lang="zh">
<html lang="{$config['locale']}">

<head>
<meta charset="utf-8"/>
Expand All @@ -13,5 +13,5 @@
<link href="//{$config['jsdelivr_url']}/npm/@tabler/icons-webfont@latest/tabler-icons.min.css" rel="stylesheet"/>
<!-- JS files -->
<script src="/assets/js/fuck.min.js"></script>
<script src="//{$config['jsdelivr_url']}/npm/htmx.org@latest/dist/htmx.min.js"></script>
<script src="//{$config['jsdelivr_url']}/npm/htmx.org@v2/dist/htmx.min.js"></script>
</head>
4 changes: 2 additions & 2 deletions resources/views/tabler/tinymce.tpl
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script src="//cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2/tinymce.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/tinymce/7.2.0/tinymce.min.js"></script>

<script>
document.addEventListener("DOMContentLoaded", function () {
tinyMCE.baseURL = '//cdnjs.cloudflare.com/ajax/libs/tinymce/7.1.2';
tinyMCE.baseURL = '//cdnjs.cloudflare.com/ajax/libs/tinymce/7.2.0';
tinyMCE.suffix = '.min';
tinyMCE.init({
selector: '#tinymce',
Expand Down
4 changes: 2 additions & 2 deletions resources/views/tabler/user/header.tpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html lang="zh">
<html lang="{$user->locale}">

<head>
<meta charset="utf-8"/>
Expand All @@ -15,7 +15,7 @@
<script src="/assets/js/fuck.min.js"></script>
<script src="//{$config['jsdelivr_url']}/npm/qrcode_js@latest/qrcode.min.js"></script>
<script src="//{$config['jsdelivr_url']}/npm/clipboard@latest/dist/clipboard.min.js"></script>
<script src="//{$config['jsdelivr_url']}/npm/htmx.org@latest/dist/htmx.min.js"></script>
<script src="//{$config['jsdelivr_url']}/npm/htmx.org@v2/dist/htmx.min.js"></script>
<style>
.home-subtitle {
font-size: 14px;
Expand Down
2 changes: 2 additions & 0 deletions src/Services/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ public static function getConfig(): array
'enable_change_email' => $_ENV['enable_change_email'],
'enable_r2_client_download' => $_ENV['enable_r2_client_download'],
'jsdelivr_url' => $_ENV['jsdelivr_url'],
// site default language
'locale' => $_ENV['locale'],
];
}
}
2 changes: 2 additions & 0 deletions tests/App/Services/ViewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public function testGetConfig(): void
$_ENV['enable_change_email'] = true;
$_ENV['enable_r2_client_download'] = true;
$_ENV['jsdelivr_url'] = 'https://cdn.jsdelivr.net';
$_ENV['locale'] = 'en_US';

$config = $this->view->getConfig();

Expand All @@ -68,5 +69,6 @@ public function testGetConfig(): void
$this->assertTrue($config['enable_change_email']);
$this->assertTrue($config['enable_r2_client_download']);
$this->assertEquals('https://cdn.jsdelivr.net', $config['jsdelivr_url']);
$this->assertEquals('en_US', $config['locale']);
}
}

0 comments on commit 844095e

Please sign in to comment.