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
41dc9df9
Commit
41dc9df9
authored
2 years ago
by
echicken
Browse files
Options
Downloads
Patches
Plain Diff
Allow this to run under jsexec
parent
2c5da119
No related branches found
No related tags found
1 merge request
!463
MRC mods by Codefenix (2024-10-20)
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
xtrn/wttr.in/locator.js
+3
-1
3 additions, 1 deletion
xtrn/wttr.in/locator.js
xtrn/wttr.in/wttr.js
+10
-6
10 additions, 6 deletions
xtrn/wttr.in/wttr.js
with
13 additions
and
7 deletions
xtrn/wttr.in/locator.js
+
3
−
1
View file @
41dc9df9
// To do: use user.location / zipcode if available?
// To do: use user.location / zipcode if available?
function
getAddress
()
{
function
getAddress
()
{
if
(
js
.
global
.
client
===
undefined
)
return
;
// jsexec
const
addrRe
=
/
(
^0
\.
0
\.
0
\.
0$
)
|
(
^127
\.)
|
(
^192
\.
168
\.)
|
(
^10
\.)
|
(
^172
\.
1
[
6-9
]\.)
|
(
^172
\.
2
[
0-9
]\.)
|
(
^172
\.
3
[
0-1
]\.)
|
(
^169
\.
254
\.)
|
(
^::1$
)
|
(
^
[
fF
][
cCdD
])
/
;
const
addrRe
=
/
(
^0
\.
0
\.
0
\.
0$
)
|
(
^127
\.)
|
(
^192
\.
168
\.)
|
(
^10
\.)
|
(
^172
\.
1
[
6-9
]\.)
|
(
^172
\.
2
[
0-9
]\.)
|
(
^172
\.
3
[
0-1
]\.)
|
(
^169
\.
254
\.)
|
(
^::1$
)
|
(
^
[
fF
][
cCdD
])
/
;
if
(
client
.
ip_address
.
search
(
addrRe
)
<
0
)
return
client
.
ip_address
;
// Not a private/local address
if
(
client
.
ip_address
.
search
(
addrRe
)
<
0
)
return
client
.
ip_address
;
// Not a private/local address
...
...
This diff is collapsed.
Click to expand it.
xtrn/wttr.in/wttr.js
+
10
−
6
View file @
41dc9df9
...
@@ -3,12 +3,16 @@ const wttr = load({}, js.exec_dir + 'wttr-lib.js');
...
@@ -3,12 +3,16 @@ const wttr = load({}, js.exec_dir + 'wttr-lib.js');
function
main
()
{
function
main
()
{
const
ansi
=
wttr
.
getWeather
();
const
ansi
=
wttr
.
getWeather
();
if
(
js
.
global
.
console
===
undefined
)
{
// jsexec
writeln
(
ansi
);
}
else
{
const
attr
=
console
.
attributes
;
const
attr
=
console
.
attributes
;
console
.
clear
(
BG_BLACK
|
LIGHTGRAY
);
console
.
clear
(
BG_BLACK
|
LIGHTGRAY
);
console
.
putmsg
(
ansi
,
P_UTF8
);
console
.
putmsg
(
ansi
,
P_UTF8
);
console
.
pause
();
console
.
pause
();
console
.
attributes
=
attr
;
console
.
attributes
=
attr
;
}
}
}
try
{
try
{
main
();
main
();
...
...
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