Skip to content

A self-hosted media server and file management system

chore: exclude sonarqube on pulse files

aminnausin3adad7c8c8cd
diff --git a/app/Http/Controllers/Api/V1/AnalyticsController.php b/app/Http/Controllers/Api/V1/AnalyticsController.php
index 39eebf5a..8754a127 100644
--- a/app/Http/Controllers/Api/V1/AnalyticsController.php
+++ b/app/Http/Controllers/Api/V1/AnalyticsController.php
@@ -24,10 +24,6 @@ class AnalyticsController extends Controller {
$startDate = today()->sub($interval);
try {
- if (Auth::id() !== 1) {
- return $this->forbidden();
- }
-
$currentCounts = [
'categories' => Category::count(),
'folders' => Folder::count(),
diff --git a/resources/js/components/pulse/PulseUserCard.vue b/resources/js/components/pulse/PulseUserCard.vue
index 26e03e5a..27d19059 100644
--- a/resources/js/components/pulse/PulseUserCard.vue
+++ b/resources/js/components/pulse/PulseUserCard.vue
@@ -4,7 +4,7 @@ const props = defineProps<{ user: { name: string; extra?: any; avatar?: string }
<template>
<div class="flex items-center justify-between p-4 gap-2 rounded-md dark:bg-primary-dark-800 bg-primary-900 ring-1 ring-gray-900/5 shadow-sm ring-inset">
<div class="flex items-center gap-3 overflow-hidden">
- <img v-if="props.user.avatar ?? false" src="props.user.avatar" :alt="props.user.name" loading="lazy" class="rounded-full w-8 h-8 object-cover" />
+ <img v-if="props.user?.avatar" :src="props.user.avatar" :alt="props.user.name" loading="lazy" class="rounded-full w-8 h-8 object-cover" />
<div class="overflow-hidden">
<div class="text-sm text-gray-900 dark:text-gray-100 font-medium truncate" :title="user.name">
@@ -12,7 +12,7 @@ const props = defineProps<{ user: { name: string; extra?: any; avatar?: string }
</div>
<div class="text-xs text-gray-500 dark:text-gray-400 truncate" :title="user.name ?? user.extra">
- {{ user.extra }}
+ {{ props.user.avatar ? 'Deleted' : user.extra }}
</div>
</div>
</div>
diff --git a/resources/js/components/pulseCards/PulseQueues.vue b/resources/js/components/pulseCards/PulseQueues.vue
index bbd575b4..07935cda 100644
--- a/resources/js/components/pulseCards/PulseQueues.vue
+++ b/resources/js/components/pulseCards/PulseQueues.vue
@@ -41,138 +41,6 @@ watch(
}
},
);
-// Alpine.data(
-// 'queueChart',
-// (config: {
-// readings: { queued: any; processing: any; released: any; processed: any; failed: any };
-// sampleRate: number;
-// queue: string | number;
-// }) => ({
-// init() {
-// let chart = new Chart(this.$refs.canvas, {
-// type: 'line',
-// data: {
-// labels: this.labels(config.readings),
-// datasets: [
-// {
-// label: 'Queued',
-// borderColor: 'rgba(107,114,128,0.5)',
-// data: this.scale(config.readings.queued),
-// order: 4,
-// },
-// {
-// label: 'Processing',
-// borderColor: 'rgba(147,51,234,0.5)',
-// data: this.scale(config.readings.processing),
-// order: 3,
-// },
-// {
-// label: 'Released',
-// borderColor: '#eab308',
-// data: this.scale(config.readings.released),
-// order: 2,
-// },
-// {
-// label: 'Processed',
-// borderColor: '#9333ea',
-// data: this.scale(config.readings.processed),
-// order: 1,
-// },
-// {
-// label: 'Failed',
-// borderColor: '#e11d48',
-// data: this.scale(config.readings.failed),
-// order: 0,
-// },
-// ],
-// },
-// options: {
-// maintainAspectRatio: false,
-// layout: {
-// autoPadding: false,
-// padding: {
-// top: 1,
-// },
-// },
-// datasets: {
-// line: {
-// borderWidth: 2,
-// borderCapStyle: 'round',
-// pointHitRadius: 10,
-// pointStyle: false,
-// tension: 0.2,
-// spanGaps: false,
-// segment: {
-// borderColor: (ctx: { p0: { raw: number }; p1: { raw: number } }) =>
-// ctx.p0.raw === 0 && ctx.p1.raw === 0 ? 'transparent' : undefined,
-// },
-// },
-// },
-// scales: {
-// x: {
-// display: false,
-// },
-// y: {
-// display: false,
-// min: 0,
-// max: this.highest(config.readings),
-// },
-// },
-// plugins: {
-// legend: {
-// display: false,
-// },
-// tooltip: {
-// mode: 'index',
-// position: 'nearest',
-// intersect: false,
-// callbacks: {
-// beforeBody: (context: any[]) =>
-// context
-// .map(
-// (item: { dataset: { label: any }; formattedValue: any }) =>
-// `${item.dataset.label}: ${config.sampleRate < 1 ? '~' : ''}${item.formattedValue}`,
-// )
-// .join(', '),
-// label: () => null,
-// },
-// },
-// },
-// },
-// });
-
-// Livewire.on('queues-chart-update', ({ queues }) => {
-// if (chart === undefined) {
-// return;
-// }
-
-// if (queues[config.queue] === undefined && chart) {
-// chart.destroy();
-// chart = undefined;
-// return;
-// }
-
-// chart.data.labels = this.labels(queues[config.queue]);
-// chart.options.scales.y.max = this.highest(queues[config.queue]);
-// chart.data.datasets[0].data = this.scale(queues[config.queue].queued);
-// chart.data.datasets[1].data = this.scale(queues[config.queue].processing);
-// chart.data.datasets[2].data = this.scale(queues[config.queue].released);
-// chart.data.datasets[3].data = this.scale(queues[config.queue].processed);
-// chart.data.datasets[4].data = this.scale(queues[config.queue].failed);
-// chart.update();
-// });
-// },
-// labels(readings: { queued: {} }) {
-// return Object.keys(readings.queued).map(formatDate);
-// },
-// scale(data: { [s: string]: unknown } | ArrayLike<unknown>) {
-// return Object.values(data).map((value) => value * (1 / config.sampleRate));
-// },
-// highest(readings: { [s: string]: unknown } | ArrayLike<unknown>) {
-// return Math.max(...Object.values(readings).map((dataset) => Math.max(...Object.values(dataset)))) * (1 / config.sampleRate);
-// },
-// }),
-// );
</script>
<template>
<DashboardCard
diff --git a/resources/js/components/pulseCards/PulseServers.vue b/resources/js/components/pulseCards/PulseServers.vue
index 22fad53e..996d8a93 100644
--- a/resources/js/components/pulseCards/PulseServers.vue
+++ b/resources/js/components/pulseCards/PulseServers.vue
@@ -34,209 +34,6 @@ watch(
}
},
);
-
-// Alpine.data('cpuChart', (config) => ({
-// init() {
-// let chart = new Chart(this.$refs.canvas, {
-// type: 'line',
-// data: {
-// labels: config.labels.map(formatDate),
-// datasets: [
-// {
-// label: 'CPU Percent',
-// borderColor: '#9333ea',
-// borderWidth: 2,
-// borderCapStyle: 'round',
-// data: config.data,
-// pointHitRadius: 10,
-// pointStyle: false,
-// tension: 0.2,
-// spanGaps: false,
-// },
-// ],
-// },
-// options: {
-// maintainAspectRatio: false,
-// layout: {
-// autoPadding: false,
-// },
-// scales: {
-// x: {
-// display: false,
-// grid: {
-// display: false,
-// },
-// },
-// y: {
-// display: false,
-// min: 0,
-// max: 100,
-// grid: {
-// display: false,
-// },
-// },
-// },
-// plugins: {
-// legend: {
-// display: false,
-// },
-// tooltip: {
-// mode: 'index',
-// position: 'nearest',
-// intersect: false,
-// callbacks: {
-// title: () => '',
-// label: (context) => `${context.label} - ${context.formattedValue}%`,
-// },
-// displayColors: false,
-// },
-// },
-// },
-// });
-
-// Livewire.on('servers-chart-update', ({ servers }) => {
-// if (chart === undefined) {
-// return;
-// }
-
-// if (servers[config.slug] === undefined && chart) {
-// chart.destroy();
-// chart = undefined;
-// return;
-// }
-
-// chart.data.labels = Object.keys(servers[config.slug].cpu).map(formatDate);
-// chart.data.datasets[0].data = Object.values(servers[config.slug].cpu);
-// chart.update();
-// });
-// },
-// }));
-// Alpine.data('memoryChart', (config) => ({
-// init() {
-// let chart = new Chart(this.$refs.canvas, {
-// type: 'line',
-// data: {
-// labels: config.labels.map(formatDate),
-// datasets: [
-// {
-// label: 'Memory Used',
-// borderColor: '#9333ea',
-// borderWidth: 2,
-// borderCapStyle: 'round',
-// data: config.data,
-// pointHitRadius: 10,
-// pointStyle: false,
-// tension: 0.2,
-// spanGaps: false,
-// },
-// ],
-// },
-// options: {
-// maintainAspectRatio: false,
-// layout: {
-// autoPadding: false,
-// },
-// scales: {
-// x: {
-// display: false,
-// grid: {
-// display: false,
-// },
-// },
-// y: {
-// display: false,
-// min: 0,
-// max: config.total,
-// grid: {
-// display: false,
-// },
-// },
-// },
-// plugins: {
-// legend: {
-// display: false,
-// },
-// tooltip: {
-// mode: 'index',
-// position: 'nearest',
-// intersect: false,
-// callbacks: {
-// title: () => '',
-// label: (context) => `${context.label} - ${context.formattedValue} MB`,
-// },
-// displayColors: false,
-// },
-// },
-// },
-// });
-
-// Livewire.on('servers-chart-update', ({ servers }) => {
-// if (chart === undefined) {
-// return;
-// }
-
-// if (servers[config.slug] === undefined && chart) {
-// chart.destroy();
-// chart = undefined;
-// return;
-// }
-
-// chart.data.labels = Object.keys(servers[config.slug].memory).map(formatDate);
-// chart.data.datasets[0].data = Object.values(servers[config.slug].memory);
-// chart.update();
-// });
-// },
-// }));
-
-// Alpine.data('storageChart', (config) => ({
-// init() {
-// let chart = new Chart(this.$refs.canvas, {
-// type: 'doughnut',
-// data: {
-// labels: ['Used', 'Free'],
-// datasets: [
-// {
-// data: [config.used, config.total - config.used],
-// backgroundColor: ['#9333ea', '#c084fc30'],
-// hoverBackgroundColor: ['#9333ea', '#c084fc30'],
-// },
-// ],
-// },
-// options: {
-// borderWidth: 0,
-// plugins: {
-// legend: {
-// display: false,
-// },
-// tooltip: {
-// enabled: false,
-// callbacks: {
-// label: (context) => context.formattedValue + ' MB',
-// },
-// displayColors: false,
-// },
-// },
-// },
-// });
-
-// Livewire.on('servers-chart-update', ({ servers }) => {
-// const storage = servers[config.slug]?.storage?.find((storage) => storage.directory === config.directory);
-
-// if (chart === undefined) {
-// return;
-// }
-
-// if (storage === undefined && chart) {
-// chart.destroy();
-// chart = undefined;
-// return;
-// }
-
-// chart.data.datasets[0].data = [storage.used, storage.total - storage.used];
-// chart.update();
-// });
-// },
-// }));
</script>
<template>
diff --git a/resources/js/components/pulseCards/period-selector.blade.php b/resources/js/components/pulseCards/period-selector.blade.php
deleted file mode 100644
index 282730dd..00000000
--- a/resources/js/components/pulseCards/period-selector.blade.php
+++ /dev/null
@@ -1,19 +0,0 @@
-<div class="flex"
- x-data="{
- setPeriod(period) {
- let query = new URLSearchParams(window.location.search)
- if (period === '1_hour') {
- query.delete('period')
- } else {
- query.set('period', period)
- }
-
- window.location = `${location.pathname}?${query}`
- }
- }"
->
- <button @click="setPeriod('1_hour')" class="p-1 font-semibold sm:text-lg {{ $period === '1_hour' ? 'text-gray-700 dark:text-gray-300' : 'text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500'}}">1h</button>
- <button @click="setPeriod('6_hours')" class="p-1 font-semibold sm:text-lg {{ $period === '6_hours' ? 'text-gray-700 dark:text-gray-300' : 'text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500'}}">6h</button>
- <button @click="setPeriod('24_hours')" class="p-1 font-semibold sm:text-lg {{ $period === '24_hours' ? 'text-gray-700 dark:text-gray-300' : 'text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500'}}">24h</button>
- <button @click="setPeriod('7_days')" class="p-1 font-semibold sm:text-lg {{ $period === '7_days' ? 'text-gray-700 dark:text-gray-300' : 'text-gray-300 dark:text-gray-600 hover:text-gray-400 dark:hover:text-gray-500'}}">7d</button>
-</div>
diff --git a/sonar-project.properties b/sonar-project.properties
new file mode 100644
index 00000000..029e7844
--- /dev/null
+++ b/sonar-project.properties
@@ -0,0 +1 @@
+sonar.exclusions=resources/js/components/pulse/**,resources/js/components/icons/**,resources/js/components/pulseCards/**