feat(*.liquid): apply prettier to liquid templates
- offer to create tag when none is found while adding a link from cli - fix tag display in search
This commit is contained in:
parent
49e21d574e
commit
efe701f939
112 changed files with 1319 additions and 1134 deletions
|
@ -1,38 +1,38 @@
|
|||
import inquirer from 'inquirer';
|
||||
import { loadConfig } from '../config.js';
|
||||
import { initDirectusClient, searchItems, createItem } from '../directus/client.js';
|
||||
import inquirer from "inquirer";
|
||||
import { loadConfig } from "../config.js";
|
||||
import { initDirectusClient, searchItems, createItem } from "../directus/client.js";
|
||||
|
||||
export const addBlockedRobot = async () => {
|
||||
const config = await loadConfig();
|
||||
|
||||
initDirectusClient(config);
|
||||
|
||||
const robots = await searchItems('robots', '/');
|
||||
let rootRobot = robots.find((r) => r.path === '/');
|
||||
const robots = await searchItems("robots", "/");
|
||||
let rootRobot = robots.find((r) => r.path === "/");
|
||||
|
||||
if (!rootRobot) {
|
||||
console.log('ℹ️ No robots entry for `/` found. Creating one...');
|
||||
console.log("ℹ️ No robots entry for `/` found. Creating one...");
|
||||
|
||||
const newRobot = await createItem('robots', { path: '/' });
|
||||
const newRobot = await createItem("robots", { path: "/" });
|
||||
|
||||
rootRobot = newRobot.data || newRobot;
|
||||
|
||||
console.log('✅ Created robots rule for `/`');
|
||||
console.log("✅ Created robots rule for `/`");
|
||||
}
|
||||
|
||||
const { userAgent } = await inquirer.prompt({
|
||||
name: 'userAgent',
|
||||
message: '🤖 Enter the user-agent string to block:',
|
||||
validate: (input) => !!input || 'User-agent cannot be empty'
|
||||
name: "userAgent",
|
||||
message: "🤖 Enter the user-agent string to block:",
|
||||
validate: (input) => !!input || "User-agent cannot be empty"
|
||||
});
|
||||
|
||||
const createdAgent = await createItem('user_agents', {
|
||||
const createdAgent = await createItem("user_agents", {
|
||||
user_agent: userAgent
|
||||
});
|
||||
|
||||
const agentId = createdAgent.data?.id || createdAgent.id;
|
||||
|
||||
await createItem('robots_user_agents', {
|
||||
await createItem("robots_user_agents", {
|
||||
robots_id: rootRobot.id,
|
||||
user_agents_id: agentId
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue