Compare commits
65 Commits
Author | SHA1 | Date |
---|---|---|
Tmadkaud | 5c2fbcb806 | 6 years ago |
Tmadkaud | 599dad6313 | 6 years ago |
Viicious | 11929a80b8 | 6 years ago |
Viicious | 42ba471be6 | 6 years ago |
Tmadkaud | 10865599e1 | 6 years ago |
Viicious | ce32f6c28a | 6 years ago |
Viicious | 5d94f865ce | 6 years ago |
Tmadkaud | 2905047311 | 6 years ago |
Tmadkaud | 88d24f1c14 | 6 years ago |
Viiciouss | 4595373cca | 6 years ago |
Viiciouss | 1e87f74650 | 6 years ago |
Tmadkaud | 3e7a83f168 | 6 years ago |
Tmadkaud | 6a7f64c044 | 6 years ago |
Viiciouss | 1eed323f1f | 6 years ago |
Viiciouss | 8b79d71ddf | 6 years ago |
Tmadkaud | c85b69a88d | 6 years ago |
Tmadkaud | 47a11b87ef | 6 years ago |
Viiciouss | a25afca8d4 | 6 years ago |
Viiciouss | 26dc279a9b | 6 years ago |
Tmadkaud | 4f7c77dddb | 6 years ago |
Tmadkaud | 8b3ccd333b | 6 years ago |
Viiciouss | 4772a3f798 | 6 years ago |
Viiciouss | c49ea317c8 | 6 years ago |
Tmadkaud | dbdbd5fe39 | 6 years ago |
Viiciouss | f0bc36a327 | 6 years ago |
Viiciouss | 3a4053f72f | 6 years ago |
Tmadkaud | 2cd2ee75e0 | 6 years ago |
Viicious | 546c5ac4cf | 6 years ago |
Viicious | f139b003d3 | 6 years ago |
Viicious | 24320d063a | 6 years ago |
Viicious | efc5bb5c18 | 6 years ago |
Viicious | d60a888771 | 6 years ago |
Tmadkaud | 3237eb66e7 | 6 years ago |
Viicious | d06f323c9e | 6 years ago |
Tmadkaud | 5d1960cd6e | 6 years ago |
Viicious | cb0543d590 | 6 years ago |
Tmadkaud | c1091339b9 | 6 years ago |
Viicious | 0b8c76b310 | 6 years ago |
Tmadkaud | f7d864bf98 | 6 years ago |
Tmadkaud | d3a5b25377 | 6 years ago |
Viicious | f6f3b85226 | 6 years ago |
Tmadkaud | 8de527f186 | 6 years ago |
Viicious | 67f2d390d1 | 6 years ago |
Cécilia Bourvieux | 98b837065b | 6 years ago |
Tmadkaud | 3c305686c1 | 6 years ago |
Tmadkaud | 147a1d4d7d | 6 years ago |
Tmadkaud | d8c540d151 | 6 years ago |
Tmadkaud | 02bffcd04a | 6 years ago |
Tmadkaud | 2afd8e9e73 | 6 years ago |
Tmadkaud | 6b6f73ed6a | 6 years ago |
Tmadkaud | 236e49ec4a | 6 years ago |
Tmadkaud | 22da6d895f | 6 years ago |
Tmadkaud | e1bf54f896 | 6 years ago |
Tmadkaud | ce48ce33eb | 6 years ago |
Tmadkaud | 5a91dda627 | 6 years ago |
Viiciouss | 1fa02b42d8 | 6 years ago |
Tmadkaud | 650b013c55 | 6 years ago |
Viiciouss | a3a91f0e4b | 6 years ago |
Tmadkaud | c1942ab535 | 6 years ago |
Tmadkaud | 0c295d27b3 | 6 years ago |
Tmadkaud | da96cc7f0e | 6 years ago |
Viiciouss | 87a22abf95 | 6 years ago |
Tmadkaud | 495c1d309a | 6 years ago |
Viiciouss | 3d110313f7 | 6 years ago |
Anis Vicious | 5b4595a032 | 6 years ago |
@ -0,0 +1,117 @@
|
|||||||
|
var passport = require('passport');
|
||||||
|
var FacebookStrategy = require('passport-facebook').Strategy;
|
||||||
|
var User = require('../models/user');
|
||||||
|
var jwt = require('jsonwebtoken');
|
||||||
|
var config = require('../config/database');
|
||||||
|
|
||||||
|
var mongoose = require('mongoose');
|
||||||
|
|
||||||
|
|
||||||
|
passport.serializeUser((user, done) => {
|
||||||
|
done(null, user.id);
|
||||||
|
});
|
||||||
|
|
||||||
|
passport.deserializeUser((id, done) => {
|
||||||
|
// console.log(`id: ${id}`);
|
||||||
|
User.findById(id)
|
||||||
|
.then(user => {
|
||||||
|
done(null, user);
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
console.log(`Error: ${error}`);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
passport.use(new FacebookStrategy({
|
||||||
|
clientID: "191092458179642",
|
||||||
|
clientSecret: "964e490d7e49a13ee7a77c9b65419fb3",
|
||||||
|
callbackURL: "https://localhost:3000/api/facebook/callback",
|
||||||
|
proxy: true
|
||||||
|
},
|
||||||
|
function(accessToken, refreshToken, profile, done) {
|
||||||
|
console.log('facebook findOneOrCreate'+profile.displayName);
|
||||||
|
|
||||||
|
User.findOne({
|
||||||
|
username: profile.displayName
|
||||||
|
}, function(err, user) {
|
||||||
|
if(user){
|
||||||
|
console.log('findOneOrCreate ok'+user.username);
|
||||||
|
var token = jwt.sign(user.toJSON(), config.secret);
|
||||||
|
// return the information including token as JSON
|
||||||
|
//res.json({success: true, token: });
|
||||||
|
return done(null, user);
|
||||||
|
}else{
|
||||||
|
|
||||||
|
var newUser = new User({
|
||||||
|
username: profile.displayName,
|
||||||
|
password: profile.password,
|
||||||
|
social: true
|
||||||
|
});
|
||||||
|
// save the user
|
||||||
|
newUser.save(function(err) {
|
||||||
|
if (err) {
|
||||||
|
console.log('Username already exists.');
|
||||||
|
}
|
||||||
|
return done(null, user);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// User.findOneOrCreate(profile.displayName.toString(), function(err, user, req, res) {
|
||||||
|
// if (err) {
|
||||||
|
// console.log('findOneOrCreate err');
|
||||||
|
// console.log(err);
|
||||||
|
// return done(err);
|
||||||
|
// }
|
||||||
|
// console.log('findOneOrCreate ok'+user.displayName);
|
||||||
|
// //res.json({token: accessToken, user: user.username});
|
||||||
|
// done(null, user);
|
||||||
|
// });
|
||||||
|
// Page.findOneOrCreate(pageId, (err, page)=>{
|
||||||
|
// if(err){
|
||||||
|
// //if theres an error, do something
|
||||||
|
// }
|
||||||
|
// // or do something with the page
|
||||||
|
// })
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// Page.findOneOrCreate(profile.id, (err, page)=>{
|
||||||
|
// if(err){
|
||||||
|
// //if theres an error, do something
|
||||||
|
// }
|
||||||
|
// // or do something with the page
|
||||||
|
// })
|
||||||
|
}
|
||||||
|
// function(accessToken, refreshToken, profile, done) {
|
||||||
|
// console.log('yaaauuu : ' + accessToken + ' ----- ' + profile.displayName + ' ----- ' + profile.id);
|
||||||
|
// //done(null, {profile, accessToken});
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// var newUser = new User({
|
||||||
|
// username: req.body.username,
|
||||||
|
// password: req.body.password
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
// User.save(newUser, function(err, user) {
|
||||||
|
// if (err) {
|
||||||
|
// console.log('yaaauuu err : ' + err);
|
||||||
|
// return done(err);
|
||||||
|
// }
|
||||||
|
// console.log('yaaauuu : ');
|
||||||
|
// done(null, user);
|
||||||
|
// });
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// /*
|
||||||
|
// User.findOrCreate({username: profile.displayName}, {username: profile.displayName, id: profile.id}, function(err, user) {
|
||||||
|
// console.log('yaaauuu err : ' + ' ----- ' + err );
|
||||||
|
//
|
||||||
|
// console.log('yaaauuu user : ' + ' ----- ' + JSON.stringify(user));
|
||||||
|
// if (err) { return done(err); }
|
||||||
|
// done(null, user);
|
||||||
|
// });*/
|
||||||
|
// }
|
||||||
|
));
|
||||||
|
module.exports = passport;
|
@ -0,0 +1,16 @@
|
|||||||
|
var passport = require('passport');
|
||||||
|
var GitHubStrategy = require('passport-github').Strategy;
|
||||||
|
|
||||||
|
passport.use(new GitHubStrategy({
|
||||||
|
clientID: "60a0296da9fce6ca3b7e",
|
||||||
|
clientSecret: "9fb2f52123d9d840c98b98b3b4ffbc5dd77d1de3",
|
||||||
|
callbackURL: "https://localhost:3000/api/github/callback"
|
||||||
|
},
|
||||||
|
function(accessToken, refreshToken, profile, done) {
|
||||||
|
User.findOrCreate({userid: profile.id}, {name: profile.displayName,userid: profile.id}, function (err, user) {
|
||||||
|
return done(err, user);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
module.exports = passport;
|
@ -0,0 +1,16 @@
|
|||||||
|
var passport = require('passport');
|
||||||
|
var GoogleStrategy = require('passport-google-oauth').OAuth2Strategy;
|
||||||
|
|
||||||
|
passport.use(new GoogleStrategy({
|
||||||
|
clientID: "633754977454-7dcfrsfob7sjq5lim47tc63pdjch6imr.apps.googleusercontent.com",
|
||||||
|
clientSecret: "D7lHcUgZbCpmWZtooRlICzAH",
|
||||||
|
callbackURL: "https://localhost:3000/api/google/callback"
|
||||||
|
},
|
||||||
|
function(accessToken, refreshToken, profile, done) {
|
||||||
|
User.findOrCreate({ userid: profile.id }, { name: profile.displayName,userid: profile.id }, function (err, user) {
|
||||||
|
return done(err, user);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
));
|
||||||
|
|
||||||
|
module.exports = passport;
|
@ -0,0 +1,18 @@
|
|||||||
|
-----BEGIN CERTIFICATE-----
|
||||||
|
MIIC+zCCAeOgAwIBAgIJAO3X6jDQ6/7tMA0GCSqGSIb3DQEBCwUAMBQxEjAQBgNV
|
||||||
|
BAMMCWxvY2FsaG9zdDAeFw0xODA2MDYyMDIzMjFaFw0xOTA2MDYyMDIzMjFaMBQx
|
||||||
|
EjAQBgNVBAMMCWxvY2FsaG9zdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
|
||||||
|
ggEBANSGX3ctyJLmCMFLsWiw4fMSv+W+XtoQx+oEqmPKEoDWtQbO/nchywYTlIK8
|
||||||
|
H9nDBthYMhNSfmvEilxGRBerV7McjU2zKBsvncyFMSnie3LVtAzd39lHUXKNhybI
|
||||||
|
6veIEnthau37JblClcKIxVqE6Xk2sQYFWyB1XvioEMKFjrKyx/cHcKknl5Ykwtrl
|
||||||
|
B9pkGQ3KMJt+IsnTPUeEiS2uI1kaNLLM0ayosVcVShu1F/x5D6549K55nacrUpHP
|
||||||
|
L5npOvWIb2ZS6RhiltAd6/GShkzmDsIMpRQftg+RvfKlFxf1+ORYYpyXMyY/zf99
|
||||||
|
lt8kn/1HUAuu6Dp9+bo9vKkqee8CAwEAAaNQME4wHQYDVR0OBBYEFOR+9mbmaift
|
||||||
|
SDIznQ9xw2ujOqWZMB8GA1UdIwQYMBaAFOR+9mbmaiftSDIznQ9xw2ujOqWZMAwG
|
||||||
|
A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBAJB2VSmDSAYhb872rH0EYNn0
|
||||||
|
13WYkBgO9NNbgkgx1wcTA8qD02544wGsreuuKRtx6sn5JahoUTSpZvMkBE4t9SdQ
|
||||||
|
TCneDp/0Bm55b1m5Pu/EwoOoadZq7UGU1yL0BdiMzfVRsokR9zOBxDyIUrbCKWDZ
|
||||||
|
6glVHLC0O8ZJAqzkn/8kZPSdHdZ0Ql64k8swVdjFROjkL74sopvtyfpxQVq9vi5r
|
||||||
|
CTlxnC+aDtYt8CEYjxjHdsAAhA4NxntTenSO3HPQz/3qGCE5RC/qMgBzU7mf0kxU
|
||||||
|
l7qbeudfYQ2MLRGucsR+LwraR93iagi5VMHsYv5mVDA/zWGhXfTNS3tMk4pi6us=
|
||||||
|
-----END CERTIFICATE-----
|
@ -0,0 +1,30 @@
|
|||||||
|
-----BEGIN ENCRYPTED PRIVATE KEY-----
|
||||||
|
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
|
||||||
|
EVk=
|
||||||
|
-----END ENCRYPTED PRIVATE KEY-----
|
@ -0,0 +1,31 @@
|
|||||||
|
var mongoose = require('mongoose');
|
||||||
|
var Schema = mongoose.Schema;
|
||||||
|
|
||||||
|
var ChunkFileSaveMongo = new Schema({
|
||||||
|
uid: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
fieldname: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
files_id: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
n: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
data: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
id: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = mongoose.model('ChunkFileSaveMongo', ChunkFileSaveMongo, 'fs.chunks');
|
@ -0,0 +1,30 @@
|
|||||||
|
var mongoose = require('mongoose');
|
||||||
|
var Schema = mongoose.Schema;
|
||||||
|
|
||||||
|
var ChunkFileSaveMongo = new Schema({
|
||||||
|
uid: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
fieldname: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
files_id: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
n: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
data: [{
|
||||||
|
type: String
|
||||||
|
}],
|
||||||
|
id: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = mongoose.model('ChunkFileSaveMongo', ChunkFileSaveMongo, 'fs.chunks');
|
@ -0,0 +1,63 @@
|
|||||||
|
var mongoose = require('mongoose');
|
||||||
|
var Schema = mongoose.Schema;
|
||||||
|
|
||||||
|
var FileSaveMongoShema = new Schema({
|
||||||
|
uid: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
fieldname: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
originalname: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
encoding: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
mimetype: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
id: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
filename: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
metadata: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
bucketName: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
chunkSize: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
md5: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
uploadDate: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
contentType: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = mongoose.model('FileSaveMongo', FileSaveMongoShema, 'fs.files');
|
@ -0,0 +1,51 @@
|
|||||||
|
var mongoose = require('mongoose');
|
||||||
|
var Schema = mongoose.Schema;
|
||||||
|
|
||||||
|
var FolderMongoShema = new Schema({
|
||||||
|
uid: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
name: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
path: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
taille: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
parent: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
fileList: {
|
||||||
|
type: [],
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
folderList: {
|
||||||
|
type: [],
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
idUser: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
owner: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
lastDate: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
},
|
||||||
|
createDate: {
|
||||||
|
type: String,
|
||||||
|
unique: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = mongoose.model('FolderMongo', FolderMongoShema);
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"/api": {
|
||||||
|
"target": "http://localhost:3000",
|
||||||
|
"secure": false
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
Before Width: | Height: | Size: 179 KiB |
@ -0,0 +1,208 @@
|
|||||||
|
.topcard {
|
||||||
|
padding-top: 1%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topButtons {
|
||||||
|
margin-top: 2%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.topButtonsRow {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.app-title {
|
||||||
|
font-size: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box-title {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.box-container {
|
||||||
|
/*display: none;*/
|
||||||
|
/*position: fixed;*/
|
||||||
|
box-sizing: border-box;
|
||||||
|
/*margin-left: 2%;*/
|
||||||
|
border-radius: 4px;
|
||||||
|
opacity: 0.7;
|
||||||
|
color: #555;
|
||||||
|
background-color: #eee;
|
||||||
|
box-shadow:
|
||||||
|
0 6px 20px rgba(0, 0, 0, 0.18),
|
||||||
|
0 6px 6px rgba(0, 0, 0, 0.25);
|
||||||
|
}
|
||||||
|
|
||||||
|
.info-container {
|
||||||
|
padding: 12px 16px;
|
||||||
|
|
||||||
|
line-height: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-container,
|
||||||
|
.dropzone {
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
overflow: auto;
|
||||||
|
height: 75%;
|
||||||
|
min-height: 0;
|
||||||
|
padding: 16px;
|
||||||
|
margin: 8px 16px;
|
||||||
|
border-radius: 4px;
|
||||||
|
|
||||||
|
background-color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-button {
|
||||||
|
box-sizing: border-box;
|
||||||
|
width: calc(100% - 16px);
|
||||||
|
min-height: 35px;
|
||||||
|
padding: 4px 16px;
|
||||||
|
margin: 8px;
|
||||||
|
border: 1px solid #555;
|
||||||
|
border-radius: 4px;
|
||||||
|
|
||||||
|
cursor: pointer;
|
||||||
|
font-size: 14px;
|
||||||
|
font-weight: bold;
|
||||||
|
line-height: 14px;
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-button:hover {
|
||||||
|
color: #fff;
|
||||||
|
background-color: #555;
|
||||||
|
}
|
||||||
|
|
||||||
|
.dropzone-container {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
*::after,
|
||||||
|
*::before {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
box-sizing: border-box
|
||||||
|
}
|
||||||
|
html,
|
||||||
|
body {
|
||||||
|
font: 100% 'Arimo', sans-serif;
|
||||||
|
}
|
||||||
|
.filter-wrapper,
|
||||||
|
.keyword-wrapper {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.filter-wrapper {
|
||||||
|
min-height: 100%;
|
||||||
|
flex-flow: column wrap;;
|
||||||
|
position: relative
|
||||||
|
}
|
||||||
|
.keyword-wrapper {
|
||||||
|
width: 100%;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
#keyword {
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
padding: 10px;
|
||||||
|
font: 1.5em 'Arimo', sans-serif;
|
||||||
|
width: 50%;
|
||||||
|
outline: none;
|
||||||
|
transition: border 0.5s ease-in-out
|
||||||
|
}
|
||||||
|
#keyword:focus {
|
||||||
|
border-color : rgba(81, 203, 238, 1);;
|
||||||
|
}
|
||||||
|
#keyword-button {
|
||||||
|
position: absolute;
|
||||||
|
right: 26%;
|
||||||
|
top: 50%;
|
||||||
|
transform: translateY(-50%);
|
||||||
|
font-size: 1.7em;
|
||||||
|
color: #8DB9ED
|
||||||
|
}
|
||||||
|
#keyword-button:hover {
|
||||||
|
color: #ccc
|
||||||
|
}
|
||||||
|
.filter-select {
|
||||||
|
width: 50%;
|
||||||
|
list-style: none;
|
||||||
|
font-size: 1.1em;
|
||||||
|
color: rgb(105, 105, 105);
|
||||||
|
border: 1px solid #ccc;
|
||||||
|
border-top: none;
|
||||||
|
/*so things don't jump around*/
|
||||||
|
position: absolute;
|
||||||
|
left: 25%;
|
||||||
|
top: calc(50% + 25px);
|
||||||
|
max-height: calc(50% - 15px);
|
||||||
|
overflow-y: auto;
|
||||||
|
background: #fff
|
||||||
|
}
|
||||||
|
.filter-select-list img {
|
||||||
|
margin-right: 30px;
|
||||||
|
}
|
||||||
|
.tags {
|
||||||
|
font-size: 12px;
|
||||||
|
font-style: italic;
|
||||||
|
color: #c6c6c6;
|
||||||
|
margin-right: 10px;
|
||||||
|
position: relative;
|
||||||
|
top: -10px;
|
||||||
|
}
|
||||||
|
.filter-select-list:hover .tags {
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
.filter-select-list {
|
||||||
|
cursor: pointer;
|
||||||
|
padding: 5px 10px;
|
||||||
|
}
|
||||||
|
.artist-name {
|
||||||
|
display: inline-block;
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
.filter-select-list:hover {
|
||||||
|
background: #C0C0C0;
|
||||||
|
color: #fff
|
||||||
|
}
|
||||||
|
.list-highlight,
|
||||||
|
.list-highlight:hover {
|
||||||
|
background: rgb(55, 55, 55);
|
||||||
|
color: #fff
|
||||||
|
}
|
||||||
|
@media only screen and (max-width: 768px) {
|
||||||
|
.filter-select,
|
||||||
|
#keyword {
|
||||||
|
width: 80%;
|
||||||
|
}
|
||||||
|
#keyword {
|
||||||
|
font-size: 1.3em
|
||||||
|
}
|
||||||
|
.filter-select {
|
||||||
|
font-size: 0.9em;
|
||||||
|
left: 10%;
|
||||||
|
top: calc(50% + 23px);
|
||||||
|
}
|
||||||
|
#keyword-button {
|
||||||
|
right: 11%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@media only screen and (max-width: 480px) {
|
||||||
|
.filter-select,
|
||||||
|
#keyword {
|
||||||
|
width: 95%;
|
||||||
|
}
|
||||||
|
.filter-select {
|
||||||
|
left: 2.5%;
|
||||||
|
}
|
||||||
|
#keyword-button {
|
||||||
|
right: 3.5%
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#cookiesModal {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,55 @@
|
|||||||
|
<!--Navbar-->
|
||||||
|
<mdb-navbar SideClass="navbar navbar-expand-lg navbar-dark fixed-top scrolling-navbar indigo">
|
||||||
|
<logo>
|
||||||
|
<a class="logo navbar-brand waves-light" mdbWavesEffect href="#"><strong>SupFile</strong></a>
|
||||||
|
</logo>
|
||||||
|
<links>
|
||||||
|
<ul class="navbar-nav mr-auto">
|
||||||
|
</ul>
|
||||||
|
</links>
|
||||||
|
</mdb-navbar>
|
||||||
|
|
||||||
|
<section class="view intro-2 mask rgba-gradient">
|
||||||
|
<div class="container-fluid full-bg-img mask rgba-gradient">
|
||||||
|
<!--Grid column-->
|
||||||
|
<div class="col-lg-6 col-md-8">
|
||||||
|
|
||||||
|
<!--Card-->
|
||||||
|
<div class="card text-white card-cascade narrower card-image">
|
||||||
|
|
||||||
|
<div class="text-white text-center align-items-center">
|
||||||
|
<!--Card image-->
|
||||||
|
<div class="card-header text-center">
|
||||||
|
<h2 class="h2-responsive">File Download</h2>
|
||||||
|
</div>
|
||||||
|
<!--/Card image-->
|
||||||
|
|
||||||
|
|
||||||
|
<!--Card content-->
|
||||||
|
<div class="card-body text-center">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-6">
|
||||||
|
<i class="fa fa-file fa-4x" aria-hidden="true"></i>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-6">
|
||||||
|
<p><strong>{{file?.name}}</strong></p>
|
||||||
|
<p>{{ file?.taille / ( 1024 * 1024 ) | number : '1.2-2'}} Mo</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr class="hr-light mb-3 mt-4">
|
||||||
|
|
||||||
|
<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>
|
||||||
|
<!--/.Card content-->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!--/.Card-->
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<!--Grid column-->
|
||||||
|
</div>
|
||||||
|
</section>
|
@ -0,0 +1,44 @@
|
|||||||
|
.container-fluid {
|
||||||
|
position: absolute;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.card-body {
|
||||||
|
margin-top: 5rem;
|
||||||
|
margin-bottom: 3rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.intro-2 {
|
||||||
|
background: url("http://mdbootstrap.com/img/Photos/Others/img%20(42).jpg")no-repeat center center;
|
||||||
|
background-size: cover;
|
||||||
|
background-attachment: fixed;
|
||||||
|
}
|
||||||
|
.view {
|
||||||
|
height: 100vh !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 740px) {
|
||||||
|
.full-height,
|
||||||
|
.full-height body,
|
||||||
|
.full-height header,
|
||||||
|
.full-height header .view {
|
||||||
|
height: 1040px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.rgba-gradient .full-bg-img {
|
||||||
|
background: linear-gradient(45deg, rgba(83, 125, 210, 0.4), rgba(178, 30, 123, 0.4) 100%);
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
background-color: rgba(229, 228, 255, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-form .prefix {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
.md-form label {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { DownloadLinkComponent } from './download-link.component';
|
||||||
|
|
||||||
|
describe('DownloadLinkComponent', () => {
|
||||||
|
let component: DownloadLinkComponent;
|
||||||
|
let fixture: ComponentFixture<DownloadLinkComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ DownloadLinkComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(DownloadLinkComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,40 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
|
import {HttpClient} from '@angular/common/http';
|
||||||
|
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-download-link',
|
||||||
|
templateUrl: './download-link.component.html',
|
||||||
|
styleUrls: ['./download-link.component.scss']
|
||||||
|
})
|
||||||
|
export class DownloadLinkComponent implements OnInit {
|
||||||
|
idFile: String;
|
||||||
|
urlFile: String;
|
||||||
|
file: any;
|
||||||
|
|
||||||
|
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() {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,67 @@
|
|||||||
|
.header {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.features {
|
||||||
|
padding: 5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.intro-2 {
|
||||||
|
background: url("http://mdbootstrap.com/img/Photos/Others/img%20(42).jpg")no-repeat center center;
|
||||||
|
background-size: cover;
|
||||||
|
background-attachment: fixed
|
||||||
|
}
|
||||||
|
.view {
|
||||||
|
height: 100vh !important;
|
||||||
|
}
|
||||||
|
.navbar.scrolling-navbar.top-nav-collapse {
|
||||||
|
background: indigo;
|
||||||
|
}
|
||||||
|
.rgba-gradient .full-bg-img {
|
||||||
|
background: linear-gradient(45deg, rgba(83, 125, 210, 0.4), rgba(178, 30, 123, 0.4) 100%);
|
||||||
|
}
|
||||||
|
.card {
|
||||||
|
background-color: rgba(229, 228, 255, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.md-form .prefix {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
margin-top: 1rem;
|
||||||
|
}
|
||||||
|
.md-form label {
|
||||||
|
color: #ffffff;
|
||||||
|
}
|
||||||
|
h6 {
|
||||||
|
line-height: 1.7;
|
||||||
|
}
|
||||||
|
@media (max-width: 740px) {
|
||||||
|
.full-height,
|
||||||
|
.full-height body,
|
||||||
|
.full-height header,
|
||||||
|
.full-height header .view {
|
||||||
|
height: 1040px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-check {
|
||||||
|
padding-left: 0;
|
||||||
|
padding-top: 1.2rem;
|
||||||
|
padding-bottom: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.priceList {
|
||||||
|
padding: 10%;
|
||||||
|
padding-top: 0%;
|
||||||
|
padding-bottom: 5%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#rules {
|
||||||
|
margin-left: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
#cookiesModal {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { HomeComponent } from './home.component';
|
||||||
|
|
||||||
|
describe('HomeComponent', () => {
|
||||||
|
let component: HomeComponent;
|
||||||
|
let fixture: ComponentFixture<HomeComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ HomeComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(HomeComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,80 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { HttpClient } from '@angular/common/http';
|
||||||
|
import { Router } from "@angular/router";
|
||||||
|
import { Observable } from 'rxjs/Observable';
|
||||||
|
import { tap, catchError } from 'rxjs/operators';
|
||||||
|
import { of } from 'rxjs/observable/of';
|
||||||
|
@Component({
|
||||||
|
selector: 'app-home',
|
||||||
|
templateUrl: './home.component.html',
|
||||||
|
styleUrls: ['./home.component.scss']
|
||||||
|
})
|
||||||
|
export class HomeComponent implements OnInit {
|
||||||
|
registerbool: boolean;
|
||||||
|
toggleButton: boolean
|
||||||
|
signupData = { username:'', password:'' };
|
||||||
|
loginData = { username: '', password: '' };
|
||||||
|
message = '';
|
||||||
|
messageR = '';
|
||||||
|
data: any;
|
||||||
|
test: any;
|
||||||
|
|
||||||
|
constructor(private http: HttpClient, private router: Router) {
|
||||||
|
this.registerbool = false;
|
||||||
|
this.toggleButton = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
showregister() {
|
||||||
|
this.registerbool = !this.registerbool;
|
||||||
|
}
|
||||||
|
|
||||||
|
toggleCheckbox() {
|
||||||
|
this.toggleButton = !this.toggleButton;
|
||||||
|
}
|
||||||
|
|
||||||
|
login() {
|
||||||
|
this.http.post('/api/signin', this.loginData).subscribe(resp => {
|
||||||
|
this.data = resp;
|
||||||
|
localStorage.setItem('jwtToken', this.data.token);
|
||||||
|
this.router.navigate(['main', this.data.token]);
|
||||||
|
}, err => {
|
||||||
|
this.message = err.error.msg;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
signup() {
|
||||||
|
this.http.post('/api/signup',this.signupData).subscribe(resp => {
|
||||||
|
this.showregister();
|
||||||
|
}, err => {
|
||||||
|
this.messageR = err.error.msg;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
facebook() {
|
||||||
|
console.log('teteeeeeeee');
|
||||||
|
this.http.get('/api/facebook').subscribe(resp => {
|
||||||
|
this.router.navigate(['main']);
|
||||||
|
}, err => {
|
||||||
|
this.message = err.error.msg;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
showCookies() {
|
||||||
|
document.getElementById('openModalButton').click();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
setTimeout(() =>
|
||||||
|
{
|
||||||
|
this.showCookies();
|
||||||
|
}, 1000); ;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,120 @@
|
|||||||
|
<body class="indigo-skin">
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!--Double navigation-->
|
||||||
|
<header>
|
||||||
|
|
||||||
|
<!-- Sidebar navigation -->
|
||||||
|
<mdb-sidenav #sidenav class="sn-bg-4 fixed" [fixed]="true">
|
||||||
|
|
||||||
|
<logo>
|
||||||
|
<!-- Logo -->
|
||||||
|
<li>
|
||||||
|
<div class="logo-wrapper flex-center waves-light" style="padding-bottom: 5%">
|
||||||
|
<a href="#"><img style="height: 90px; margin-left: 13%;"src="../../assets/logoSupfile.png" class="img-fluid flex-center"></a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<!--/. Logo -->
|
||||||
|
</logo>
|
||||||
|
|
||||||
|
<links>
|
||||||
|
<!--Social-->
|
||||||
|
<li>
|
||||||
|
<ul class="social">
|
||||||
|
<li><a class="icons-sm fb-ic" href="https://www.facebook.com/ArcadiaDev"><i class="fa fa-facebook"> </i></a></li>
|
||||||
|
<li><a class="icons-sm gplus-ic"><i class="fa fa-google-plus"> </i></a></li>
|
||||||
|
<li><a class="icons-sm tw-ic"><i class="fa fa-twitter"> </i></a></li>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<!--/Social-->
|
||||||
|
<!--Search Form-->
|
||||||
|
<!--<li>-->
|
||||||
|
<!--<form class="search-form" role="search">-->
|
||||||
|
<!--<div class="form-group md-form mt-0 pt-1 waves-light" mdbWavesEffect>-->
|
||||||
|
<!--<input type="text" class="form-control" placeholder="Search">-->
|
||||||
|
<!--</div>-->
|
||||||
|
<!--</form>-->
|
||||||
|
<!--</li>-->
|
||||||
|
<!--/.Search Form-->
|
||||||
|
<!-- Side navigation links -->
|
||||||
|
<li>
|
||||||
|
<div class="container-fluid flex-center" style="padding-top: 5%">
|
||||||
|
<button class="btn-primary btn-sm btn-rounded right-aligned waves-light" mdbWavesEffect (click)="getAllUserAppFolder()"><i class="fa fa-refresh" aria-hidden="true"></i></button>
|
||||||
|
</div>
|
||||||
|
<!--<a class="btn-floating btn-sm blue-gradient waves-light" mdbWavesEffect (click)="getAllUserAppFolder()"><i class="fa fa-refresh" aria-hidden="true"></i></a>-->
|
||||||
|
<ul class="collapsible collapsible-accordion">
|
||||||
|
|
||||||
|
<mdb-squeezebox [multiple]="false" aria-multiselectable="false">
|
||||||
|
|
||||||
|
<!-- Collapsible link onclick="function(){ getAllUserAppFolder(); }" -->
|
||||||
|
<mdb-item *ngFor="let folder of allUserAppFolder; let i = index;">
|
||||||
|
<mdb-item-head mdbWavesEffect><i class="fa fa-chevron-right"></i>{{folder.name}}</mdb-item-head>
|
||||||
|
<mdb-item-body *ngIf="allUserAppFolder">
|
||||||
|
<ul>
|
||||||
|
<li><a class="waves-effect" *ngFor="let folderChild of getItemsFolder(folder.name); let i = index;" mdbWavesEffect>{{folderChild.name}}</a></li>
|
||||||
|
<li><a class="waves-effect" *ngFor="let file of getItems(folder?.path); let i = index;" mdbWavesEffect>{{file.name}}</a></li>
|
||||||
|
</ul>
|
||||||
|
</mdb-item-body>
|
||||||
|
</mdb-item>
|
||||||
|
|
||||||
|
</mdb-squeezebox>
|
||||||
|
</ul>
|
||||||
|
</li>
|
||||||
|
<!--/. Side navigation links -->
|
||||||
|
</links>
|
||||||
|
<div class="sidenav-bg mask-strong"></div>
|
||||||
|
</mdb-sidenav>
|
||||||
|
<!--/. Sidebar navigation -->
|
||||||
|
|
||||||
|
<!-- Navbar -->
|
||||||
|
<mdb-navbar SideClass="navbar fixed-top navbar-toggleable-md navbar-expand-lg scrolling-navbar double-nav" [containerInside]="false">
|
||||||
|
|
||||||
|
<navlinks class="navbar-container">
|
||||||
|
<!-- SideNav slide-out button -->
|
||||||
|
<div class="float-left">
|
||||||
|
<a (click)="sidenav.show()" class="button-collapse"><i class="fa fa-bars"></i></a>
|
||||||
|
</div>
|
||||||
|
<!--/. SideNav slide-out button -->
|
||||||
|
</navlinks>
|
||||||
|
|
||||||
|
<logo>
|
||||||
|
<!-- Breadcrumb-->
|
||||||
|
<div class="breadcrumbs breadcrumb-dn mr-auto">
|
||||||
|
<p>Welcome</p>
|
||||||
|
</div>
|
||||||
|
<!--/. Breadcrumb-->
|
||||||
|
</logo>
|
||||||
|
|
||||||
|
<navlinks>
|
||||||
|
<ul class="nav navbar-nav nav-flex-icons ml-auto ie-double-nav">
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link waves-light" mdbWavesEffect><i class="fa fa-user"></i> <span class="clearfix d-none d-sm-inline-block"> {{currentUser.username}} </span></a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item dropdown" dropdown>
|
||||||
|
<a dropdownToggle mdbWavesEffect type="button" class="nav-link dropdown-toggle waves-light" mdbWavesEffect>
|
||||||
|
Profil<span class="caret"></span></a>
|
||||||
|
<div *dropdownMenu class="dropdown-menu dropdown dropdown-primary" role="menu">
|
||||||
|
<a class="nav-link waves-light" mdbWavesEffect (click)="logout()"><i class="fa fa-sign-out mr-1"></i><span class="clearfix d-none d-sm-inline-block">Log out</span></a>
|
||||||
|
<div class="divider dropdown-divider"></div>
|
||||||
|
<a class="dropdown-item waves-light" mdbWavesEffect (click)="deleteUserMongo()">Unsubscribe</a>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</navlinks>
|
||||||
|
</mdb-navbar>
|
||||||
|
<!--/. Navbar -->
|
||||||
|
|
||||||
|
</header>
|
||||||
|
<!--/.Double navigation-->
|
||||||
|
|
||||||
|
<!--Main Layout-->
|
||||||
|
<main style="margin-left: 0%; margin-right: 0%;">
|
||||||
|
<div class="container-fluid" style="margin:0%; padding: 0%">
|
||||||
|
<app-book [socialIdUser]="socialIdUser"></app-book>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
</main>
|
||||||
|
<!--/Main layout-->
|
@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { MainComponent } from './main.component';
|
||||||
|
|
||||||
|
describe('MainComponent', () => {
|
||||||
|
let component: MainComponent;
|
||||||
|
let fixture: ComponentFixture<MainComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ MainComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(MainComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
@ -0,0 +1,119 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
import { Router, ActivatedRoute } from '@angular/router';
|
||||||
|
import { HttpClient, HttpHeaders } from '@angular/common/http';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-main',
|
||||||
|
templateUrl: './main.component.html',
|
||||||
|
styleUrls: ['./main.component.scss']
|
||||||
|
})
|
||||||
|
export class MainComponent implements OnInit {
|
||||||
|
httpOptions: any;
|
||||||
|
allUserAppFolder: any;
|
||||||
|
allUserAppFile: any;
|
||||||
|
mainFolder: any;
|
||||||
|
currentUser: any;
|
||||||
|
socialIdUser: String;
|
||||||
|
constructor(private router: Router, private route: ActivatedRoute, private http: HttpClient) { }
|
||||||
|
|
||||||
|
logout() {
|
||||||
|
localStorage.removeItem('jwtToken');
|
||||||
|
this.router.navigate(['home']);
|
||||||
|
}
|
||||||
|
|
||||||
|
ngOnInit() {
|
||||||
|
this.httpOptions = {
|
||||||
|
headers: new HttpHeaders({
|
||||||
|
'Authorization': localStorage.getItem('jwtToken'),
|
||||||
|
'Access-Control-Allow-Origin' : '*',
|
||||||
|
'Access-Control-Allow-Methods' : 'GET, POST, OPTIONS, PUT, PATCH, DELETE',
|
||||||
|
'Access-Control-Allow-Headers' : 'Origin, X-Requested-With, Content-Type, Accept'
|
||||||
|
}),
|
||||||
|
pathFolder: ''
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
this.http.get('/api/getCurrentUser', this.httpOptions).subscribe(user => {
|
||||||
|
this.currentUser = user;
|
||||||
|
if (user) {
|
||||||
|
this.getAllUserAppFolder();
|
||||||
|
}
|
||||||
|
}, err => {
|
||||||
|
if (err.status === 401) {
|
||||||
|
this.router.navigate(['/']);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
// this.httpOptions = {
|
||||||
|
// headers: new HttpHeaders({ 'Authorization': localStorage.getItem('jwtToken'), 'Access-Control-Allow-Origin' : '*'}),
|
||||||
|
// pathFolder: ''
|
||||||
|
// };
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
deleteUserMongo() {
|
||||||
|
this.http.post('/api/deleteUserMongo', this.currentUser).subscribe(user => {
|
||||||
|
console.log('User is delete');
|
||||||
|
this.logout();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getItems(path) {
|
||||||
|
var test = [];
|
||||||
|
if(this.allUserAppFile !== undefined){
|
||||||
|
test = this.allUserAppFile.filter((file) => file.path === path);
|
||||||
|
}
|
||||||
|
return test;
|
||||||
|
}
|
||||||
|
|
||||||
|
setOriginFolder(path) {
|
||||||
|
var pathChunk = path.split('/');
|
||||||
|
|
||||||
|
var origin = pathChunk.length === 1 ? pathChunk[0] : pathChunk[pathChunk.length - 2]
|
||||||
|
|
||||||
|
return origin;
|
||||||
|
}
|
||||||
|
|
||||||
|
getItemsFolder(name) {
|
||||||
|
var tempp;
|
||||||
|
var test = [];
|
||||||
|
if(this.allUserAppFolder !== undefined) {
|
||||||
|
tempp = this.allUserAppFolder;
|
||||||
|
test = tempp.filter((folder) => folder.origin === name);
|
||||||
|
|
||||||
|
}
|
||||||
|
return test;
|
||||||
|
}
|
||||||
|
|
||||||
|
getAllUserAppFiles() {
|
||||||
|
this.http.post('/api/getFileAppList', {owner: this.currentUser.username.toString()}).subscribe(files => {
|
||||||
|
if (files) {
|
||||||
|
this.allUserAppFile = files;
|
||||||
|
// return files;
|
||||||
|
} else {
|
||||||
|
this.allUserAppFile = [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
getAllUserAppFolder(){
|
||||||
|
|
||||||
|
this.http.post('/api/getFolderAppList', {owner: this.currentUser.username.toString()}).subscribe(folders => {
|
||||||
|
if (folders) {
|
||||||
|
|
||||||
|
this.allUserAppFolder = folders;
|
||||||
|
for (let f of this.allUserAppFolder){
|
||||||
|
f.origin = this.setOriginFolder(f.path);
|
||||||
|
//console.log('origin : ' + f.origin);
|
||||||
|
}
|
||||||
|
this.getAllUserAppFiles();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
this.allUserAppFolder = [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 34 KiB |
@ -0,0 +1,6 @@
|
|||||||
|
extends layout
|
||||||
|
|
||||||
|
block content
|
||||||
|
h1= message
|
||||||
|
h2= error.status
|
||||||
|
pre #{error.stack}
|
@ -0,0 +1,38 @@
|
|||||||
|
extends layout
|
||||||
|
|
||||||
|
block content
|
||||||
|
h1= title
|
||||||
|
|
||||||
|
div(class="col-md-4")
|
||||||
|
h2 Create user
|
||||||
|
|
||||||
|
form(action="/users/create", method="post", class="well")
|
||||||
|
div(class="form-group")
|
||||||
|
label(for="username")
|
||||||
|
| Username
|
||||||
|
input(type="text", name="username", class="form-control")
|
||||||
|
input(type="submit" class="btn btn-default")
|
||||||
|
|
||||||
|
div(class="col-md-6")
|
||||||
|
h2 Users
|
||||||
|
|
||||||
|
ul
|
||||||
|
each user in users
|
||||||
|
li
|
||||||
|
strong
|
||||||
|
= user.username
|
||||||
|
|
|
||||||
|
a(href="/users/" + user.id + "/destroy", class="btn btn-xs btn-warning") delete
|
||||||
|
ul
|
||||||
|
li
|
||||||
|
| Create task
|
||||||
|
form(action="/users/" + user.id + "/tasks/create", method="post", class="form-inline")
|
||||||
|
div(class="form-group")
|
||||||
|
input(type="text", name="title", class="input-sm form-control")
|
||||||
|
input(type="submit", class="btn btn-sm btn-default")
|
||||||
|
each task in user.Tasks
|
||||||
|
li
|
||||||
|
strong
|
||||||
|
= task.title
|
||||||
|
|
|
||||||
|
a(href="/users/" + user.id + "/tasks/" + task.id + "/destroy", class="btn btn-xs btn-warning") delete
|
@ -0,0 +1,8 @@
|
|||||||
|
doctype html
|
||||||
|
html
|
||||||
|
head
|
||||||
|
title= title
|
||||||
|
link(rel='stylesheet', href='//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css')
|
||||||
|
link(rel='stylesheet', href='/stylesheets/style.css')
|
||||||
|
body
|
||||||
|
block content
|
Loading…
Reference in New Issue