Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Synchronet
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Main
Synchronet
Commits
06f98e7f
Commit
06f98e7f
authored
6 months ago
by
Rob Swindell
Browse files
Options
Downloads
Patches
Plain Diff
File was renamed to batchxfer.js
parent
f3b3cabc
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
exec/batxfer.js
+0
-170
0 additions, 170 deletions
exec/batxfer.js
with
0 additions
and
170 deletions
exec/batxfer.js
deleted
100644 → 0
+
0
−
170
View file @
f3b3cabc
// Bach File Transfer menu
// Usable as a system "Batch Transfer" loadable module
// i.e. in SCFG->System->Loadable Modules->Batch Transfer
require
(
"
sbbsdefs.js
"
,
"
USER_RIP
"
);
require
(
"
file_size.js
"
,
"
file_size_float
"
);
"
use strict
"
;
function
batch_list_read
(
fname
)
{
var
f
=
new
File
(
fname
);
var
list
;
if
(
f
.
open
(
"
r
"
))
{
list
=
f
.
iniGetAllObjects
();
f
.
close
();
}
return
list
;
}
function
batch_file_load
(
f
)
{
var
base
=
new
FileBase
(
f
.
dir
);
if
(
base
&&
base
.
open
())
{
f
=
base
.
get
(
f
.
name
);
base
.
close
();
}
return
f
;
}
function
est_duration
(
size
)
{
if
(
!
bbs
.
download_cps
)
return
"
??:??:??
"
;
return
system
.
secondstr
(
size
/
bbs
.
download_cps
);
}
function
batchmenu
()
{
var
sort
;
const
menu_code
=
"
batchxfr
"
if
(
bbs
.
batch_dnload_total
<
1
&&
bbs
.
batch_upload_total
<
1
&&
file_area
.
upload_dir
==
undefined
)
{
console
.
print
(
bbs
.
text
(
bbs
.
text
.
NoFilesInBatchQueue
));
return
;
}
if
(
console
.
term_supports
(
USER_RIP
)
&&
!
(
user
.
settings
&
USER_EXPERT
))
bbs
.
menu
(
"
batchxfr
"
);
while
(
bbs
.
online
&&
(
file_area
.
upload_dir
!==
undefined
||
bbs
.
batch_dnload_total
||
bbs
.
batch_upload_total
))
{
if
(
!
console
.
term_supports
(
USER_RIP
)
&&
!
(
user
.
settings
&
USER_EXPERT
))
{
console
.
aborted
=
false
;
bbs
.
menu
(
"
batchxfr
"
);
}
bbs
.
nodesync
();
console
.
print
(
bbs
.
text
(
bbs
.
text
.
BatchMenuPrompt
));
const
keys
=
"
CDLRU?
\r
"
+
console
.
quit_key
;
var
ch
=
console
.
getkeys
(
keys
,
0
);
switch
(
ch
)
{
case
'
?
'
:
if
((
user
.
settings
&
USER_EXPERT
)
||
console
.
term_supports
(
USER_RIP
))
bbs
.
menu
(
"
batchxfr
"
);
break
;
case
'
C
'
:
if
(
bbs
.
batch_upload_total
<
1
)
{
console
.
print
(
bbs
.
text
(
bbs
.
text
.
UploadQueueIsEmpty
));
}
else
{
if
(
bbs
.
text
(
bbs
.
text
.
ClearUploadQueueQ
)[
0
]
==
0
||
!
console
.
noyes
(
bbs
.
text
(
bbs
.
text
.
ClearUploadQueueQ
)))
{
if
(
bbs
.
batch_clear
(
/* upload */
true
))
console
.
print
(
bbs
.
text
(
bbs
.
text
.
UploadQueueCleared
));
}
}
if
(
bbs
.
batch_dnload_total
<
1
)
{
console
.
print
(
bbs
.
text
(
bbs
.
text
.
DownloadQueueIsEmpty
));
}
else
{
if
(
bbs
.
text
(
bbs
.
text
.
ClearDownloadQueueQ
)[
0
]
==
0
||
!
console
.
noyes
(
bbs
.
text
(
bbs
.
text
.
ClearDownloadQueueQ
)))
{
if
(
bbs
.
batch_clear
(
/* upload */
false
))
console
.
print
(
bbs
.
text
(
bbs
.
text
.
DownloadQueueCleared
));
}
}
break
;
case
'
D
'
:
bbs
.
batch_download
();
break
;
case
'
L
'
:
var
list
=
batch_list_read
(
user
.
batch_upload_list
);
if
(
list
&&
list
.
length
)
{
if
(
sort
===
undefined
)
sort
=
console
.
yesno
(
bbs
.
text
(
bbs
.
text
.
SortAlphaQ
));
if
(
sort
)
bbs
.
batch_sort
(
/* upload */
true
);
console
.
print
(
bbs
.
text
(
bbs
.
text
.
UploadQueueLstHdr
));
for
(
var
i
in
list
)
{
var
f
=
list
[
i
];
console
.
print
(
format
(
bbs
.
text
(
bbs
.
text
.
UploadQueueLstFmt
)
,
Number
(
i
)
+
1
,
f
.
name
,
f
.
desc
||
bbs
.
text
(
bbs
.
text
.
NoDescription
)));
if
(
console
.
aborted
)
break
;
}
}
else
console
.
print
(
bbs
.
text
(
bbs
.
text
.
UploadQueueIsEmpty
));
var
totalsize
=
0
;
var
totalcdt
=
0
;
list
=
batch_list_read
(
user
.
batch_download_list
);
if
(
list
&&
list
.
length
)
{
if
(
sort
===
undefined
)
sort
=
console
.
yesno
(
bbs
.
text
(
bbs
.
text
.
SortAlphaQ
));
if
(
sort
)
bbs
.
batch_sort
(
/* upload */
false
);
console
.
print
(
bbs
.
text
(
bbs
.
text
.
DownloadQueueLstHdr
));
for
(
var
i
in
list
)
{
var
f
=
batch_file_load
(
list
[
i
]);
console
.
print
(
format
(
bbs
.
text
(
bbs
.
text
.
DownloadQueueLstFmt
)
,
Number
(
i
)
+
1
,
f
.
name
,
file_size_float
(
f
.
cost
,
1
,
1
)
,
file_size_float
(
f
.
size
,
1
,
1
)
,
est_duration
(
f
.
size
)
,
system
.
datestr
(
f
.
time
)));
totalsize
+=
f
.
size
;
totalcdt
+=
f
.
cost
;
if
(
console
.
aborted
)
break
;
}
if
(
!
console
.
aborted
)
console
.
print
(
format
(
bbs
.
text
(
bbs
.
text
.
DownloadQueueTotals
)
,
file_size_float
(
totalcdt
,
1
,
1
)
,
file_size_float
(
totalsize
,
1
,
1
)
,
est_duration
(
totalsize
)));
}
else
console
.
print
(
bbs
.
text
(
bbs
.
text
.
DownloadQueueIsEmpty
));
break
;
case
'
R
'
:
var
n
;
if
((
n
=
bbs
.
batch_upload_total
)
>
0
)
{
console
.
print
(
format
(
bbs
.
text
(
bbs
.
text
.
RemoveWhichFromUlQueue
),
n
));
var
str
=
console
.
getstr
();
if
((
n
=
parseInt
(
str
))
>
0
)
n
=
bbs
.
batch_remove
(
/* upload */
true
,
n
-
1
);
else
n
=
bbs
.
batch_remove
(
/* upload */
true
,
str
);
console
.
print
(
format
(
bbs
.
text
(
bbs
.
text
.
NFilesRemoved
),
n
));
}
if
((
n
=
bbs
.
batch_dnload_total
)
>
0
)
{
console
.
print
(
format
(
bbs
.
text
(
bbs
.
text
.
RemoveWhichFromDlQueue
),
n
));
var
str
=
console
.
getstr
();
if
((
n
=
parseInt
(
str
))
>
0
)
n
=
bbs
.
batch_remove
(
/* upload */
false
,
n
-
1
);
else
n
=
bbs
.
batch_remove
(
/* upload */
false
,
str
);
console
.
print
(
format
(
bbs
.
text
(
bbs
.
text
.
NFilesRemoved
),
n
));
}
break
;
case
'
U
'
:
if
(
user
.
security
.
restrictions
&
UFLAG_U
)
{
console
.
print
(
bbs
.
text
(
bbs
.
text
.
R_Upload
));
break
;
}
bbs
.
batch_upload
();
break
;
default
:
return
;
}
}
}
batchmenu
();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment