fixed nextcloud and wa api
This commit is contained in:
@@ -29,7 +29,7 @@ class NextCloudHelper
|
||||
$currentPath .= '/' . $folder; // Add the current folder to the path
|
||||
|
||||
// Build the URL to create the folder
|
||||
$url = rtrim($baseUrl, '/') . "/mktia/remote.php/dav/files/{$username}" . $currentPath;
|
||||
$url = rtrim($baseUrl, '/') . "/remote.php/dav/files/{$username}" . $currentPath;
|
||||
|
||||
try {
|
||||
// Attempt to create the current folder
|
||||
@@ -78,7 +78,7 @@ class NextCloudHelper
|
||||
}
|
||||
|
||||
$client = new Client();
|
||||
$url = rtrim($baseUrl, '/') . "/mktia/remote.php/dav/files/{$username}/" . ltrim($folderPath, '/') . '/' . $fileName;
|
||||
$url = rtrim($baseUrl, '/') . "/remote.php/dav/files/{$username}/" . ltrim($folderPath, '/') . '/' . $fileName;
|
||||
|
||||
try {
|
||||
// Check if the file is an image
|
||||
@@ -130,14 +130,9 @@ class NextCloudHelper
|
||||
|
||||
public static function getFileUrl($filePath)
|
||||
{
|
||||
$baseUrl = env('NEXT_CLOUD_URL');
|
||||
$username = env('NEXT_CLOUD_USERNAME');
|
||||
|
||||
// Build the user-specific WebDAV file URL
|
||||
$relativePath = "/mktia/remote.php/dav/files/{$username}/" . ltrim($filePath, '/');
|
||||
|
||||
// Return the full accessible URL
|
||||
return rtrim($baseUrl, '/') . '/' . $relativePath;
|
||||
// Instead of returning the direct Nextcloud URL,
|
||||
// return a URL to your own download route.
|
||||
return route('admin.nextcloud.download', ['file' => base64_encode($filePath)]);
|
||||
}
|
||||
|
||||
public static function getNextcloudFile($filePath)
|
||||
@@ -171,7 +166,7 @@ class NextCloudHelper
|
||||
public static function createUser($baseUrl, $adminUsername, $adminPassword, $userId, $password, $displayName, $email)
|
||||
{
|
||||
$client = new Client();
|
||||
$url = rtrim($baseUrl, '/') . "/mktia/ocs/v1.php/cloud/users";
|
||||
$url = rtrim($baseUrl, '/') . "/ocs/v1.php/cloud/users";
|
||||
|
||||
try {
|
||||
$response = $client->request('POST', $url, [
|
||||
@@ -214,7 +209,7 @@ class NextCloudHelper
|
||||
public static function addUserToGroup($baseUrl, $adminUsername, $adminPassword, $userId, $groupName)
|
||||
{
|
||||
$client = new Client();
|
||||
$url = rtrim($baseUrl, '/') . "/mktia/ocs/v1.php/cloud/groups/{$groupName}";
|
||||
$url = rtrim($baseUrl, '/') . "/ocs/v1.php/cloud/groups/{$groupName}";
|
||||
|
||||
try {
|
||||
$response = $client->request('POST', $url, [
|
||||
|
||||
Reference in New Issue
Block a user