Slightly reword robot rules setting and translate to German

This commit is contained in:
Tobi Schäfer 2025-05-11 00:36:31 +02:00 committed by Antville Git bot
parent 42a0d7e610
commit 50b5c4d09e
5 changed files with 385 additions and 320 deletions

View file

@ -154,7 +154,7 @@
<% gettext enforced %>
</label>
<p class="uk-form-help-block">
<% gettext 'Edit the rules in the <a href="%s/Site/robots/edit">robots.txt</a> skin.' | replace '%s/' <% site.layout.skins.href %> %>
<% gettext 'Edit the rules in the <a href="{0}Site/robots/edit">robots.txt</a> skin.' <% site.layout.skins.href %> %>
</p>
</div>
</div>

View file

@ -95,9 +95,13 @@ Site.getNotificationModes = defineConstants(Site, markgettext('Nobody'),
*/
Site.getCallbackModes = defineConstants(Site, markgettext('disabled'),
markgettext('enabled'));
Site.getRobotsTxtModes = defineConstants(Site, markgettext('relaxed'),
markgettext('enforced'));
/**
* @function
* @returns {String[]}
* @see defineConstants
*/
Site.getRobotsTxtModes = defineConstants(Site, markgettext('suggest'),
markgettext('enforce'));
/**
* @param {String} name A unique identifier also used in the URL of a site
@ -136,7 +140,7 @@ Site.add = function(data, user) {
configured: now,
created: now,
creator: user,
robotsTxtMode: Site.RELAXED,
robotsTxtMode: Site.SUGGEST,
modified: now,
modifier: user,
status: user.status === User.PRIVILEGED ? Site.TRUSTED : user.status,
@ -1134,20 +1138,25 @@ Site.prototype.callback = function(ref) {
}
Site.prototype.enforceRobotsTxt = function() {
if (this.robotsTxtMode !== Site.ENFORCED) {
if (this.robotsTxtMode !== Site.ENFORCE) {
return false;
}
// Override some patterns to prevent a site from becoming inaccessible even for the owner
// Override some URLs to prevent a site from becoming inaccessible even for the owner
const overrides = [
'User-agent: mozilla',
'Allow: */edit$',
'Allow: */layout',
'Allow: */main.*$',
'Allow: */members'
this.href('edit'),
this.layout.href(),
this.href('main.css'),
this.href('main.js'),
this.members.href()
];
const robotsTxt = root.renderSkinAsString('Site#robots');
const robots = new Robots(this.href('robots.txt'), robotsTxt + overrides.join('\n'));
return !robots.isAllowed(path.href() + req.action, req.getHeader('user-agent'));
const robots = new Robots(this.href('robots.txt'), robotsTxt);
const href = path.href(req.action);
const fullUrl = (href.includes('://') ? '' : this.href()) + href.slice(1);
return !overrides.some(href => fullUrl.includes(href))
&& !robots.isAllowed(fullUrl, req.getHeader('user-agent'));
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -125,6 +125,7 @@ global.messages['de'] = {
"Edit Poll": "Umfrage bearbeiten",
"Edit Story": "Beitrag bearbeiten",
"Edit the filter in the site settings.": "Der Filter kann in den Einstellungen bearbeitet werden.",
"Edit the rules in the <a href=\"{0}Site/robots/edit\">robots.txt</a> skin.": "Bearbeiten Sie die Regeln im <a href=\"{0}Site/robots/edit\">robots.txt</a>-Skin.",
"Edit {0}.{1}": "{0}.{1} bearbeiten",
"Enabled": "Aktiviert",
"Enter one filter {0}pattern{1} per line to be applied on every URL in the referrer and backlink lists.": "Geben Sie ein {0}Filter-Schema{1} pro Zeile ein, das für jede Adresse in den Rückverweis-Listen angewendet werden soll.",
@ -290,6 +291,7 @@ global.messages['de'] = {
"Resource type (e.g. Story or Comment)": "Art der Ressource (z.B. Beitrag oder Kommentar)",
"Restricted": "Eingeschränkt",
"Results": "Ergebnis",
"Robot rules": "Regeln für Robots",
"Role": "Rolle",
"Running": "Laufende",
"Running Polls": "Laufende Umfragen",
@ -529,6 +531,8 @@ global.messages['de'] = {
"e-mail": "E-Mail",
"e.g. {0}": "z.B. {0}",
"enabled": "aktiviert",
"enforce": "erzwingen",
"enforced": "erzwingen",
"export": "Exportieren",
"featured": "sichtbar",
"file": "Datei",
@ -578,6 +582,7 @@ global.messages['de'] = {
"soon": "in Kürze",
"stories": "Beiträge",
"story": "Beitrag",
"suggest": "vorschlagen",
"tag": "Stichwort",
"tags": "Stichworte",
"tomorrow": "morgen",