Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
MikuInvidious
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
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
Bing Chilling
MikuInvidious
Commits
a8853cdc
Commit
a8853cdc
authored
1 year ago
by
John Xina
Browse files
Options
Downloads
Patches
Plain Diff
add robots.txt support, default to strict policy
parent
cd933fff
No related branches found
Branches containing commit
Tags
v0.1
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
app.py
+10
-1
10 additions, 1 deletion
app.py
config.toml.sample
+8
-0
8 additions, 0 deletions
config.toml.sample
static/rules/robots_relaxed.txt
+6
-0
6 additions, 0 deletions
static/rules/robots_relaxed.txt
static/rules/robots_strict.txt
+2
-0
2 additions, 0 deletions
static/rules/robots_strict.txt
with
26 additions
and
1 deletion
app.py
+
10
−
1
View file @
a8853cdc
...
...
@@ -17,7 +17,7 @@ import requests
from
urllib.parse
import
urlparse
import
asyncio
from
aioflask
import
request
,
make_response
,
redirect
,
url_for
from
aioflask
import
request
,
make_response
,
redirect
,
url_for
,
send_from_directory
import
subprocess
from
bs4
import
BeautifulSoup
...
...
@@ -90,6 +90,15 @@ async def test_view():
resp
.
set_cookie
(
'
theme
'
,
'
default
'
)
return
resp
@app.route
(
'
/robots.txt
'
)
def
robots_txt
():
policy
=
appconf
[
'
site
'
].
get
(
'
robots_policy
'
)
or
'
strict
'
if
policy
==
'
PLEASE_INDEX_EVERYTHING
'
:
return
''
,
404
return
send_from_directory
(
f
'
static/rules
'
,
f
'
robots_
{
policy
}
.txt
'
)
##########################################
# Error handling
##########################################
...
...
This diff is collapsed.
Click to expand it.
config.toml.sample
+
8
−
0
View file @
a8853cdc
...
...
@@ -12,6 +12,14 @@ site_allow_download = true
# This will allow (potentially unsafe) error response to be showed directly on site.
site_show_unsafe_error_response = false
# This controls whether the search engines will index your site or not.
# Available options:
# - 'strict', indexing is disallowed.
# - 'relexed', search engines can index articles and search page.
# - 'PLEASE_INDEX_EVERYTHING', a VERY DANGEROUS option, may give you a lawsuit.
# Default to 'strict'.
robots_policy = 'strict'
[flask]
host = '0.0.0.0'
...
...
This diff is collapsed.
Click to expand it.
static/rules/robots_relaxed.txt
0 → 100644
+
6
−
0
View file @
a8853cdc
User-agent: *
Disallow: /vv/
Disallow: /space/
Disallow: /author/
Disallow: /video_listen/
Disallow: /video/
This diff is collapsed.
Click to expand it.
static/rules/robots_strict.txt
0 → 100644
+
2
−
0
View file @
a8853cdc
User-agent: *
Disallow: /
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