mirror of
https://github.com/Supernova3339/anonupload.git
synced 2026-07-14 04:52:06 +02:00
Compare commits
102 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5da438d67 | ||
|
|
5c48e4db84 | ||
|
|
fe7180faf6 | ||
|
|
61e008f257 | ||
|
|
ccded8fb0d | ||
|
|
0e9b3dbb22 | ||
|
|
3d711859fd | ||
|
|
0f3746ae00 | ||
|
|
bfdb470d5a | ||
|
|
0185b1692e | ||
|
|
3a35b5fcb2 | ||
|
|
7f2a86ff6f | ||
|
|
64ea075964 | ||
|
|
7bd25ca293 | ||
|
|
90f784abdc | ||
|
|
1e398437f1 | ||
|
|
db4d8b5c3a | ||
|
|
6e0d6b4e34 | ||
|
|
39741a2309 | ||
|
|
5092c0e8e2 | ||
|
|
6fb5e03614 | ||
|
|
9ffcdffe67 | ||
|
|
951cede255 | ||
|
|
26e13de11a | ||
|
|
cdcd99504b | ||
|
|
129452bb80 | ||
|
|
3e7eb7e796 | ||
|
|
0c2b434a18 | ||
|
|
ca29a23e1e | ||
|
|
7c442c2696 | ||
|
|
033e8b83ec | ||
|
|
291ccd45f3 | ||
|
|
c085776cf8 | ||
|
|
b084ba8106 | ||
|
|
c4bfc12b70 | ||
|
|
1722edbc7e | ||
|
|
4b2c042f7b | ||
|
|
72333d3bba | ||
|
|
e2f7de6984 | ||
|
|
688fb64b6a | ||
|
|
0d1170709f | ||
|
|
1ee55f1655 | ||
|
|
292e32a498 | ||
|
|
e6b76497dc | ||
|
|
6b80c19795 | ||
|
|
d8318f4cc7 | ||
|
|
732c65f687 | ||
|
|
b3ccd45fb2 | ||
|
|
98c03de931 | ||
|
|
757bc10daa | ||
|
|
77c734baf7 | ||
|
|
a86e24319e | ||
|
|
8fab7658c5 | ||
|
|
0191e0a72a | ||
|
|
8faa2daef4 | ||
|
|
f8fdfeb8a5 | ||
|
|
8937b15097 | ||
|
|
eb673fc36a | ||
|
|
dace69390a | ||
|
|
24d6fe6cdf | ||
|
|
de90a6f0ba | ||
|
|
a35eaace1f | ||
|
|
9b8689367a | ||
|
|
1d71e48efe | ||
|
|
87c997cfdc | ||
|
|
2b925831b1 | ||
|
|
9259fc964d | ||
|
|
fe50bd4112 | ||
|
|
8f9a13cb2d | ||
|
|
7003b156d2 | ||
|
|
87d2dc0524 | ||
|
|
b4bab3f1da | ||
|
|
aa2f2f499f | ||
|
|
d4b3233afb | ||
|
|
82b167d929 | ||
|
|
40f5026e1d | ||
|
|
603c8dbfdf | ||
|
|
1d928adede | ||
|
|
c45af78251 | ||
|
|
3c526a3346 | ||
|
|
0688bf176e | ||
|
|
c556d00dfa | ||
|
|
e5b557910c | ||
|
|
04c0abb8ed | ||
|
|
bce2d426f9 | ||
|
|
b9c0b359b7 | ||
|
|
4526edd4a9 | ||
|
|
b97b1ea0cb | ||
|
|
8dfabdb42e | ||
|
|
f5049c7802 | ||
|
|
1edb54e0e4 | ||
|
|
dfd93a7cc5 | ||
|
|
e0204eb95c | ||
|
|
156c02242f | ||
|
|
c0dee635a2 | ||
|
|
22b9a6826f | ||
|
|
ff67b91e1e | ||
|
|
7d420e19a3 | ||
|
|
470a09d6ed | ||
|
|
0ea2c9b936 | ||
|
|
c339e2eddf | ||
|
|
b749006c96 |
2
.github/FUNDING.yml
vendored
2
.github/FUNDING.yml
vendored
@@ -1,6 +1,6 @@
|
||||
# These are supported funding model platforms
|
||||
|
||||
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
github: [supernova3339] Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
|
||||
patreon: superdevofficial
|
||||
open_collective: # Replace with a single Open Collective username
|
||||
ko_fi: # Replace with a single Ko-fi username
|
||||
|
||||
10
README.md
10
README.md
@@ -4,16 +4,16 @@
|
||||
</p>
|
||||
|
||||
---
|
||||
|
||||
<!-- images should be 116.6666667 by 26.6666667 for BRAND logos -->
|
||||
#### About
|
||||
|
||||
**AnonFiles** is a simple, databaseless PHP file uploader. It's built with privacy in mind, by not showing the direct filename used.
|
||||
AnonFiles is a simple, databaseless PHP file uploader. It's built with privacy in mind, by not showing the direct filename used.
|
||||
AnonFiles works anywhere! It doesnt matter if your using lightspeed, nginx, or even apache.
|
||||
|
||||
#### Installation
|
||||
|
||||
Host with: [](https://easypanel.io/docs/templates/anonfiles)
|
||||
```
|
||||
docker pull ghcr.io/supernova3339/anonupload
|
||||
docker pull ghcr.io/supernova3339/anonfiles
|
||||
```
|
||||
|
||||
#### Features
|
||||
@@ -24,4 +24,4 @@ docker pull ghcr.io/supernova3339/anonupload
|
||||
- Dockerized
|
||||
|
||||
#### Documentation
|
||||
[Environment Variables](env.md) - [SHAREX-SOON'](#)
|
||||
[Environment Variables](env.md) - [Volumes](mounts.md) - [SHAREX-SOON'](#)
|
||||
|
||||
@@ -66,6 +66,20 @@ return $bytes . ' B';
|
||||
// get size of folders in a folder
|
||||
$plugin_count = count(glob('../../plugins/*', GLOB_ONLYDIR));
|
||||
|
||||
// Update checker
|
||||
$PATCH_URL = 'https://raw.githubusercontent.com/Supernova3339/anonfiles/main/';
|
||||
$version_filename = 'latest.txt?token=GHSAT0AAAAAAB4S7HM4SZGF7VWPABQO3KRSY5FDV4Q'; # REMOVE TOKEN
|
||||
// Get version
|
||||
$ch = curl_init($PATCH_URL . $version_filename);
|
||||
|
||||
curl_setopt($ch, CURLOPT_HEADER, 0);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
|
||||
|
||||
$str = curl_exec($ch);
|
||||
curl_close($ch);
|
||||
|
||||
$server_version = str_to_version_info($str);
|
||||
|
||||
?>
|
||||
<?=template_admin_header('Dashboard', 'dashboard')?>
|
||||
|
||||
@@ -100,7 +114,14 @@ $plugin_count = count(glob('../../plugins/*', GLOB_ONLYDIR));
|
||||
<div class="data">
|
||||
<h3>Version</h3>
|
||||
<p>
|
||||
1.0
|
||||
<?=version?>
|
||||
</p>
|
||||
<?php
|
||||
if($server_version > version){
|
||||
echo '<p>update available</p>';
|
||||
}
|
||||
echo $server_version;
|
||||
?>
|
||||
</p>
|
||||
</div>
|
||||
<i class="fas fa-info"></i>
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
<?php
|
||||
// Check if the user is logged-in
|
||||
include_once '../protect.php';
|
||||
// Read comfiguration file
|
||||
include_once '../../system/config.php';
|
||||
// Add/remove roles from the list
|
||||
$roles_list = ['Admin', 'Member'];
|
||||
// Logout User on '?logout' -->
|
||||
@@ -23,8 +25,8 @@ function template_admin_header($title, $selected = 'dashboard', $selected_child
|
||||
<a href="files.php"' . ($selected == 'files' ? ' class="selected"' : '') . '><i class="fas fa-file-alt"></i>Files</a>
|
||||
<a href="settings.php"' . ($selected == 'settings' ? ' class="selected"' : '') . '><i class="fas fa-tools"></i>Settings</a>
|
||||
<div class="footer">
|
||||
<a href="https://support.superdev.one" target="_blank">AnonFiles</a>
|
||||
Version 1.0.0
|
||||
<a href="https://github.com/supernova3339/anonfiles" target="_blank">AnonFiles</a>
|
||||
Version ' . version . '
|
||||
</div>
|
||||
';
|
||||
// Indenting the below code may cause an error
|
||||
@@ -144,4 +146,12 @@ function time_elapsed_string($datetime, $full = false) {
|
||||
if (!$full) $string = array_slice($string, 0, 1);
|
||||
return $string ? implode(', ', $string) . ' ago' : 'just now';
|
||||
}
|
||||
?>
|
||||
function str_to_version_info($string)
|
||||
{
|
||||
$latest_version = FALSE;
|
||||
if (preg_match('/^\s*?(\d+\.\d+\.\d+)/i', $string, $match)) {
|
||||
$latest_version = $match[1];
|
||||
}
|
||||
return $latest_version;
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
body{
|
||||
background: #111;
|
||||
font-family: "Roboto", sans-serif;
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
p{
|
||||
color: #fff;
|
||||
@@ -34,12 +36,13 @@ form{
|
||||
border: 2px dashed #353535;
|
||||
}
|
||||
form p{
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin-top: -20vh;
|
||||
text-align: center;
|
||||
line-height: 170px;
|
||||
color: #ffffff;
|
||||
font-family: Arial;
|
||||
z-index: -1;
|
||||
}
|
||||
form input{
|
||||
margin: 0;
|
||||
@@ -82,4 +85,47 @@ form button:active{
|
||||
.notification.success{
|
||||
background:#36923b;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
.download-area{
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
left: 50%;
|
||||
margin-top: -100px;
|
||||
margin-left: -250px;
|
||||
width: 500px;
|
||||
height: 200px;
|
||||
}
|
||||
.download-area p{
|
||||
position: absolute;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin-top: -20vh;
|
||||
text-align: center;
|
||||
color: #ffffff;
|
||||
z-index: -1;
|
||||
}
|
||||
.download-btn{
|
||||
margin: 0;
|
||||
color: #fff;
|
||||
background: #2d2d2d;
|
||||
border: none;
|
||||
width: 508px;
|
||||
height: 35px;
|
||||
margin-top: 15px;
|
||||
margin-left: -4px;
|
||||
border-radius: 4px;
|
||||
border-bottom: 4px solid #252525;
|
||||
transition: all .2s ease;
|
||||
outline: none;
|
||||
}
|
||||
.download-btn.timer{
|
||||
color: #fff;
|
||||
background: #2d2d2d;
|
||||
pointer-events: none;
|
||||
}
|
||||
.download-btn:hover{
|
||||
background: #383838;
|
||||
}
|
||||
.download-btn:active{
|
||||
border:0;
|
||||
}
|
||||
|
||||
104
download.php
Normal file
104
download.php
Normal file
@@ -0,0 +1,104 @@
|
||||
<?php
|
||||
require_once(__DIR__ . '/system/core.class.php');
|
||||
// size convertor
|
||||
function sizeFormat($bytes){
|
||||
$kb = 1024;
|
||||
$mb = $kb * 1024;
|
||||
$gb = $mb * 1024;
|
||||
$tb = $gb * 1024;
|
||||
|
||||
if (($bytes >= 0) && ($bytes < $kb)) {
|
||||
return $bytes . ' B';
|
||||
|
||||
} elseif (($bytes >= $kb) && ($bytes < $mb)) {
|
||||
return ceil($bytes / $kb) . ' KB';
|
||||
|
||||
} elseif (($bytes >= $mb) && ($bytes < $gb)) {
|
||||
return ceil($bytes / $mb) . ' MB';
|
||||
|
||||
} elseif (($bytes >= $gb) && ($bytes < $tb)) {
|
||||
return ceil($bytes / $gb) . ' GB';
|
||||
|
||||
} elseif ($bytes >= $tb) {
|
||||
return ceil($bytes / $tb) . ' TB';
|
||||
} else {
|
||||
return $bytes . ' B';
|
||||
}
|
||||
}
|
||||
|
||||
$maxsize = max_size;
|
||||
|
||||
// Get uploaded file
|
||||
$file = $_GET['file'];
|
||||
$fileURL = base64_decode($file);
|
||||
$filesize = filesize($fileURL);
|
||||
$baseurl = file_url_destination;
|
||||
|
||||
// Check if file exists
|
||||
if(!file_exists($fileURL)){
|
||||
http_response_code(404);
|
||||
}
|
||||
if($file == ''){
|
||||
http_response_code(404);
|
||||
}
|
||||
|
||||
$core = new Core();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title><?=app_name?> - Download</title>
|
||||
<link rel="stylesheet" type="text/css" href="assets/main.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<img src="assets/images/logo.png">
|
||||
<?php
|
||||
if(isset($_POST['submit'])){
|
||||
|
||||
}
|
||||
?>
|
||||
<!--<form>-->
|
||||
<div class="download-area">
|
||||
<button class="download-btn" data-timer="<?=waitfor?>">Download [<?=sizeFormat($filesize)?>]</button>
|
||||
<ul>
|
||||
<li>Report files: <a href="mailto:<?=app_contact_email?>"><?=app_contact_email?></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
<!--</form>-->
|
||||
</div>
|
||||
<?php echo'
|
||||
<script>
|
||||
const downloadBtn = document.querySelector(".download-btn");
|
||||
const fileLink = "' . $fileURL .'";
|
||||
const initTimer = () => {
|
||||
if(downloadBtn.classList.contains("disable-timer")) {
|
||||
return window.open(fileLink);
|
||||
}
|
||||
let timer = downloadBtn.dataset.timer;
|
||||
downloadBtn.classList.add("timer");
|
||||
downloadBtn.innerHTML = `Your download will begin in <b>${timer}</b> seconds`;
|
||||
const initCounter = setInterval(() => {
|
||||
if(timer > 0) {
|
||||
timer--;
|
||||
return downloadBtn.innerHTML = `Your download will begin in <b>${timer}</b> seconds`;
|
||||
}
|
||||
clearInterval(initCounter);
|
||||
window.open(fileLink);
|
||||
downloadBtn.innerText = "Your file is downloading...";
|
||||
setTimeout(() => {
|
||||
downloadBtn.classList.replace("timer", "disable-timer");
|
||||
downloadBtn.innerHTML = `<span class="text">Download Again</span>`;
|
||||
}, 3000);
|
||||
}, 1000);
|
||||
}
|
||||
downloadBtn.addEventListener("click", initTimer);
|
||||
</script>
|
||||
</script>'; ?>
|
||||
<?php if(plausibledomain&&plausibledatadomain == !null){ ?>
|
||||
<script defer data-domain="<?=plausibledatadomain?>" src="<?=plausibledomain?>/js/script.js"></script>
|
||||
<?php } ?>
|
||||
</body>
|
||||
</html>
|
||||
2
env.md
2
env.md
@@ -12,6 +12,7 @@
|
||||
| APP_NAME | Sets the app title | YES | AnonUpload - Secure File Sharing
|
||||
| APP_DESC | Sets the app description | YES | Secure and anonymous file sharing
|
||||
| APP_LOGO_IMAGE | Sets the app logo image | YES | assets/images/logo.png
|
||||
| APP_CONTACT_EMAIL | Sets the report files email | YES | admin@admin.com
|
||||
|
||||
##### Plausible
|
||||
---
|
||||
@@ -31,3 +32,4 @@
|
||||
| APP_BASE_URL | Application base URL | YES | https://xxx.xxx/
|
||||
| APP_MAX_SIZE | Application max upload size in BYTES | YES | 10000000000 [10GB]
|
||||
| APP_MIN_SIZE | Application minimum upload size in BYTES | YES | 0 [0KB]
|
||||
| APP_DOWNLOAD_TIME | Time to wait until file downloads | YES | 30 (in seconds)
|
||||
|
||||
40
index.php
40
index.php
@@ -1,9 +1,7 @@
|
||||
<?php
|
||||
require_once(__DIR__ . '/system/core.class.php');
|
||||
session_start();
|
||||
|
||||
// size converter
|
||||
|
||||
require_once(__DIR__ . '/system/config.php');
|
||||
// size convertor
|
||||
function sizeFormat($bytes){
|
||||
$kb = 1024;
|
||||
$mb = $kb * 1024;
|
||||
@@ -30,75 +28,63 @@ return $bytes . ' B';
|
||||
}
|
||||
|
||||
$maxsize = max_size;
|
||||
|
||||
$core = new Core();
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title><?= app_name; ?> - <?= app_desc; ?></title>
|
||||
<!-- for discord -->
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="<?= app_name; ?>" />
|
||||
<meta property="og:description" content="<?= app_desc; ?>" />
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="assets/main.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="wrapper">
|
||||
<?php if(!app_logoimage == ''){ ?>
|
||||
<img src="assets/images/logo.png">
|
||||
<?php }else{ ?>
|
||||
<img src="<?=app_logoimage?>">
|
||||
<?php } ?>
|
||||
<?php
|
||||
if(isset($_POST['submit'])){
|
||||
if($core->FileTypeVerification($_FILES["fileToUpload"])){
|
||||
if($core->FileSizeVerification($_FILES["fileToUpload"])){
|
||||
$newfilename = $core->FileNameConvertor($_FILES["fileToUpload"]);
|
||||
if($core->UploadFile($_FILES["fileToUpload"], $newfilename)){
|
||||
$destination = base64_encode(file_destination.'/'.$newfilename);
|
||||
?>
|
||||
<div class="notification success">
|
||||
Success ! Your file is available here: <a href="<?= file_url_destination.'/'.file_destination.'/'.$newfilename; ?>"><?= file_url_destination.'/'.file_destination.'/'.$newfilename; ?></a>
|
||||
Success ! Your file are available here: <a href="download.php?file=<?php echo $destination; ?>">download.php?file=<?php echo $destination; ?></a>
|
||||
</div>
|
||||
<?php
|
||||
}else{
|
||||
?>
|
||||
<div class="notification error">
|
||||
An error occured while trying to upload your file
|
||||
An error occured while trying to upload your file(s).
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}else{
|
||||
?>
|
||||
<div class="notification error">
|
||||
Your File Is Too Big
|
||||
Your file is too high/low.
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}else{
|
||||
?>
|
||||
<div class="notification error">
|
||||
Incorrect File Format
|
||||
Incorrect file format.
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
<form method="post" action="#" enctype="multipart/form-data">
|
||||
<form method="post" action="" enctype="multipart/form-data">
|
||||
<input type="file" name="fileToUpload">
|
||||
<p>Drag a file here or click to upload</p>
|
||||
<p>Drag your files here or click in this area - <?=sizeFormat($maxsize)?> Max</p>
|
||||
<button name="submit" type="submit">Upload</button>
|
||||
<ul>
|
||||
<li>Supported files: <?= FILELIST; ?></li>
|
||||
</ul>
|
||||
<br>
|
||||
<ul>
|
||||
<li>Maximum filesize: <?php echo sizeFormat($maxsize); ?></li>
|
||||
</ul>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
@@ -114,11 +100,9 @@ $(document).ready(function(){
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<?php if(!plausibledatadomain&&plausibledomain == ''){ ?>
|
||||
|
||||
<?php }else{ ?>
|
||||
|
||||
<?php if(plausibledomain&&plausibledatadomain == !null){ ?>
|
||||
<script defer data-domain="<?=plausibledatadomain?>" src="<?=plausibledomain?>/js/script.js"></script>
|
||||
<?php } ?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
1
latest.txt
Normal file
1
latest.txt
Normal file
@@ -0,0 +1 @@
|
||||
v1.0.0
|
||||
6
mounts.md
Normal file
6
mounts.md
Normal file
@@ -0,0 +1,6 @@
|
||||
## Volume Mounts
|
||||
<br>
|
||||
|
||||
| Mount | Description | Required
|
||||
| ------ | ------ | ------
|
||||
| /var/www/html/files | Files directory | YES
|
||||
@@ -9,6 +9,7 @@ $password = getenv('ADMIN_PASSWORD') ?? 'password';
|
||||
$appname = getenv('APP_NAME') ?? 'AnonUpload - Secure File Sharing';
|
||||
$appdesc = getenv('APP_DESC') ?? 'Secure and anonymous file sharing';
|
||||
$applogo = getenv('APP_LOGO_IMAGE') ?? 'assets/images/logo.png';
|
||||
$appcontact = getenv('APP_CONTACT_EMAIL');
|
||||
|
||||
// Plausible analytics
|
||||
$plausibledomain = getenv('PLAUSIBLE_DOMAIN');
|
||||
@@ -24,12 +25,15 @@ $baseurl = getenv('APP_BASE_URL') ?? $_SERVER['HTTP_HOST'];
|
||||
$maxsize = getenv('APP_MAX_SIZE') ?? (int)(ini_get('upload_max_filesize'));
|
||||
$minsize = getenv('APP_MIN_SIZE') ?? '0';
|
||||
|
||||
$waitfor = getenv('APP_DOWNLOAD_TIME');
|
||||
|
||||
define('email', $email);
|
||||
define('password', $password);
|
||||
|
||||
/* SEO */
|
||||
define('app_name', $appname);
|
||||
define('app_desc', $appdesc);
|
||||
|
||||
/* Upload Settings */
|
||||
define('app_logoimage', $applogo);
|
||||
define('FILELIST', $filelist);
|
||||
@@ -38,10 +42,16 @@ define('file_destination', $filedestination);
|
||||
define('file_url_destination', $baseurl);
|
||||
define('max_size', $maxsize);
|
||||
define('min_size', $minsize);
|
||||
define('app_contact_email', $appcontact);
|
||||
define('waitfor', $waitfor);
|
||||
|
||||
/* Analytics */
|
||||
define('plausibledomain', $plausibledomain);
|
||||
define('plausibledatadomain', $plausibledatadomain);
|
||||
define('plausible_embed', $plausibleembed);
|
||||
define('plausibleembedtoken', $plausibleembedtoken);
|
||||
/* version */
|
||||
define('version', 'v1.0.0'); // DO NOT FORGET TO CHANGE THIS
|
||||
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user