Add common robots.txt patterns
This commit is contained in:
@@ -1,5 +1,9 @@
|
||||
<script setup>
|
||||
|
||||
import { useI18n } from 'vue-i18n';
|
||||
const i18n = useI18n();
|
||||
const t = i18n.t;
|
||||
|
||||
import { ref, onMounted } from 'vue';
|
||||
import { Button, FormGroup, Checkbox } from '@cloudron/pankow';
|
||||
import AppsModel from '../../models/AppsModel.js';
|
||||
@@ -8,8 +12,9 @@ const props = defineProps([ 'app' ]);
|
||||
|
||||
const appsModel = AppsModel.create();
|
||||
|
||||
function onAddDisableIndexing() {
|
||||
robotsTxt.value = '# Disable search engine indexing\n\nUser-agent: *\nDisallow: /';
|
||||
function addRobotsTxtPreset(pattern) {
|
||||
if (robotsTxt.value) robotsTxt.value += '\n';
|
||||
robotsTxt.value += pattern;
|
||||
}
|
||||
|
||||
const busy = ref(false);
|
||||
@@ -17,6 +22,14 @@ const robotsTxt = ref('');
|
||||
const csp = ref('');
|
||||
const hstsPreload = ref(false);
|
||||
|
||||
const commonRobotsTxtMenu = [
|
||||
{ label: t('app.security.robots.commonPattern.allowAll'), action: () => addRobotsTxtPreset('# Allow all\nUser-agent: *\nDisallow:') },
|
||||
{ label: t('app.security.robots.commonPattern.disallowAll'), action: () => addRobotsTxtPreset('# Disable search engine indexing\n\nUser-agent: *\nDisallow: /') },
|
||||
{ label: t('app.security.robots.commonPattern.disallowCommonBots'), action: () => addRobotsTxtPreset('# Disallow common bots\nUser-agent: Googlebot\nDisallow: /\n\nUser-agent: Bingbot\nDisallow: /\n\nUser-agent: Slurp\nDisallow: /\n\nUser-agent: DuckDuckBot\nDisallow: /\n\nUser-agent: Baiduspider\nDisallow: /\n\nUser-agent: YandexBot\nDisallow: /\n\nUser-agent: facebot\nDisallow: /\n\nUser-agent: ia_archiver\nDisallow: /') },
|
||||
{ label: t('app.security.robots.commonPattern.disallowAdminPaths'), action: () => addRobotsTxtPreset('# Disallow admin paths\nUser-agent: *\nDisallow: /admin/\nDisallow: /internal/\nDisallow: /private/') },
|
||||
{ label: t('app.security.robots.commonPattern.disallowApiPaths'), action: () => addRobotsTxtPreset('# Disallow API paths\nUser-agent: *\nDisallow: /api/\nDisallow: /v1/\nDisallow: /v2/') },
|
||||
];
|
||||
|
||||
async function onSubmit() {
|
||||
busy.value = true;
|
||||
|
||||
@@ -49,7 +62,7 @@ onMounted(() => {
|
||||
<FormGroup>
|
||||
<label for="robotsTxtInput" style="display: flex; justify-content: space-between;">
|
||||
<span>{{ $t('app.security.robots.title') }} <sup><a href="https://docs.cloudron.io/apps/#robotstxt" class="help" target="_blank"><i class="fa fa-question-circle"></i></a></sup></span>
|
||||
<Button small outline @click="onAddDisableIndexing()">{{ $t('app.security.robots.disableIndexingAction') }}</Button>
|
||||
<Button small outline :menu="commonRobotsTxtMenu">{{ $t('app.security.robots.insertCommonRobotsTxt') }}</Button>
|
||||
</label>
|
||||
<div description>{{ $t('app.security.robots.description') }}</div>
|
||||
<textarea id="robotsTxtInput" style="white-space: pre-wrap; font-family: monospace;" v-model="robotsTxt" rows="10"></textarea>
|
||||
|
||||
Reference in New Issue
Block a user