From ce5a8f56b67be7fb2e5c815417729c9781f214fb Mon Sep 17 00:00:00 2001 From: master3395 Date: Mon, 16 Feb 2026 14:14:58 +0100 Subject: [PATCH] Add Angular filesize filter for Modify Website page modifyWebsite.html uses | filesize for home directory available_space; filter was missing, causing $injector/unpr FilesizeFilterProvider. Register app.filter('filesize') with array annotation in all websiteFunctions.js copies. --- public/static/websiteFunctions/websiteFunctions.js | 13 +++++++++++++ static/js/websiteFunctions.js | 13 +++++++++++++ static/websiteFunctions/websiteFunctions.js | 13 +++++++++++++ websiteFunctions/static/js/websiteFunctions.js | 13 +++++++++++++ .../static/websiteFunctions/websiteFunctions.js | 13 +++++++++++++ 5 files changed, 65 insertions(+) diff --git a/public/static/websiteFunctions/websiteFunctions.js b/public/static/websiteFunctions/websiteFunctions.js index 1ac19a0ce..060b8a7e1 100644 --- a/public/static/websiteFunctions/websiteFunctions.js +++ b/public/static/websiteFunctions/websiteFunctions.js @@ -10742,6 +10742,19 @@ $("#websiteSuccessfullyModified").hide(); $("#modifyWebsiteLoading").hide(); $("#modifyWebsiteButton").hide(); +/** Angular filter: format bytes as human-readable size (used by modifyWebsite.html) */ +app.filter('filesize', [function () { + return function (bytes) { + if (bytes == null || isNaN(bytes)) return '-'; + var n = Number(bytes); + if (n === 0) return '0 B'; + var k = 1024; + var sizes = ['B', 'KB', 'MB', 'GB', 'TB']; + var i = Math.floor(Math.log(n) / Math.log(k)); + return (n / Math.pow(k, i)).toFixed(2) + ' ' + sizes[Math.min(i, sizes.length - 1)]; + }; +}]); + app.controller('modifyWebsitesController', ['$scope', '$http', function ($scope, $http) { // Initialize home directory variables diff --git a/static/js/websiteFunctions.js b/static/js/websiteFunctions.js index 5b4ebab69..8d0fbd354 100644 --- a/static/js/websiteFunctions.js +++ b/static/js/websiteFunctions.js @@ -10176,6 +10176,19 @@ $("#websiteSuccessfullyModified").hide(); $("#modifyWebsiteLoading").hide(); $("#modifyWebsiteButton").hide(); +/** Angular filter: format bytes as human-readable size (used by modifyWebsite.html) */ +app.filter('filesize', [function () { + return function (bytes) { + if (bytes == null || isNaN(bytes)) return '-'; + var n = Number(bytes); + if (n === 0) return '0 B'; + var k = 1024; + var sizes = ['B', 'KB', 'MB', 'GB', 'TB']; + var i = Math.floor(Math.log(n) / Math.log(k)); + return (n / Math.pow(k, i)).toFixed(2) + ' ' + sizes[Math.min(i, sizes.length - 1)]; + }; +}]); + app.controller('modifyWebsitesController', ['$scope', '$http', function ($scope, $http) { $scope.fetchWebsites = function () { diff --git a/static/websiteFunctions/websiteFunctions.js b/static/websiteFunctions/websiteFunctions.js index b776aeb01..d995fa322 100644 --- a/static/websiteFunctions/websiteFunctions.js +++ b/static/websiteFunctions/websiteFunctions.js @@ -10742,6 +10742,19 @@ $("#websiteSuccessfullyModified").hide(); $("#modifyWebsiteLoading").hide(); $("#modifyWebsiteButton").hide(); +/** Angular filter: format bytes as human-readable size (used by modifyWebsite.html) */ +app.filter('filesize', [function () { + return function (bytes) { + if (bytes == null || isNaN(bytes)) return '-'; + var n = Number(bytes); + if (n === 0) return '0 B'; + var k = 1024; + var sizes = ['B', 'KB', 'MB', 'GB', 'TB']; + var i = Math.floor(Math.log(n) / Math.log(k)); + return (n / Math.pow(k, i)).toFixed(2) + ' ' + sizes[Math.min(i, sizes.length - 1)]; + }; +}]); + app.controller('modifyWebsitesController', ['$scope', '$http', function ($scope, $http) { $scope.fetchWebsites = function () { diff --git a/websiteFunctions/static/js/websiteFunctions.js b/websiteFunctions/static/js/websiteFunctions.js index 5b4ebab69..8d0fbd354 100644 --- a/websiteFunctions/static/js/websiteFunctions.js +++ b/websiteFunctions/static/js/websiteFunctions.js @@ -10176,6 +10176,19 @@ $("#websiteSuccessfullyModified").hide(); $("#modifyWebsiteLoading").hide(); $("#modifyWebsiteButton").hide(); +/** Angular filter: format bytes as human-readable size (used by modifyWebsite.html) */ +app.filter('filesize', [function () { + return function (bytes) { + if (bytes == null || isNaN(bytes)) return '-'; + var n = Number(bytes); + if (n === 0) return '0 B'; + var k = 1024; + var sizes = ['B', 'KB', 'MB', 'GB', 'TB']; + var i = Math.floor(Math.log(n) / Math.log(k)); + return (n / Math.pow(k, i)).toFixed(2) + ' ' + sizes[Math.min(i, sizes.length - 1)]; + }; +}]); + app.controller('modifyWebsitesController', ['$scope', '$http', function ($scope, $http) { $scope.fetchWebsites = function () { diff --git a/websiteFunctions/static/websiteFunctions/websiteFunctions.js b/websiteFunctions/static/websiteFunctions/websiteFunctions.js index b776aeb01..d995fa322 100644 --- a/websiteFunctions/static/websiteFunctions/websiteFunctions.js +++ b/websiteFunctions/static/websiteFunctions/websiteFunctions.js @@ -10742,6 +10742,19 @@ $("#websiteSuccessfullyModified").hide(); $("#modifyWebsiteLoading").hide(); $("#modifyWebsiteButton").hide(); +/** Angular filter: format bytes as human-readable size (used by modifyWebsite.html) */ +app.filter('filesize', [function () { + return function (bytes) { + if (bytes == null || isNaN(bytes)) return '-'; + var n = Number(bytes); + if (n === 0) return '0 B'; + var k = 1024; + var sizes = ['B', 'KB', 'MB', 'GB', 'TB']; + var i = Math.floor(Math.log(n) / Math.log(k)); + return (n / Math.pow(k, i)).toFixed(2) + ' ' + sizes[Math.min(i, sizes.length - 1)]; + }; +}]); + app.controller('modifyWebsitesController', ['$scope', '$http', function ($scope, $http) { $scope.fetchWebsites = function () {