version stable

This commit is contained in:
Viicious 2018-06-24 22:03:29 +02:00
commit 11929a80b8
10 changed files with 264 additions and 228 deletions

2
app.js
View File

@ -56,7 +56,7 @@ app.use('/home', express.static(path.join(__dirname, 'dist')));
app.use('/main/:id', express.static(path.join(__dirname, 'dist'))); app.use('/main/:id', express.static(path.join(__dirname, 'dist')));
app.use('/login', express.static(path.join(__dirname, 'dist'))); app.use('/login', express.static(path.join(__dirname, 'dist')));
app.use('/signup', express.static(path.join(__dirname, 'dist'))); app.use('/signup', express.static(path.join(__dirname, 'dist')));
app.use('/download/:id', express.static(path.join(__dirname, 'dist')));
app.use('/api', api); app.use('/api', api);
app.set('view engine', 'pug'); app.set('view engine', 'pug');

View File

@ -35,8 +35,8 @@ var credentials = {
passphrase: 'titi' passphrase: 'titi'
}; };
//var server = https.createServer(credentials, app); var server = https.createServer(credentials, app);
var server = http.createServer(app); //var server = http.createServer(app);

View File

@ -249,6 +249,15 @@ router.post('/getUserById', function(req, res) {
}); });
}); });
router.post('/getFileById', function(req, res) {
console.log('yaa' + req.body.id);
FileMongo.find({
_id: req.body.id
}, function (err, file) {
res.json(file);
});
});
/* Login */ /* Login */
router.post('/signin', function(req, res) { router.post('/signin', function(req, res) {
User.findOne({ User.findOne({

View File

@ -68,7 +68,7 @@ const appRoutes: Routes = [
data: { title: 'Sign Up' } data: { title: 'Sign Up' }
}, },
{ {
path: 'download', path: 'download/:id',
component: DownloadLinkComponent , component: DownloadLinkComponent ,
data: { title: 'download' } data: { title: 'download' }
}, },

View File

@ -345,14 +345,14 @@
<i class="fa unlock-alt" aria-hidden="true"></i> <i class="fa unlock-alt" aria-hidden="true"></i>
<i class="fa unlock" aria-hidden="true"></i> <i class="fa unlock" aria-hidden="true"></i>
<div class="md-form"> <div class="md-form">
<input value="http://localhost:3000/{{file.url}}" disabled="disabled" type="text" id="shareLink" class="form-control" mdbInputDirective> <input value="https://localhost:3000/download/{{file._id.toString()}}" disabled="disabled" type="text" id="shareLink" class="form-control" mdbInputDirective>
<label for="shareLink">Link</label> <label for="shareLink">Link</label>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div class="modal-footer justify-content-center"> <div class="modal-footer justify-content-center">
<a type="button" class="btn btn-secondary waves-light" (click)="copyLink(file.url)" mdbWavesEffect>Copy Link <i class="fa fa-copy ml-1" aria-hidden="true"></i></a> <a type="button" class="btn btn-secondary waves-light" (click)="copyLink(file._id.toString())" mdbWavesEffect>Copy Link <i class="fa fa-copy ml-1" aria-hidden="true"></i></a>
</div> </div>
</div> </div>
</div> </div>

View File

@ -95,7 +95,7 @@ export class BookComponent implements OnInit, OnDestroy {
selBox.style.left = '0'; selBox.style.left = '0';
selBox.style.top = '0'; selBox.style.top = '0';
selBox.style.opacity = '0'; selBox.style.opacity = '0';
selBox.value = 'http://localhost:3000/' + val; selBox.value = 'https://localhost:3000/download/' + val;
document.body.appendChild(selBox); document.body.appendChild(selBox);
selBox.focus(); selBox.focus();
@ -264,7 +264,6 @@ export class BookComponent implements OnInit, OnDestroy {
f.data = f.url; f.data = f.url;
f.urlSafe = this.sanitizer.bypassSecurityTrustResourceUrl(f.url); f.urlSafe = this.sanitizer.bypassSecurityTrustResourceUrl(f.url);
} }
} }
} else { } else {
this.allUserFile = []; this.allUserFile = [];

View File

@ -3,6 +3,10 @@
<logo> <logo>
<a class="logo navbar-brand waves-light" mdbWavesEffect href="#"><strong>SupFile</strong></a> <a class="logo navbar-brand waves-light" mdbWavesEffect href="#"><strong>SupFile</strong></a>
</logo> </logo>
<links>
<ul class="navbar-nav mr-auto">
</ul>
</links>
</mdb-navbar> </mdb-navbar>
<section class="view intro-2 mask rgba-gradient"> <section class="view intro-2 mask rgba-gradient">
@ -29,16 +33,15 @@
<i class="fa fa-file fa-4x" aria-hidden="true"></i> <i class="fa fa-file fa-4x" aria-hidden="true"></i>
</div> </div>
<div class="col-md-6"> <div class="col-md-6">
<p><strong>Name</strong></p> <p><strong>{{file?.name}}</strong></p>
<p>Lenght</p> <p>{{ file?.taille / ( 1024 * 1024 ) | number : '1.2-2'}} Mo</p>
</div> </div>
</div> </div>
</div> </div>
<hr class="hr-light mb-3 mt-4"> <hr class="hr-light mb-3 mt-4">
<button class="btn btn-outline-white wow fadeInleft waves-light">Download</button> <button class="btn btn-outline-white wow fadeInleft waves-light"><a class="text-white" href="{{file?.url}}" download="{{ file?.name.toString()}}">Download</a></button>
</div> </div>
<!--/.Card content--> <!--/.Card content-->
</div> </div>

View File

@ -1,4 +1,7 @@
import { Component, OnInit } from '@angular/core'; import { Component, OnInit } from '@angular/core';
import { Router, ActivatedRoute } from '@angular/router';
import {HttpClient} from '@angular/common/http';
@Component({ @Component({
selector: 'app-download-link', selector: 'app-download-link',
@ -6,8 +9,30 @@ import { Component, OnInit } from '@angular/core';
styleUrls: ['./download-link.component.scss'] styleUrls: ['./download-link.component.scss']
}) })
export class DownloadLinkComponent implements OnInit { export class DownloadLinkComponent implements OnInit {
idFile: String;
urlFile: String;
file: any;
constructor() { } constructor(private http: HttpClient, private router: Router, private route: ActivatedRoute) {
this.idFile = '';
this.urlFile = '';
this.route.params.subscribe(params => {
this.idFile = params['id'];
this.urlFile = 'http://localhost:3000/' + this.idFile;
console.log('this.idFile : ' + this.idFile );
this.http.post('/api/getFileById', {id: this.idFile.toString()}).subscribe(file => {
if (file) {
this.file = file[0];
console.log(this.file)
} else {
this.file = [];
}
});
});
}
ngOnInit() { ngOnInit() {
} }

View File

@ -73,8 +73,8 @@ export class HomeComponent implements OnInit {
ngOnInit() { ngOnInit() {
setTimeout(() => setTimeout(() =>
{ {
this.showCookies();); this.showCookies();
}, 1000); }, 1000); ;
} }
} }

View File

@ -13,7 +13,7 @@
<!-- Logo --> <!-- Logo -->
<li> <li>
<div class="logo-wrapper flex-center waves-light" style="padding-bottom: 5%"> <div class="logo-wrapper flex-center waves-light" style="padding-bottom: 5%">
<a href="#"><img style="height: 90px; margin-left: 13%;"src="../../assets/logo%20supfile.png" class="img-fluid flex-center"></a> <a href="#"><img style="height: 90px; margin-left: 13%;"src="../../assets/logoSupfile.png" class="img-fluid flex-center"></a>
</div> </div>
</li> </li>
<!--/. Logo --> <!--/. Logo -->