Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Synchronet
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
128
Issues
128
List
Boards
Labels
Service Desk
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Main
Synchronet
Compare Revisions
1a470cc419f2305a2e1dc93a48b67a59db140047...a1c343af646b7dea2cd035d72db82ae2e435a98a
Source
a1c343af646b7dea2cd035d72db82ae2e435a98a
Select Git revision
...
Target
1a470cc419f2305a2e1dc93a48b67a59db140047
Select Git revision
Compare
Commits (1)
Be less stupid about handling .link pseudopages and redirecting.
· a1c343af
echicken
authored
Feb 19, 2021
a1c343af
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
3 deletions
+15
-3
webv4/lib/pages.js
webv4/lib/pages.js
+12
-1
webv4/root/index.xjs
webv4/root/index.xjs
+3
-2
No files found.
webv4/lib/pages.js
View file @
a1c343af
...
...
@@ -93,6 +93,17 @@ function getCtrlLine(file) {
}
function
getExternalLink
(
fn
)
{
const
p
=
getPagePath
(
fn
);
if
(
p
===
null
)
throw
new
Error
(
'
Invalid page
'
+
fn
+
'
,,,
'
+
settings
.
web_mods_pages
);
const
f
=
new
File
(
p
);
f
.
open
(
'
r
'
);
const
c
=
f
.
read
().
split
(
'
,
'
);
f
.
close
();
if
(
c
.
length
<
2
)
throw
new
Error
(
'
Invalid page
'
+
fn
+
'
,,,
'
+
settings
.
web_mods_pages
);
return
c
[
0
];
}
function
_getPageList
(
dir
)
{
if
(
!
file_isdir
(
dir
))
return
[];
...
...
@@ -133,7 +144,7 @@ function _getPageList(dir) {
file
:
fn
,
name
:
pageName
(
c
),
title
:
l
[
1
],
page
:
l
[
0
]
,
page
:
fn
,
type
:
'
link
'
});
}
else
{
...
...
webv4/root/index.xjs
View file @
a1c343af
...
...
@@ -6,9 +6,10 @@
load(settings.web_lib + 'sidebar.js');
var page = typeof http_request.query.page == 'undefined' ? '000-home.xjs' : http_request.query.page[0];
if (page.search(/(?:https?|ftp|telnet|ssh|gopher|rlogin|news):\/\/[^\s'"'<>()]*|[-\w.+]+@(?:[-\w]+\.)+[\w]{2,6}/i) > -1) {
if (page.search(/\.link$/) > -1) {
var loc = getExternalLink(page);
http_reply.status = '301 Moved Permanently';
http_reply.header['Location'] =
page
;
http_reply.header['Location'] =
loc
;
exit();
}
var pagePath = getPagePath(page);
...
...