Skip to content

Commit

Permalink
feat: migrate php widget to react
Browse files Browse the repository at this point in the history
  • Loading branch information
tautcony committed Apr 1, 2024
1 parent 0033b66 commit d1903ba
Show file tree
Hide file tree
Showing 79 changed files with 6,109 additions and 5,536 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ setup/templates/**/* text eol=lf
*.ttf binary
*.woff binary
*.woff2 binary

# config for bun lock file
*.lockb binary diff=lockb
2 changes: 2 additions & 0 deletions .vscode/i18n-ally-custom-framework.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
languageIds:
- php
- shell
- typescript

# An array of RegExes to find the key usage. **The key should be captured in the first match group**.
# You should unescape RegEx strings in order to fit in the YAML file
Expand All @@ -12,6 +13,7 @@ usageMatchRegex:
# the `{key}` will be placed by a proper keypath matching regex,
# you can ignore it and use your own matching rules as well
- "[^\\w\\d]T\\(['\"]({key})['\"]"
- "[^\\w\\d]i18n.t\\(['\"]({key})['\"]"


# An array of strings containing refactor templates.
Expand Down
5 changes: 2 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
{
"i18n-ally.localesPaths": [
"setup/lang",
"packages/system/lang",
"setup/dashboard/lang"
"packages/**/**/lang",
"setup/**/**/lang",
],
"i18n-ally.pathMatcher": "lang_{locale}.json",
"i18n-ally.sourceLanguage": "en",
Expand Down
13 changes: 7 additions & 6 deletions setup/dashboard/inc/info.system.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,15 @@ public static function netinfo() {
* @return array<int,string>
*/
public static function enuminterface() {
$output = shell_exec('basename -a /sys/class/net/*');
if (!is_string($output)) {
$interfaces = net_get_interfaces();
if ($interfaces === false) {
return [];
}

$ret = preg_split("/\n/", $output, -1, \PREG_SPLIT_NO_EMPTY);
if ($ret === false) {
return [];
$ret = [];
foreach ($interfaces as $key => $value) {
if ($value['up'] === true) {
$ret[] = $key;
}
}

return $ret;
Expand Down
2 changes: 1 addition & 1 deletion setup/dashboard/inc/localize.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function T($message, $values = null) {
$value = $L[$message];
if (is_array($values)) {
foreach ($values as $key => $val) {
$value = str_replace("{{$key}}", $val, $value);
$value = str_replace("{{{$key}}}", $val, $value);
}
}

Expand Down
75 changes: 38 additions & 37 deletions setup/dashboard/inc/panel.app_status.ws.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,154 +6,154 @@
(function ($) {
const service_status_list = [{
key: "BTSYNC",
url: "/widgets/service_status.php?service=resilio-sync",
url: "/node/service_status.php?service=resilio-sync",
id: "#appstat_resilio-sync",
time: 5000
}, {
key: "CIFS",
url: "/widgets/service_status.php?service=smbd",
url: "/node/service_status.php?service=smbd",
id: "#appstat_smbd",
time: 5000
}, {
key: "DELUGED",
url: "/widgets/service_status.php?service=deluged",
url: "/node/service_status.php?service=deluged",
id: "#appstat_deluged",
time: 5000
}, {
key: "DELUGE_WEB",
url: "/widgets/service_status.php?service=deluge-web",
url: "/node/service_status.php?service=deluge-web",
id: "#appstat_deluge-web",
time: 5000
}, {
key: "DENYHOSTS",
url: "/widgets/service_status.php?service=denyhosts",
url: "/node/service_status.php?service=denyhosts",
id: "#appstat_denyhosts",
time: 5000
}, {
key: "EMBY",
url: "/widgets/service_status.php?service=emby-server",
url: "/node/service_status.php?service=emby-server",
id: "#appstat_emby-server",
time: 5000
}, {
key: "FAIL2BAN",
url: "/widgets/service_status.php?service=fail2ban",
url: "/node/service_status.php?service=fail2ban",
id: "#appstat_fail2ban",
time: 5000
}, {
key: "FILEBROWSER",
url: "/widgets/service_status.php?service=filebrowser",
url: "/node/service_status.php?service=filebrowser",
id: "#appstat_filebrowser",
time: 5000
}, {
key: "FILEBROWSEREE",
url: "/widgets/service_status.php?service=filebrowser-ee",
url: "/node/service_status.php?service=filebrowser-ee",
id: "#appstat_filebrowser-ee",
time: 5000
}, {
key: "FLEXGET",
url: "/widgets/service_status.php?service=flexget",
url: "/node/service_status.php?service=flexget",
id: "#appstat_flexget",
time: 5000
}, {
key: "FLOOD",
url: "/widgets/service_status.php?service=flood",
url: "/node/service_status.php?service=flood",
id: "#appstat_flood",
time: 5000
}, {
key: "JELLYFIN",
url: "/widgets/service_status.php?service=jellyfin",
url: "/node/service_status.php?service=jellyfin",
id: "#appstat_jellyfin",
time: 5000
}, {
key: "IRSSI",
url: "/widgets/service_status.php?service=irssi",
url: "/node/service_status.php?service=irssi",
id: "#appstat_irssi",
time: 5000
}, {
key: "NETDATA",
url: "/widgets/service_status.php?service=netdata",
url: "/node/service_status.php?service=netdata",
id: "#appstat_netdata",
time: 5000
}, {
key: "NFS",
url: "/widgets/service_status.php?service=nfs-server",
url: "/node/service_status.php?service=nfs-server",
id: "#appstat_nfs-server",
time: 5000
}, {
key: "NOVNC",
url: "/widgets/service_status.php?service=tightvnc",
url: "/node/service_status.php?service=tightvnc",
id: "#appstat_tightvnc",
time: 5000
}, {
key: "OPENVPN",
url: "/widgets/service_status.php?service=openvpn",
url: "/node/service_status.php?service=openvpn",
id: "#appstat_openvpn",
time: 5000
}, {
key: "PLEX",
url: "/widgets/service_status.php?service=plexmediaserver",
url: "/node/service_status.php?service=plexmediaserver",
id: "#appstat_plexmediaserver",
time: 5000
}, {
key: "RCLONE",
url: "/widgets/service_status.php?service=rclone-web",
url: "/node/service_status.php?service=rclone-web",
id: "#appstat_rclone-web",
time: 5000
}, {
key: "RTORRENT",
url: "/widgets/service_status.php?service=rtorrent",
url: "/node/service_status.php?service=rtorrent",
id: "#appstat_rtorrent",
time: 5000
}, {
key: "SABNZBD",
url: "/widgets/service_status.php?service=sabnzbd",
url: "/node/service_status.php?service=sabnzbd",
id: "#appstat_sabnzbd",
time: 5000
}, {
key: "SYNCTHING",
url: "/widgets/service_status.php?service=syncthing",
url: "/node/service_status.php?service=syncthing",
id: "#appstat_syncthing",
time: 5000
}, {
key: "TRANSMISSION",
url: "/widgets/service_status.php?service=transmission",
url: "/node/service_status.php?service=transmission",
id: "#appstat_transmission",
time: 5000
}, {
key: "QBITTORRENT",
url: "/widgets/service_status.php?service=qbittorrent",
url: "/node/service_status.php?service=qbittorrent",
id: "#appstat_qbittorrent",
time: 5000
}, {
key: "WEBDAV",
url: "/widgets/service_status.php?service=webdav",
url: "/node/service_status.php?service=webdav",
id: "#appstat_webdav",
time: 5000
}, {
key: "VSFTPD",
url: "/widgets/service_status.php?service=vsftpd",
url: "/node/service_status.php?service=vsftpd",
id: "#appstat_vsftpd",
time: 5000
}, {
key: "WEB_CONSOLE",
url: "/widgets/service_status.php?service=ttyd",
url: "/node/service_status.php?service=ttyd",
id: "#appstat_ttyd",
time: 5000
}, {
key: "X2GO",
url: "/widgets/service_status.php?service=x2go",
url: "/node/service_status.php?service=x2go",
id: "#appstat_x2go",
time: 5000
}, {
key: "ZNC",
url: "/widgets/service_status.php?service=znc",
url: "/node/service_status.php?service=znc",
id: "#appstat_znc",
time: 5000
}];

const system_status_list = [{
key: "NETWORK",
url: "/widgets/net_status.php",
url: "/node/net_status.php",
id: undefined,
override: function (dataJSON) {
function formatsize (length) {
Expand Down Expand Up @@ -203,35 +203,35 @@
time: 1000
}, {
key: "UPTIME",
url: "/widgets/up.php",
url: "/node/up.php",
id: "#uptime",
time: 60000
}, {
key: "TOP",
url: "/widgets/load.php",
url: "/node/load.php",
id: "#cpuload",
time: 60000
}, {
key: "BANDWIDTH",
url: "/widgets/bw_tables.php",
url_template: "/widgets/bw_tables.php?page={0}",
url: "/node/bw_tables.php",
url_template: "/node/bw_tables.php?page={0}",
id: "#bw_tables",
before: function () {
const page = localStorage.getItem("bw_tables:page");
if (page && page.length === 1 && "shdm".includes(page)) {
if (page && page.length === 1 && "shdmt".includes(page)) {
this.url = this.url_template.replace("{0}", page);
}
return true;
},
time: 60000
}, {
key: "DISK_USAGE",
url: "/widgets/disk_data.php",
url: "/node/disk_data.php",
id: "#disk_data",
time: 15000
}, {
key: "RAM_USAGE",
url: "/widgets/ram_stats.php",
url: "/node/ram_stats.php",
id: "#meterram",
time: 10000
}, {
Expand Down Expand Up @@ -337,4 +337,5 @@
document.addEventListener("DOMContentLoaded", function () {
Visibility.afterPrerendering(start_status_update);
});
// socket.emit("i18n", "zh");
})(window.jQuery);
18 changes: 9 additions & 9 deletions setup/dashboard/lang/lang_da.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
"BOX_TOOLTIP_ZNC": "Adgang til denne feature fås via ssh ved at skrive: box install znc",
"BTSYNC": "BitTorrent Sync by BitTorrent, Inc er et proprietært peer-to-peer-fil synkronisering værktøj.",
"BW_SELECT": "Båndbredde mulighed",
"CACHED_MEMORY_BUFFERS_TXT": "Buffers ligger på {buffered}",
"CACHED_MEMORY_BUFFERS_TXT": "Buffers ligger på {{buffered}}",
"CACHED_MEMORY_TITLE": "Cached Hukommelsesforbrug",
"CACHED_MEMORY_USAGE_TXT": "Cache hukommelsesforbrug ligger på {cached}",
"CACHED_MEMORY_USAGE_TXT": "Cache hukommelsesforbrug ligger på {{cached}}",
"CANCEL": "Fortryd",
"CHANGEINTERFACE_TXT": "Type this command to setup network interface to be analyse.",
"CHANGEUSERPASS_TXT": "Skriv denne kommando i ssh for at ændre en brugers agdgangskode.",
Expand All @@ -38,7 +38,7 @@
"DELUGE": "Deluge en gratis letvægts cross-platform BitTorrent klient.",
"DENYHOSTS": "DenyHosts is a log-based intrusion-prevention security tool for SSH servers written in Python.",
"DETAILS": "Detaljer",
"DEV_REPO_TXT": "Du er på QuickBox {branch} Repo",
"DEV_REPO_TXT": "Du er på QuickBox {{branch}} Repo",
"DISABLED": "Deaktiveret",
"DISKTEST_TXT": "Skriv denne kommando for at udføre en hurtig s/l test af din disk.",
"DISK_SPACE": "Disk Plads",
Expand Down Expand Up @@ -85,7 +85,7 @@
"PACKAGE_MANAGEMENT_CENTER": "Pakkeadministration",
"PANEL_CONFIG": "Panelkonfiguration",
"PANEL_RESET": "Nulstil panel",
"PERCENTAGE_TXT": "Du har brugt {used}% af din totale disk plads",
"PERCENTAGE_TXT": "Du har brugt {{used}}% af din totale disk plads",
"PHYSICAL_MEMORY_IDLE_TXT": "ledig",
"PHYSICAL_MEMORY_TITLE": "Fysisk Hukommelsesforbrug",
"PHYSICAL_MEMORY_USED_TXT": "brugt",
Expand All @@ -99,9 +99,9 @@
"QUICKBOX_COMMIT": "You are on the QuickBox commit - ",
"QUICK_SYSTEM_TIPS": "Hurtige System Tips",
"RCLONE": "Rclone is an open source, multi threaded, command line computer program to manage or migrate content on cloud and other high latency storage. Its capabilities include sync, transfer, crypt, cache, union, compress and mount. The rclone website lists supported backends including S3, and Google Drive.",
"REAL_MEMORY_FREE_TXT": "Aktuel hukommelse ledig {free}",
"REAL_MEMORY_FREE_TXT": "Aktuel hukommelse ledig {{free}}",
"REAL_MEMORY_TITLE": "Aktuel Hukommelsesforbrug",
"REAL_MEMORY_USAGE_TXT": "Aktuel hukommelsesforbrug ligger på {used}",
"REAL_MEMORY_USAGE_TXT": "Aktuel hukommelsesforbrug ligger på {{used}}",
"RECENT_UPDATES": "Seneste Aktivitet & Opdateringer",
"REFRESH": "Genopfrisk",
"RESTART_SERVICES": "Genstart Services",
Expand All @@ -120,10 +120,10 @@
"SIZE": "Størrelse",
"SL_TXT": "Din servers aktuelle belastningsgennemsnit",
"SPEEDTEST": "This is a very lightweight Speedtest implemented in Javascript, using XMLHttpRequest and Web Workers.",
"SWAP_IDLE_TXT": "ledig {free}",
"SWAP_IDLE_TXT": "ledig {{free}}",
"SWAP_TITLE": "Swap Forbrug",
"SWAP_TOTAL_TXT": "SWAP Område",
"SWAP_USED_TXT": "brugt {used}",
"SWAP_USED_TXT": "brugt {{used}}",
"SWITCH_DEV": "Switch to <code>development</code>",
"SWITCH_MASTER": "Switch to <code>master</code>",
"SABNZBD": "The free and easy binary newsreader",
Expand All @@ -135,7 +135,7 @@
"THEME_CHANGE_TXT": "You are about to change themes. If the theme doesn't appear correctly for you after the refresh, you probably need to clear your browser cache and retry.",
"THEME_SELECT": "Select Theme",
"TORRENTS_LOADED": "Der er indlæst <b>{loaded}</b> torrents",
"TOTAL_L": "total {total}",
"TOTAL_L": "total {{total}}",
"TOTAL_RAM": "Total System RAM",
"TRANSMISSION": "Transmission is designed for easy, powerful use. The defaults are set to Just Work and it only takes a few clicks to configure advanced features like watch directories, bad peer blocklists, and the web interface. When Ubuntu chose Transmission as its default BitTorrent client, one of the most-cited reasons was its easy learning curve.",
"TROUBLESHOOT_TXT": "Type this command to generate a log for troubleshooting",
Expand Down
Loading

0 comments on commit d1903ba

Please sign in to comment.