change name to webserver to webtransfer

This commit is contained in:
GMrrc 2024-11-14 17:04:30 +01:00
parent bf0ff5adc2
commit 7dab8eb109
10 changed files with 14 additions and 82 deletions

View File

@ -1,14 +1,14 @@
<?xml version="1.0"?>
<info xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://apps.nextcloud.com/schema/apps/info.xsd">
<id>webserver</id>
<name>Web Server</name>
<id>webtransfer</id>
<name>Web Transfer</name>
<summary>Allow users to transfer files from another repository</summary>
<description>Allow users to transfer files from another repository</description>
<version>1.0.0</version>
<licence>agpl</licence>
<author mail="guillaume.marrec.frey@proton.me" homepage="">Guillaume Marrec</author>
<namespace>WebServer</namespace>
<namespace>WebTransfer</namespace>
<category>files</category>
<bugs>https://gmrrc.fr</bugs>
<dependencies>
@ -16,9 +16,9 @@
</dependencies>
<navigations>
<navigation>
<id>webserver</id>
<name>Web Server</name>
<route>webserver.page.index</route>
<id>webtransfer</id>
<name>Web Transfer</name>
<route>webtransfer.page.index</route>
<icon>app.svg</icon>
<type>link</type>
</navigation>

View File

@ -2,6 +2,5 @@
return [
'routes' => [
['name' => 'page#main', 'url' => '/', 'verb' => 'GET'],
['name' => 'file#upload', 'url' => '/upload', 'verb' => 'POST']
]
];

View File

@ -1,14 +0,0 @@
#drop-zone {
width: 100%;
height: 200px;
border: 2px dashed #0078d4;
display: flex;
align-items: center;
justify-content: center;
color: #555;
}
#drop-zone.hover {
border-color: #005bb5;
background-color: #f0f8ff;
}

View File

@ -2,7 +2,7 @@
declare(strict_types=1);
namespace OCA\WebServer\Controller;
namespace OCA\WebTransfer\Controller;
use OCP\AppFramework\Http;
use OCP\AppFramework\Http\Attribute\ApiRoute;

View File

@ -1,42 +0,0 @@
<?php
namespace OCA\WebServer\Controller;
use OCP\AppFramework\Http\DataResponse;
use OCP\AppFramework\Controller;
use OCP\Files\Node;
use OCP\IRequest;
class FileController extends Controller {
public function __construct(IRequest $request) {
parent::__construct($appName, $request);
}
/**
* @NoCSRFRequired
* @NoAdminRequired
*/
public function upload() {
$uploadedFile = $this->request->getUploadedFile('file');
// Vérifiez si le fichier a été bien reçu
if (!$uploadedFile) {
return new DataResponse(['status' => 'error', 'message' => 'No file uploaded'], 400);
}
try {
// Sauvegardez le fichier dans le dossier de l'utilisateur
$userFolder = \OC::$server->getUserFolder();
$userFolder->newFile($uploadedFile['name'], file_get_contents($uploadedFile['tmp_name']));
return new DataResponse(['status' => 'success', 'filename' => $uploadedFile['name']]);
} catch (\Exception $e) {
// Loggez l'erreur pour plus de détails
\OC::$server->getLogger()->error("File upload error: " . $e->getMessage(), ['app' => 'webserver']);
return new DataResponse(['status' => 'error', 'message' => 'Failed to save file'], 500);
}
}
}

View File

@ -2,9 +2,9 @@
declare(strict_types=1);
namespace OCA\WebServer\Controller;
namespace OCA\WebTransfer\Controller;
use OCA\WebServer\AppInfo\Application;
use OCA\WebTransfer\AppInfo\Application;
use OCP\AppFramework\Controller;
use OCP\AppFramework\Http\Attribute\FrontpageRoute;
use OCP\AppFramework\Http\Attribute\NoAdminRequired;

View File

@ -1,6 +1,6 @@
<template>
<NcAppContent>
<div id="webserver">
<div id="webtransfer">
<h1>Hello world!</h1>
</div>
</NcAppContent>
@ -18,7 +18,7 @@ export default {
</script>
<style scoped lang="scss">
#webserver {
#webtransfer {
display: flex;
justify-content: center;
margin: 16px;

View File

@ -3,4 +3,4 @@ import App from './App.vue'
Vue.mixin({ methods: { t, n } })
const View = Vue.extend(App)
new View().$mount('#webserver')
new View().$mount('#webtransfer')

View File

@ -4,8 +4,8 @@ declare(strict_types=1);
use OCP\Util;
Util::addScript(OCA\WebServer\AppInfo\Application::APP_ID, 'main');
Util::addScript(OCA\WebTransfer\AppInfo\Application::APP_ID, 'main');
?>
<div id="webserver"></div>
<div id="webtransfer"></div>

View File

@ -1,11 +0,0 @@
<?php
script('webserver', 'dragdrop');
style('webserver', 'style');
?>
<div id="app-content">
<h3>Glisser-Déposer pour Ajouter dans Nextcloud</h3>
<div id="drop-zone">Déposez vos fichiers ici</div>
</div>