Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added File Manager and Dabase Management #469

Open
wants to merge 33 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
dbd5590
added
princessvincent May 8, 2023
a706182
updated
princessvincent May 9, 2023
052d763
updated
princessvincent May 15, 2023
cd79ad1
file manager system added. Files and Directory on server can be accessed
May 30, 2023
cd5e6b4
Update FileManagerController.php
Pertrick May 30, 2023
8caab92
added apis to swagger docs
princessvincent Jun 6, 2023
ae1a0b6
Merge remote-tracking branch 'origin/main'
SamjiDiamond Jun 7, 2023
1cddf47
Merge remote-tracking branch 'origin/master'
SamjiDiamond Jun 7, 2023
58ac460
effect root record into db, point installation to this
SamjiDiamond Jun 7, 2023
a0d4842
working on autologin for pma
SamjiDiamond Jun 7, 2023
0eee415
updated
princessvincent Jun 7, 2023
f2f6508
updated
princessvincent Jun 8, 2023
cd97e65
added support for Nodejs site
SamjiDiamond Jun 14, 2023
d079c9c
request body added to swagger api
Jun 19, 2023
11867b7
added start up script for Nodejs site
SamjiDiamond Jun 19, 2023
8e041e0
FileManager Service class added
Jun 23, 2023
9ae0040
Merge branch 'main' of https://github.com/SamjiDiamond/cipi into main
Jun 23, 2023
87b6be0
FileManager api endpoint added
Jun 23, 2023
d756d40
push changes
SamjiDiamond Jun 24, 2023
e745071
push changes
SamjiDiamond Jun 24, 2023
75cd1d0
service class removed
Jun 24, 2023
62e4b92
service class added
Jun 24, 2023
5b9f542
Merge branch 'main'
SamjiDiamond Jun 25, 2023
0067d1e
working on nodejs setup
SamjiDiamond Jun 28, 2023
5db5a29
working on nodejs setup
SamjiDiamond Jun 28, 2023
38c7141
working on nodejs setup
SamjiDiamond Jun 28, 2023
2c991fc
working on nodejs setup
SamjiDiamond Jun 28, 2023
cb5c43b
working on nodejs setup
SamjiDiamond Jun 28, 2023
e4152c0
finished working on Nodejs
SamjiDiamond Jun 28, 2023
4101a3e
finished working on Nodejs
SamjiDiamond Jun 28, 2023
762e294
csrf token removed for auth endpoint
Jun 30, 2023
a778b27
Merge remote-tracking branch 'origin/main'
SamjiDiamond Jun 30, 2023
f6ebe63
bug fixed
princessvincent Jul 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
557 changes: 557 additions & 0 deletions app/Http/Controllers/Api/FileManagerController.php

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions app/Http/Controllers/AuthController.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,6 @@ public function logout(Request $request)
], 401);
}
}


}
28 changes: 22 additions & 6 deletions app/Http/Controllers/ConfController.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function panel()
public function host($site_id)
{
$site = Site::where('site_id', $site_id)->firstOrFail();

if ($site->basepath) {
$basepath = '/home/'.$site->username.'/web/'.$site->basepath;
} else {
Expand All @@ -77,15 +77,31 @@ public function host($site_id)
}



/**
* Nodejs Site host configuration
*
*/
public function host_nodejs($site_id)
{
$site = Site::where('site_id', $site_id)->firstOrFail();

$script = Storage::get('cipi/host_nodejs.conf');
$script = str_replace('???USER???', $site->username, $script);
$script = str_replace('???PORT???', str_pad($site->id,4,0,STR_PAD_RIGHT), $script);
$script = str_replace('???DOMAIN???', $site->domain, $script);
return response($script)->withHeaders(['Content-Type' =>'text/plain']);
}



/**
* Site alias configuration
*
*/
public function alias($alias_id)
{
$alias = Alias::where('alias_id', $alias_id)->firstOrFail();

if ($alias->site->basepath) {
$basepath = '/home/'.$alias->site->username.'/web/'.$alias->site->basepath;
} else {
Expand All @@ -101,22 +117,22 @@ public function alias($alias_id)
}



/**
* Site PHP configuration
*
*/
public function php($site_id)
{
$site = Site::where('site_id', $site_id)->firstOrFail();

$script = Storage::get('cipi/php.conf');
$script = str_replace('???USER???', $site->username, $script);
$script = str_replace('???PHP???', $site->php, $script);
return response($script)->withHeaders(['Content-Type' =>'text/plain']);
}


/**
* Site nginx configuration
*
Expand Down
62 changes: 62 additions & 0 deletions app/Http/Controllers/DatabaseController.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php

namespace App\Http\Controllers;

use App\Models\Mysqluser;
use App\Models\Userdatabase;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Hash;

class DatabaseController extends Controller
{

public function viewdatabase()
{
$mysqluser = Mysqluser::all();
$userdata = Userdatabase::all();
return view('database', compact('mysqluser', 'userdata'));
}

public function createdatabase(Request $request)
{
// dd($request->all());
$database = new Userdatabase();
$database->user_id = 1;
$database->database_name = $request->data_name;
$database->save();
if ($database->save()) {
return redirect()->back()->with('success', 'You have successfully Created database!');

} else {
return redirect()->back()->with('failed', 'Unable to Create database!');
}
}

public function createuser(Request $request)
{
$mysql = new Mysqluser();
$mysql->user_id = 1;
$mysql->username = $request->username;
$mysql->password = Hash::make($request->password);
// $mysql->save();
if ($request->password === $request->conf_password) {
if($mysql->save()){
return redirect()->back()->with('success', 'You have successfully added User!');
} else {
return redirect()->back()->with('failed', 'Unable to add User!');
}
} else {
return redirect()->back()->with('failed', 'Confirm Password does not match!');
}
}


public function linkdatabaseuser(Request $request)
{
$mysqluserid = $request->username;
$databaseId = $request->database;
Userdatabase::where('id', $databaseId)->update(['mysqluser_id' => $mysqluserid]);
return redirect()->back()->with('success', 'You have successfully add User to Database!');
}
}
Loading