File tree 3 files changed +17
-2
lines changed
3 files changed +17
-2
lines changed Original file line number Diff line number Diff line change 25
25
th SID
26
26
th Created
27
27
th Downloaded
28
+ th Download Count
28
29
th Expire
29
30
th Size
30
31
th Actions
38
39
td
39
40
template( v-if ="sum[sid].lastDownload" ) {{ sum[sid].lastDownload | date}}
40
41
template( v-else ="" ) -
42
+ td {{ sum[sid].downloadCountPre }} {{ sum[sid].downloadCount }}
41
43
td
42
44
template( v-if ="typeof sum[sid].firstExpire === 'number'" ) {{ sum[sid].firstExpire | date }}
43
45
template( v-else ) {{ sum[sid].firstExpire }}
56
58
td
57
59
template( v-if ="file.metadata.lastDownload" ) {{ +file.metadata.lastDownload | date}}
58
60
template( v-else ="" ) -
61
+ td {{ file.metadata.downloadCount }}
59
62
td
60
63
template( v-if ="typeof file.expireDate === 'number'" ) {{ file.expireDate | date }}
61
64
template( v-else ) {{ file.expireDate }}
65
68
icon( name ="trash" )
66
69
tfoot
67
70
tr
68
- td( colspan ="3 " )
71
+ td( colspan ="4 " )
69
72
td.text-right ( colspan ="2" ) Sum: {{ humanFileSize(sizeSum) }}
70
73
td
71
74
94
97
error: ' ' ,
95
98
passwordWrong: false ,
96
99
expand: false ,
97
- sizeSum: 0
100
+ sizeSum: 0 ,
101
+ downloadCount: 0 ,
102
+ downloadCountPre: " " ,
98
103
}
99
104
},
100
105
141
146
};
142
147
this .db [sid].forEach (file => {
143
148
bucketSum .size += file .size ;
149
+ if (bucketSum .downloadCount == undefined ) {
150
+ bucketSum .downloadCount = isNaN (file .metadata .downloadCount ) ? " -" : file .metadata .downloadCount ;
151
+ } else if (bucketSum .downloadCount != file .metadata .downloadCount ) {
152
+ bucketSum .downloadCountPre = bucketSum .downloadCount != 0 ? " ~" : " " ;
153
+ bucketSum .downloadCount = bucketSum .downloadCount < file .metadata .downloadCount ? file .metadata .downloadCount : bucketSum .downloadCount ;
154
+ }
144
155
if (file .metadata ._password ) {
145
156
bucketSum .password = true ;
146
157
}
Original file line number Diff line number Diff line change 48
48
span.btn.btn-sm.btn-default ( :title ="$root.lang.download" )
49
49
a
50
50
icon( name ="download" )
51
+ strong( v-if ="!isNaN(file.metadata.downloadCount)" style ="padding-left:5px;" ) {{file.metadata.downloadCount}}
51
52
i.pull-right.fa.fa-check.text-success.downloaded ( v-show ='file.downloaded' )
52
53
icon( name ="check" )
53
54
p
135
136
aEl .click ();
136
137
document .body .removeChild (aEl);
137
138
file .downloaded = true ;
139
+ file .metadata .downloadCount = isNaN (file .metadata .downloadCount ) ? 1 : ++ file .metadata .downloadCount ;
138
140
},
139
141
140
142
downloadAll (format ) {
148
150
149
151
this .files .forEach (f => {
150
152
f .downloaded = true ;
153
+ f .metadata .downloadCount = isNaN (f .metadata .downloadCount ) ? 1 : ++ f .metadata .downloadCount ;
151
154
});
152
155
},
153
156
Original file line number Diff line number Diff line change @@ -120,6 +120,7 @@ module.exports = class DB {
120
120
const data = this . get ( sid ) . find ( item => item . key === key ) ;
121
121
if ( ! data ) return ;
122
122
data . metadata . lastDownload = Date . now ( ) ;
123
+ data . metadata . downloadCount = isNaN ( data . metadata . downloadCount ) ? 1 : ++ data . metadata . downloadCount ;
123
124
await this . store . update ( `${ sid } ++${ key } ` , data ) ;
124
125
}
125
126
You can’t perform that action at this time.
0 commit comments