[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [ocs-webserver/dev] httpdocs/theme/react: no message
From: david nelband <null () kde ! org>
Date: 2018-08-03 8:49:13
Message-ID: E1flVlp-0003zS-F2 () code ! kde ! org
[Download RAW message or body]
Git commit 212176c5f26050ed53f49f0f70335fbe2efe6cd5 by david nelband.
Committed on 03/08/2018 at 08:38.
Pushed by dnelband into branch 'dev'.
no message
M +13 -4 httpdocs/theme/react/all.js
M +8 -1 httpdocs/theme/react/app/__app-helpers.js
M +5 -3 httpdocs/theme/react/app/_product-page.js
https://commits.kde.org/ocs-webserver/212176c5f26050ed53f49f0f70335fbe2efe6cd5
diff --git a/httpdocs/theme/react/all.js b/httpdocs/theme/react/all.js
index e7556f6d..115e50a1 100644
--- a/httpdocs/theme/react/all.js
+++ b/httpdocs/theme/react/all.js
@@ -75,8 +75,15 @@ window.appHelpers = function () {
}
function generateFileDownloadHash(file, env) {
+ let salt;
+ if (env === "test") {
+ salt = "vBHnf7bbdhz120bhNsd530LsA2mkMvh6sDsCm4jKlm23D186Fj";
+ } else {
+ salt = "Kcn6cv7&dmvkS40Hna §4ffcvl=021nfMs2sdlPs123MChf4s0K";
+ }
+
const timestamp = Date.now() + 3600;
- const hash = md5( /*salt+*/file.collection_id + timestamp);
+ const hash = md5(salt, file.collection_id + timestamp);
return hash;
/*
$salt = PPLOAD_DOWNLOAD_SECRET;
@@ -2898,7 +2905,9 @@ class CommentForm extends React.Component {
self.setState({
text: ''
}, function () {
- console.log(results.data);
+ jQuery.ajax({ data: {}, url: '/productcomment?p=' + \
self.props.product.project_id }, function (response) { + \
console.log(response); + });
});
}
});
@@ -3186,11 +3195,11 @@ class ProductViewFilesTabItem extends React.Component {
const f = this.props.file;
const fileDownloadHash = appHelpers.generateFileDownloadHash(f, \
store.getState().env);
-
+ console.log(fileDownloadHash);
// var downloadUrl = "https://<?= $_SERVER["SERVER_NAME"]?>/p/<?= \
$this->product->project_id ?>/startdownload?file_id=" + this.id + "&file_name=" + \
this.name + "&file_type=" + this.type + "&file_size=" + this.size + "&url=" + \
encodeURIComponent(pploadApiUri + 'files/downloadfile/id/' + this.id + '/s/' + hash + \
'/t/' + timetamp + '/u/' + userid + '/' + this.name);
// var downloadLink = '<a href="' + downloadUrl + '" id="data-link' + this.id + \
'">' + this.name + '</a>';
- let downloadLink = "https://" + baseUrl + "/p/" + this.props.product.project_id \
+ "/startdownload?file_id=" + f.id + "&file_name=" + f.title + "&file_type=" + f.type \
+ "&file_size=" + f.size + "&url=" + downloadLinkUrlAttr + "files/downloadfile/id/" + \
f.id + "/s/" + f.hash + "/t/" + f.created_timestamp + "/u/" + \
this.props.product.member_id + "/" + f.title; + let downloadLink = "https://" + \
baseUrl + "/p/" + this.props.product.project_id + "/startdownload?file_id=" + f.id + \
"&file_name=" + f.title + "&file_type=" + f.type + "&file_size=" + f.size + "&url=" + \
downloadLinkUrlAttr + "files/downloadfile/id/" + f.id + "/s/" + fileDownloadHash + \
"/t/" + f.created_timestamp + "/u/" + this.props.product.member_id + "/" + f.title;
/*https://david.pling.cc/p/747/startdownload?file_id=1519124607&
file_name=1519124607-download-app-old.png&
diff --git a/httpdocs/theme/react/app/__app-helpers.js \
b/httpdocs/theme/react/app/__app-helpers.js index e1e5243b..8ff6e4c2 100644
--- a/httpdocs/theme/react/app/__app-helpers.js
+++ b/httpdocs/theme/react/app/__app-helpers.js
@@ -80,8 +80,15 @@ window.appHelpers = (function(){
}
function generateFileDownloadHash(file,env){
+ let salt;
+ if (env === "test"){
+ salt = "vBHnf7bbdhz120bhNsd530LsA2mkMvh6sDsCm4jKlm23D186Fj";
+ } else {
+ salt = "Kcn6cv7&dmvkS40Hna §4ffcvl=021nfMs2sdlPs123MChf4s0K";
+ }
+
const timestamp = Date.now() + 3600;
- const hash = md5(/*salt+*/file.collection_id+timestamp);
+ const hash = md5(salt,file.collection_id+timestamp);
return hash;
/*
$salt = PPLOAD_DOWNLOAD_SECRET;
diff --git a/httpdocs/theme/react/app/_product-page.js \
b/httpdocs/theme/react/app/_product-page.js index 9d546b7f..4a7c7cd1 100644
--- a/httpdocs/theme/react/app/_product-page.js
+++ b/httpdocs/theme/react/app/_product-page.js
@@ -854,7 +854,9 @@ class CommentForm extends React.Component {
self.setState({
text:''
},function(){
- console.log(results.data);
+ jQuery.ajax({data:{},url:'/productcomment?p='+self.props.product.project_id},function(response){
+ console.log(response);
+ });
});
}
})
@@ -1046,7 +1048,7 @@ class ProductViewFilesTabItem extends React.Component {
const f = this.props.file;
const fileDownloadHash = \
appHelpers.generateFileDownloadHash(f,store.getState().env);
-
+ console.log(fileDownloadHash);
// var downloadUrl = "https://<?= $_SERVER["SERVER_NAME"]?>/p/<?= \
$this->product->project_id ?>/startdownload?file_id=" + this.id + "&file_name=" + \
this.name + "&file_type=" + this.type + "&file_size=" + this.size + "&url=" + \
encodeURIComponent(pploadApiUri + 'files/downloadfile/id/' + this.id + '/s/' + hash + \
'/t/' + timetamp + '/u/' + userid + '/' + this.name);
// var downloadLink = '<a href="' + downloadUrl + '" id="data-link' + this.id + \
'">' + this.name + '</a>';
@@ -1058,7 +1060,7 @@ class ProductViewFilesTabItem extends React.Component {
"&file_size="+f.size+
"&url="+downloadLinkUrlAttr+
"files/downloadfile/id/"+f.id+
- "/s/"+f.hash+
+ "/s/"+fileDownloadHash+
"/t/"+f.created_timestamp+
"/u/"+this.props.product.member_id+
"/"+f.title;
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic