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
1de4be85
Commit
1de4be85
authored
9 years ago
by
deuce
Browse files
Options
Downloads
Patches
Plain Diff
Add FREQITCfg object to fidocfg.js
Start of a FREQIT config script.
parent
319bdfab
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
exec/freqit.js
+0
-49
0 additions, 49 deletions
exec/freqit.js
exec/freqitcfg.js
+95
-0
95 additions, 0 deletions
exec/freqitcfg.js
exec/load/fidocfg.js
+50
-0
50 additions, 0 deletions
exec/load/fidocfg.js
with
145 additions
and
49 deletions
exec/freqit.js
+
0
−
49
View file @
1de4be85
...
...
@@ -7,55 +7,6 @@
load
(
"
filebase.js
"
);
load
(
"
fidocfg.js
"
);
function
FREQITCfg
()
{
var
f
=
new
File
(
system
.
ctrl_dir
+
'
freqit.ini
'
);
var
val
;
if
(
!
f
.
open
(
'
r
'
))
{
log
(
LOG_ERROR
,
"
Unable to open '
"
+
f
.
name
+
"
'
"
);
return
;
}
// TODO: Support requiring passwords for specific files/dirs
this
.
dirs
=
[];
this
.
securedirs
=
[];
this
.
magic
=
{};
val
=
f
.
iniGetValue
(
null
,
'
Dirs
'
);
if
(
val
!=
undefined
)
this
.
dirs
=
val
.
toLowerCase
().
split
(
/,/
);
val
=
f
.
iniGetValue
(
null
,
'
SecureDirs
'
);
if
(
val
!=
undefined
)
this
.
securedirs
=
val
.
toLowerCase
().
split
(
/,/
);
this
.
maxfiles
=
f
.
iniGetValue
(
null
,
'
MaxFiles
'
,
10
);
f
.
iniGetSections
().
forEach
(
function
(
key
)
{
var
dir
=
f
.
iniGetValue
(
key
,
'
Dir
'
);
if
(
dir
==
undefined
)
{
log
(
LOG_ERROR
,
"
Magic value '
"
+
key
+
"
' without a dir configured
"
);
return
;
}
if
(
this
.
magic
===
undefined
)
this
.
magic
=
{};
this
.
magic
[
key
]
=
{};
this
.
magic
[
key
].
dir
=
dir
;
this
.
magic
[
key
].
match
=
f
.
iniGetValue
(
key
,
'
Match
'
,
'
*
'
);
this
.
magic
[
key
].
secure
=
f
.
iniGetValue
(
key
,
'
Secure
'
,
'
No
'
);
switch
(
this
.
magic
[
key
].
secure
.
toUpperCase
())
{
case
'
TRUE
'
:
case
'
YES
'
:
case
'
ON
'
:
this
.
magic
[
key
].
secure
=
true
;
break
;
default
:
if
(
parseInt
(
this
.
magic
[
key
].
secure
,
10
))
{
this
.
magic
[
key
].
secure
=
true
;
break
;
}
this
.
magic
[
key
].
secure
=
false
;
}
});
f
.
close
();
}
var
cfg
=
new
FREQITCfg
();
...
...
This diff is collapsed.
Click to expand it.
exec/freqitcfg.js
0 → 100644
+
95
−
0
View file @
1de4be85
load
(
"
uifcdefs.js
"
);
load
(
"
fidocfg.js
"
);
var
cfg
=
new
FREQITCfg
();
var
dctx
=
{};
var
gctx
=
new
uifc
.
list
.
CTX
();
function
pick_dir
()
{
var
cmd
=
0
;
var
libs
=
Object
.
keys
(
file_area
.
lib
);
function
do_pick_dir
(
grp
)
{
var
dirs
;
var
dircodes
;
var
dir
;
var
ret
;
dir
=
0
;
while
(
dir
>=
0
)
{
if
(
dctx
[
grp
]
===
undefined
)
dctx
[
grp
]
=
new
uifc
.
list
.
CTX
();
dircodes
=
file_area
.
lib
[
libs
[
cmd
]].
dir_list
.
map
(
function
(
v
){
return
v
.
code
;});
dirs
=
dircodes
.
map
(
function
(
v
){
return
file_area
.
dir
[
v
].
name
;});
dir
=
uifc
.
list
(
WIN_BOT
|
WIN_SAV
|
WIN_ACT
,
"
Select Dir
"
,
dirs
,
dctx
[
grp
]);
if
(
dir
>=
0
)
return
dircodes
[
dir
];
}
return
undefined
;
}
while
(
cmd
>=
0
)
{
cmd
=
uifc
.
list
(
WIN_RHT
|
WIN_SAV
|
WIN_ACT
,
"
Select Group
"
,
libs
,
gctx
);
if
(
cmd
>=
0
)
{
file
=
do_pick_dir
(
libs
[
cmd
]);
if
(
file
!==
undefined
)
return
file
;
}
}
return
undefined
;
}
var
dirctx
=
new
uifc
.
list
.
CTX
();
function
edit_dirs
(
list
)
{
var
dir
=
0
;
var
dirs
;
while
(
dir
>=
0
)
{
dirs
=
list
.
map
(
function
(
v
){
return
file_area
.
dir
[
v
].
name
;});
dir
=
uifc
.
list
(
WIN_INS
|
WIN_INSACT
|
WIN_DEL
|
WIN_XTR
|
WIN_SAV
,
"
Directories
"
,
dirs
,
dirctx
);
if
(
dir
==
-
1
)
return
undefined
;
if
(
dir
==
dirs
.
length
-
1
||
dir
&
MSK_INS
)
{
dir
&=
MSK_OFF
;
var
newdir
=
pick_dir
();
if
(
newdir
)
list
.
splice
(
dir
,
0
,
newdir
);
}
else
if
(
dir
&
MSK_DEL
)
{
dir
&=
MSK_OFF
;
list
.
splice
(
dir
,
1
);
}
}
return
undefined
;
}
function
main
()
{
var
cmd
=
0
;
var
ctx
=
new
uifc
.
list
.
CTX
();
var
opts
;
uifc
.
init
(
"
FREQIT Config
"
);
while
(
cmd
>=
0
)
{
opts
=
[
"
Dirs...
"
,
"
Secure Dirs...
"
,
format
(
"
Max Files (%d)
"
,
cfg
.
maxfiles
),
"
Magic Names...
"
];
cmd
=
uifc
.
list
(
WIN_ACT
|
WIN_ORG
|
WIN_MID
,
"
FREQIT Options
"
,
opts
,
ctx
);
switch
(
cmd
)
{
case
0
:
// Dirs
edit_dirs
(
cfg
.
dirs
);
break
;
case
1
:
// Secure Dirs
edit_dirs
(
cfg
.
securedirs
);
break
;
case
2
:
// Max Files
case
3
:
// Magic Names
case
-
1
:
// Done
// TODO: Save.
uifc
.
bail
();
}
}
}
main
();
This diff is collapsed.
Click to expand it.
exec/load/fidocfg.js
+
50
−
0
View file @
1de4be85
...
...
@@ -205,3 +205,53 @@ TickITCfg.prototype.save = function()
tcfg
.
iniRemoveSection
(
sects
[
i
]);
tcfg
.
close
();
}
function
FREQITCfg
()
{
var
f
=
new
File
(
system
.
ctrl_dir
+
'
freqit.ini
'
);
var
val
;
if
(
!
f
.
open
(
'
r
'
))
{
log
(
LOG_ERROR
,
"
Unable to open '
"
+
f
.
name
+
"
'
"
);
return
;
}
// TODO: Support requiring passwords for specific files/dirs
this
.
dirs
=
[];
this
.
securedirs
=
[];
this
.
magic
=
{};
val
=
f
.
iniGetValue
(
null
,
'
Dirs
'
);
if
(
val
!=
undefined
)
this
.
dirs
=
val
.
toLowerCase
().
split
(
/,/
);
val
=
f
.
iniGetValue
(
null
,
'
SecureDirs
'
);
if
(
val
!=
undefined
)
this
.
securedirs
=
val
.
toLowerCase
().
split
(
/,/
);
this
.
maxfiles
=
f
.
iniGetValue
(
null
,
'
MaxFiles
'
,
10
);
f
.
iniGetSections
().
forEach
(
function
(
key
)
{
var
dir
=
f
.
iniGetValue
(
key
,
'
Dir
'
);
if
(
dir
==
undefined
)
{
log
(
LOG_ERROR
,
"
Magic value '
"
+
key
+
"
' without a dir configured
"
);
return
;
}
if
(
this
.
magic
===
undefined
)
this
.
magic
=
{};
this
.
magic
[
key
]
=
{};
this
.
magic
[
key
].
dir
=
dir
;
this
.
magic
[
key
].
match
=
f
.
iniGetValue
(
key
,
'
Match
'
,
'
*
'
);
this
.
magic
[
key
].
secure
=
f
.
iniGetValue
(
key
,
'
Secure
'
,
'
No
'
);
switch
(
this
.
magic
[
key
].
secure
.
toUpperCase
())
{
case
'
TRUE
'
:
case
'
YES
'
:
case
'
ON
'
:
this
.
magic
[
key
].
secure
=
true
;
break
;
default
:
if
(
parseInt
(
this
.
magic
[
key
].
secure
,
10
))
{
this
.
magic
[
key
].
secure
=
true
;
break
;
}
this
.
magic
[
key
].
secure
=
false
;
}
});
f
.
close
();
}
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