【提问1】

Chrome调用本地 everything.exe, everything 好像有本地 FTP 服务器?

【DeepSeek R1 回答】

是的,Everything 确实内置了 HTTP/FTP 服务器功能,这提供了一种相对安全的浏览器与本地应用交互的方式。以下是完整的实现方案:

通过 Everything 的 HTTP 服务器实现浏览器交互

Everything (v1.4+) 内置的 HTTP 服务器允许通过浏览器执行搜索操作:

  1. 启用 Everything HTTP 服务器

    • 打开 Everything → 工具 → 选项 → HTTP 服务器
    • 启用 HTTP 服务器(默认端口 8080)
    • 设置允许的访问权限(推荐设置为 127.0.0.1 仅限本地访问)
  2. HTML 页面通过 AJAX 调用 Everything

<!DOCTYPE html>
<html>
<body><input type="text" id="searchInput" placeholder="搜索文件..."><button onclick="searchEverything()">搜索</button><div id="results"></div><script>async function searchEverything() {const query = document.getElementById('searchInput').value;const response = await fetch(`http://localhost:8080/?search=${encodeURIComponent(query)}&json=1`);const data = await response.json();let resultsHTML = "<h3>搜索结果:</h3><ul>";data.results.forEach(file => {resultsHTML += `<li><a href="file:///${file.path}" target="_blank">${file.name}</a></li>`;});resultsHTML += "</ul>";document.getElementById("results").innerHTML = resultsHTML;}</script>
</body>
</html>

通过 Everything 的 FTP 服务器访问文件

Everything 也支持 FTP 服务器(需在设置中启用):

// 在页面中生成 FTP 链接
function generateFtpLink(path) {return `ftp://localhost:21/${encodeURI(path)}`;
}// 使用示例
document.getElementById('ftpLink').href = generateFtpLink("C:/Users/MyFile.txt");

进阶方案:通过 Native Messaging 深度集成

若需要执行更复杂的本地操作(如启动程序),需创建浏览器扩展:

  1. 创建扩展文件结构
everything-extension/
├── manifest.json
├── background.js
├── content.js
└── native-host/├── everything-host.bat└── everything-host.ps1
  1. manifest.json
{"manifest_version": 3,"name": "Everything 集成","version": "1.0","permissions": ["nativeMessaging"],"background": {"service_worker": "background.js"},"content_scripts": [{"matches": ["http://localhost/*"],"js": ["content.js"]}]
}
  1. 本地主机应用 (everything-host.ps1)
while ($true) {$input = [Console]::In.ReadLine()$command = $input | ConvertFrom-Json# 执行 Everything 命令if ($command.action -eq "launch") {Start-Process "C:\Path\To\Everything.exe" -ArgumentList "-search", $command.query[Console]::Out.WriteLine('{"status":"success"}')}
}
  1. 注册本地主机(注册表文件):
Windows Registry Editor Version 5.00[HKEY_LOCAL_MACHINE\SOFTWARE\Google\Chrome\NativeMessagingHosts\com.example.everything_host]
@="C:\\path\\to\\everything-host-manifest.json"
  1. 扩展通信脚本
// content.js
document.getElementById('launchBtn').addEventListener('click', () => {chrome.runtime.sendNativeMessage('com.example.everything_host', {action: "launch", query: "*.pdf"},response => console.log(response));
});

安全注意事项

  1. 限制 HTTP/FTP 服务器仅限本地访问(127.0.0.1
  2. 对用户输入进行严格过滤,防止路径遍历攻击
  3. 在扩展中使用最小权限原则
  4. 避免通过 FTP 传输敏感文件
  5. 所有本地主机脚本需进行代码签名

替代方案(无需 Everything)

若只需简单命令执行,可用 PowerShell 作为后端:

// Node.js 服务器
const express = require('express');
const { exec } = require('child_process');
const app = express();app.get('/run', (req, res) => {const cmd = req.query.cmd;exec(cmd, (error, stdout) => {res.send(stdout || error.message);});
});app.listen(3000);

然后在 HTML 中调用:

fetch('http://localhost:3000/run?cmd=dir').then(response => response.text()).then(data => console.log(data));

总结:Everything 的 HTTP/FTP 服务器是最安全便捷的浏览器集成方案。对于需要深度系统集成的场景,Native Messaging 扩展方案虽然复杂但功能最强大。普通用户推荐使用 HTTP 服务器方案即可满足大部分需求。


【提问2】

通过 Everything 的 FTP 服务器访问文件,这能出一个详细解决方案吗?chrome 能使用everything 搜索本地某目录里某文件吗

【DeepSeek R1 回答】

下面我将提供一个完整的详细解决方案,通过 Chrome 浏览器利用 Everything 的 FTP 服务器访问本地文件系统,并实现文件搜索功能。

完整解决方案:Chrome + Everything FTP 服务器集成

第一部分:Everything 配置

  1. 启用 Everything FTP 服务器

    • 打开 Everything → 工具 → 选项 → FTP 服务器
    • 勾选 “启用 FTP 服务器”
    • 配置设置:
      服务器名称: MyLocalFTP
      监听端口: 2121(避免使用 21 端口需要管理员权限)
      绑定到: 127.0.0.1(仅限本地访问)
      用户名: (留空表示匿名访问)
      密码: (留空)
      根目录: C:\(或您想要搜索的特定目录)
      
    • 保存设置
  2. 验证 FTP 服务器

    • 打开文件资源管理器,输入 ftp://127.0.0.1:2121
    • 应该能看到本地文件列表

第二部分:HTML/JavaScript 实现

<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Everything FTP 文件搜索器</title><style>body { font-family: 'Segoe UI', Arial, sans-serif; max-width: 800px; margin: 0 auto; padding: 20px; }.search-box { display: flex; margin-bottom: 20px; }#searchInput { flex: 1; padding: 10px; font-size: 16px; border: 1px solid #ddd; }#searchButton { padding: 10px 20px; background: #4285f4; color: white; border: none; cursor: pointer; }#results { list-style: none; padding: 0; }.file-item { padding: 10px; border-bottom: 1px solid #eee; }.file-item:hover { background-color: #f9f9f9; }.file-link { color: #1a73e8; text-decoration: none; }.file-link:hover { text-decoration: underline; }.file-info { font-size: 12px; color: #666; margin-top: 5px; }.loading { display: none; text-align: center; padding: 20px; }</style>
</head>
<body><h1>本地文件搜索器 (Everything FTP)</h1><div class="search-box"><input type="text" id="searchInput" placeholder="输入文件名或扩展名 (如: *.pdf project.docx)"><button id="searchButton">搜索</button></div><div class="loading" id="loadingIndicator"><p>正在搜索中... <span id="resultCount">0</span> 个结果</p></div><ul id="results"></ul><script>// Everything FTP 配置const FTP_HOST = '127.0.0.1';const FTP_PORT = 2121;const FTP_URL = `ftp://${FTP_HOST}:${FTP_PORT}/`;// 搜索状态let currentSearch = null;let resultCount = 0;// DOM 元素const searchInput = document.getElementById('searchInput');const searchButton = document.getElementById('searchButton');const resultsContainer = document.getElementById('results');const loadingIndicator = document.getElementById('loadingIndicator');const resultCountElement = document.getElementById('resultCount');// 初始化document.addEventListener('DOMContentLoaded', () => {searchButton.addEventListener('click', startSearch);searchInput.addEventListener('keyup', (e) => {if (e.key === 'Enter') startSearch();});});// 开始搜索function startSearch() {const query = searchInput.value.trim();if (!query) return;// 中止之前的搜索if (currentSearch) {currentSearch.abort();}// 重置结果resultsContainer.innerHTML = '';resultCount = 0;resultCountElement.textContent = '0';loadingIndicator.style.display = 'block';// 创建 Everything FTP 搜索 URLconst searchUrl = `${FTP_URL}?search=${encodeURIComponent(query)}`;// 创建 XMLHttpRequest 对象currentSearch = new XMLHttpRequest();currentSearch.open('GET', searchUrl, true);// 处理响应数据(流式处理)let buffer = '';currentSearch.onprogress = function(event) {const chunk = currentSearch.responseText.substring(buffer.length);buffer += chunk;// 处理接收到的数据processFTPResponse(buffer);resultCountElement.textContent = resultCount;};currentSearch.onload = function() {if (currentSearch.status === 200) {processFTPResponse(buffer);loadingIndicator.style.display = 'none';}};currentSearch.onerror = function() {loadingIndicator.style.display = 'none';resultsContainer.innerHTML = '<li class="file-item">连接FTP服务器失败。请确保Everything正在运行且FTP服务器已启用。</li>';};currentSearch.send();}// 处理FTP响应数据function processFTPResponse(data) {// 简单解析FTP列表格式const lines = data.split('\r\n');for (const line of lines) {if (!line.trim()) continue;// 解析文件信息(简化版,实际需要更复杂的解析)const parts = line.split(/\s+/);if (parts.length < 9) continue;const permissions = parts[0];const isDirectory = permissions[0] === 'd';const size = parts[4];const date = `${parts[5]} ${parts[6]} ${parts[7]}`;const filename = parts.slice(8).join(' ');const fullPath = filename;// 只显示文件(过滤目录)if (!isDirectory) {addFileResult(fullPath, size, date);}}}// 添加文件到结果列表function addFileResult(path, size, modifiedDate) {resultCount++;// 提取文件名和扩展名const filename = path.split('/').pop() || path;const extension = filename.split('.').pop() || '';// 创建文件链接const fileUrl = `${FTP_URL}${encodeURI(path)}`;const listItem = document.createElement('li');listItem.className = 'file-item';listItem.innerHTML = `<a href="${fileUrl}" class="file-link" download="${filename}">${filename}</a><div class="file-info">大小: ${formatFileSize(size)} | 修改日期: ${modifiedDate} | 类型: ${extension.toUpperCase()} 文件</div>`;resultsContainer.appendChild(listItem);}// 格式化文件大小function formatFileSize(bytes) {if (bytes < 1024) return bytes + ' B';if (bytes < 1048576) return (bytes / 1024).toFixed(1) + ' KB';return (bytes / 1048576).toFixed(1) + ' MB';}</script>
</body>
</html>

第三部分:使用说明

  1. 准备工作

    • 确保 Everything 正在运行且 FTP 服务器已启用
    • 在 Chrome 中打开此 HTML 文件(直接双击或通过 file:// 路径打开)
  2. 搜索功能

    • 在搜索框输入查询:
      • 使用 Everything 搜索语法:*.pdfproject.docx*.jpg width:1920 height:1080
      • 支持布尔运算符:ANDORNOT
    • 点击搜索或按 Enter 键
    • 结果将实时加载显示
  3. 文件操作

    • 点击文件名将下载该文件
    • 鼠标悬停在文件项上可查看详细信息

第四部分:安全增强配置

由于直接使用 FTP 存在安全风险,建议添加以下安全措施:

  1. Everything 设置

    ; Everything.ini 安全配置
    ftp_server_allow_anonymous=0
    ftp_server_username=chrome_user
    ftp_server_password=secure_password123
    ftp_server_root_path=C:\Users\Public\Share
    ftp_server_passive_mode=1
    
  2. HTML 身份验证

    // 在搜索URL中添加凭据
    const FTP_AUTH = 'chrome_user:secure_password123';
    const searchUrl = `ftp://${FTP_AUTH}@${FTP_HOST}:${FTP_PORT}/?search=${query}`;
    
  3. 限制文件类型

    // 在 addFileResult 函数中添加
    const allowedExtensions = ['pdf', 'docx', 'jpg', 'png'];
    if (!allowedExtensions.includes(extension.toLowerCase())) return;
    

第五部分:替代方案(推荐)

由于现代浏览器对 FTP 支持有限(Chrome 88+ 已禁用 FTP),推荐使用 Everything 的 HTTP 服务器方案:

// 使用 HTTP 服务器替代 FTP
const HTTP_EVERYTHING_URL = 'http://localhost:8080/';async function searchEverything() {const response = await fetch(`${HTTP_EVERYTHING_URL}?search=${query}&json=1`);const data = await response.json();data.results.forEach(file => {// 创建本地文件链接const fileUrl = `file:///${file.path.replace(/\\/g, '/')}`;addFileResult(file.path, file.size, file.date_modified);});
}

注意事项

  1. 浏览器限制

    • Chrome 88+ 默认禁用 FTP 支持
    • 文件下载可能被浏览器安全策略阻止
    • 本地文件访问需要用户授权
  2. 安全警告

    • 仅在受信任的环境中使用
    • 不要将 FTP 服务器暴露在公共网络
    • 设置强密码或使用 HTTP 服务器替代
  3. 性能优化

    • 限制返回结果数量(在 URL 中添加 &offset=0&count=100
    • 添加防抖机制避免频繁搜索
    • 使用 Web Workers 处理大型结果集
  4. 跨平台支持

    • Windows:完整支持
    • macOS/Linux:需要 Wine 或 CrossOver 运行 Everything

这个解决方案让您可以直接在 Chrome 浏览器中利用 Everything 的强大搜索功能访问本地文件系统,同时通过 FTP 服务器提供文件访问功能。对于现代浏览器,建议优先使用 Everything 的 HTTP 服务器方案以获得更好的兼容性。


【提问3】

通过 Everything 的 HTTP 服务器访问文件,这能出一个详细解决方案吗?chrome 能使用everything 搜索本地某目录里某文件吗

【DeepSeek R1 回答】

Everything HTTP 服务器集成解决方案

下面我将提供一个完整的解决方案,通过 Chrome 浏览器利用 Everything 的 HTTP 服务器实现本地文件搜索和访问功能。

整体思路

  1. 配置 Everything 的 HTTP 服务器
  2. 创建 HTML 页面调用 Everything API
  3. 实现搜索功能和结果展示
  4. 提供文件预览和下载功能

完整解决方案

<!DOCTYPE html>
<html lang="zh-CN">
<head><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><title>Everything 本地文件搜索器</title><style>:root {--primary-color: #4285f4;--secondary-color: #34a853;--background-color: #f8f9fa;--card-color: #ffffff;--text-color: #202124;--border-color: #dadce0;}* {box-sizing: border-box;margin: 0;padding: 0;}body {font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;background-color: var(--background-color);color: var(--text-color);line-height: 1.6;padding: 20px;max-width: 1200px;margin: 0 auto;}header {text-align: center;margin-bottom: 30px;padding: 20px 0;border-bottom: 1px solid var(--border-color);}h1 {color: var(--primary-color);font-size: 2.5rem;margin-bottom: 10px;}.subtitle {color: #5f6368;font-size: 1.1rem;max-width: 700px;margin: 0 auto;}.search-container {background-color: var(--card-color);border-radius: 8px;box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);padding: 25px;margin-bottom: 30px;}.search-box {display: flex;gap: 10px;margin-bottom: 20px;}#searchInput {flex: 1;padding: 15px;font-size: 16px;border: 1px solid var(--border-color);border-radius: 4px;transition: border-color 0.3s;}#searchInput:focus {outline: none;border-color: var(--primary-color);box-shadow: 0 0 0 2px rgba(66, 133, 244, 0.2);}#searchButton {padding: 15px 25px;background-color: var(--primary-color);color: white;border: none;border-radius: 4px;font-size: 16px;cursor: pointer;transition: background-color 0.3s;}#searchButton:hover {background-color: #3367d6;}.filters {display: flex;gap: 15px;flex-wrap: wrap;margin-bottom: 20px;}.filter-group {flex: 1;min-width: 200px;}.filter-group label {display: block;margin-bottom: 5px;font-weight: 500;}.filter-group select, .filter-group input {width: 100%;padding: 10px;border: 1px solid var(--border-color);border-radius: 4px;}.results-container {background-color: var(--card-color);border-radius: 8px;box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24);overflow: hidden;}.results-header {padding: 15px 20px;background-color: #f5f5f5;border-bottom: 1px solid var(--border-color);display: flex;justify-content: space-between;align-items: center;}#resultCount {font-weight: 500;}#results {max-height: 500px;overflow-y: auto;}.result-item {padding: 15px 20px;border-bottom: 1px solid var(--border-color);display: flex;align-items: center;}.result-item:hover {background-color: #f8f9fa;}.file-icon {width: 32px;height: 32px;margin-right: 15px;display: flex;align-items: center;justify-content: center;color: #5f6368;}.file-icon img {max-width: 100%;max-height: 100%;}.file-info {flex: 1;min-width: 0;}.file-name {font-weight: 500;margin-bottom: 5px;white-space: nowrap;overflow: hidden;text-overflow: ellipsis;}.file-details {display: flex;gap: 15px;font-size: 0.85rem;color: #5f6368;}.file-actions {display: flex;gap: 10px;}.action-btn {padding: 8px 12px;background-color: #f1f3f4;border: none;border-radius: 4px;cursor: pointer;transition: background-color 0.3s;}.action-btn:hover {background-color: #e8eaed;}.preview-btn {background-color: #f8f9fa;color: var(--primary-color);}.download-btn {background-color: var(--secondary-color);color: white;}.loading-container {display: none;text-align: center;padding: 40px;}.loading-spinner {border: 4px solid rgba(0, 0, 0, 0.1);border-top: 4px solid var(--primary-color);border-radius: 50%;width: 40px;height: 40px;animation: spin 1s linear infinite;margin: 0 auto 20px;}@keyframes spin {0% { transform: rotate(0deg); }100% { transform: rotate(360deg); }}.no-results {text-align: center;padding: 40px;color: #5f6368;}.error-message {background-color: #fce8e6;color: #d93025;padding: 15px;border-radius: 4px;margin-top: 20px;display: none;}.preview-container {display: none;position: fixed;top: 0;left: 0;width: 100%;height: 100%;background-color: rgba(0,0,0,0.8);z-index: 1000;padding: 20px;}.preview-content {background-color: white;border-radius: 8px;max-width: 900px;max-height: 90vh;margin: 20px auto;overflow: auto;position: relative;}.preview-header {padding: 15px 20px;background-color: #f5f5f5;display: flex;justify-content: space-between;align-items: center;position: sticky;top: 0;z-index: 10;}.close-preview {background: none;border: none;font-size: 1.5rem;cursor: pointer;color: #5f6368;}.preview-body {padding: 20px;}.preview-body img, .preview-body video {max-width: 100%;display: block;margin: 0 auto;}.preview-body audio {width: 100%;}footer {text-align: center;margin-top: 40px;padding: 20px 0;color: #5f6368;font-size: 0.9rem;border-top: 1px solid var(--border-color);}@media (max-width: 768px) {.search-box {flex-direction: column;}.file-details {flex-wrap: wrap;gap: 8px;}.result-item {flex-direction: column;align-items: flex-start;}.file-actions {margin-top: 10px;width: 100%;}.action-btn {flex: 1;}}</style>
</head>
<body><header><h1>Everything 本地文件搜索器</h1><p class="subtitle">通过 Everything HTTP 服务器实现本地文件搜索、预览和管理功能</p></header><main><section class="search-container"><div class="search-box"><input type="text" id="searchInput" placeholder="输入文件名、扩展名或路径 (如: *.pdf project.docx)" autofocus><button id="searchButton">搜索文件</button></div><div class="filters"><div class="filter-group"><label for="fileType">文件类型</label><select id="fileType"><option value="">所有文件类型</option><option value=".pdf">PDF 文档</option><option value=".doc,.docx">Word 文档</option><option value=".xls,.xlsx">Excel 表格</option><option value=".jpg,.jpeg,.png,.gif">图片文件</option><option value=".mp4,.avi,.mov">视频文件</option><option value=".mp3,.wav">音频文件</option></select></div><div class="filter-group"><label for="searchPath">搜索路径</label><input type="text" id="searchPath" placeholder="如: C:\Projects\ D:\Documents\"></div><div class="filter-group"><label for="sortBy">排序方式</label><select id="sortBy"><option value="date_modified:desc">最新修改</option><option value="date_modified:asc">最早修改</option><option value="size:desc">最大文件</option><option value="size:asc">最小文件</option><option value="name:asc">名称 (A-Z)</option><option value="name:desc">名称 (Z-A)</option></select></div></div><div class="error-message" id="errorMessage">无法连接到 Everything HTTP 服务器。请确保 Everything 正在运行且 HTTP 服务器已启用。</div></section><section class="results-container"><div class="results-header"><h2>搜索结果</h2><div id="resultCount">0 个文件</div></div><div class="loading-container" id="loadingIndicator"><div class="loading-spinner"></div><p>正在搜索中...</p></div><div id="results"><div class="no-results"><p>输入搜索条件并点击"搜索文件"按钮开始搜索</p></div></div></section></main><div class="preview-container" id="previewContainer"><div class="preview-content"><div class="preview-header"><h3 id="previewFileName">文件预览</h3><button class="close-preview" id="closePreview">&times;</button></div><div class="preview-body" id="previewBody"></div></div></div><footer><p>Everything 本地文件搜索器 &copy; 2023 | 需要 Everything v1.4+ 和启用的 HTTP 服务器</p></footer><script>// Everything HTTP 服务器配置const EVERYTHING_HTTP_URL = "http://localhost:8080";// DOM 元素const searchInput = document.getElementById('searchInput');const searchButton = document.getElementById('searchButton');const fileTypeSelect = document.getElementById('fileType');const searchPathInput = document.getElementById('searchPath');const sortBySelect = document.getElementById('sortBy');const resultsContainer = document.getElementById('results');const resultCountElement = document.getElementById('resultCount');const loadingIndicator = document.getElementById('loadingIndicator');const errorMessage = document.getElementById('errorMessage');const previewContainer = document.getElementById('previewContainer');const previewBody = document.getElementById('previewBody');const previewFileName = document.getElementById('previewFileName');const closePreview = document.getElementById('closePreview');// 文件图标映射const fileIcons = {'folder': '📁','pdf': '📄','doc': '📝','docx': '📝','xls': '📊','xlsx': '📊','jpg': '🖼️','jpeg': '🖼️','png': '🖼️','gif': '🖼️','mp4': '🎬','avi': '🎬','mov': '🎬','mp3': '🎵','wav': '🎵','exe': '⚙️','zip': '📦','rar': '📦','default': '📄'};// 初始化document.addEventListener('DOMContentLoaded', () => {searchButton.addEventListener('click', performSearch);searchInput.addEventListener('keyup', (e) => {if (e.key === 'Enter') performSearch();});closePreview.addEventListener('click', () => {previewContainer.style.display = 'none';});// 测试连接testEverythingConnection();});// 测试 Everything 连接async function testEverythingConnection() {try {const response = await fetch(`${EVERYTHING_HTTP_URL}/?json=1&search=test`);if (!response.ok) throw new Error('Connection failed');errorMessage.style.display = 'none';} catch (error) {errorMessage.style.display = 'block';console.error('Everything connection test failed:', error);}}// 执行搜索async function performSearch() {const query = searchInput.value.trim();if (!query) return;// 显示加载状态loadingIndicator.style.display = 'block';resultsContainer.innerHTML = '';try {// 构建搜索参数let searchParams = new URLSearchParams();searchParams.append('search', query);searchParams.append('json', '1');// 添加文件类型过滤const fileType = fileTypeSelect.value;if (fileType) {searchParams.append('ext', fileType);}// 添加路径过滤const searchPath = searchPathInput.value.trim();if (searchPath) {searchParams.append('path', searchPath);}// 添加排序const [sortField, sortOrder] = sortBySelect.value.split(':');searchParams.append('sort', sortField);searchParams.append('ascending', sortOrder === 'asc' ? '1' : '0');// 限制结果数量searchParams.append('count', '100');// 调用 Everything APIconst response = await fetch(`${EVERYTHING_HTTP_URL}/?${searchParams.toString()}`);if (!response.ok) {throw new Error(`HTTP error! status: ${response.status}`);}const data = await response.json();displayResults(data);} catch (error) {console.error('搜索失败:', error);resultsContainer.innerHTML = `<div class="no-results"><p>搜索失败: ${error.message}</p><p>请确保 Everything 正在运行且 HTTP 服务器已启用</p></div>`;errorMessage.style.display = 'block';} finally {loadingIndicator.style.display = 'none';}}// 显示搜索结果function displayResults(data) {if (!data || !data.results || data.results.length === 0) {resultsContainer.innerHTML = `<div class="no-results"><p>没有找到匹配的文件</p><p>尝试不同的搜索关键词或调整筛选条件</p></div>`;resultCountElement.textContent = '0 个文件';return;}resultCountElement.textContent = `${data.results.length} 个文件`;let resultsHTML = '';data.results.forEach(file => {const fileExt = getFileExtension(file.name);const icon = fileIcons[fileExt] || fileIcons.default;resultsHTML += `<div class="result-item"><div class="file-icon">${icon}</div><div class="file-info"><div class="file-name" title="${file.path}">${file.name}</div><div class="file-details"><span>路径: ${truncatePath(file.path, 50)}</span><span>大小: ${formatFileSize(file.size)}</span><span>修改: ${formatDate(file.date_modified)}</span></div></div><div class="file-actions"><button class="action-btn preview-btn" data-path="${encodeURIComponent(file.path)}">预览</button><button class="action-btn download-btn" data-path="${encodeURIComponent(file.path)}">下载</button></div></div>`;});resultsContainer.innerHTML = resultsHTML;// 添加事件监听器document.querySelectorAll('.preview-btn').forEach(btn => {btn.addEventListener('click', (e) => {const filePath = decodeURIComponent(e.target.dataset.path);previewFile(filePath);});});document.querySelectorAll('.download-btn').forEach(btn => {btn.addEventListener('click', (e) => {const filePath = decodeURIComponent(e.target.dataset.path);downloadFile(filePath);});});}// 预览文件function previewFile(filePath) {const fileExt = getFileExtension(filePath).toLowerCase();const fileName = filePath.split('\\').pop();previewFileName.textContent = fileName;previewBody.innerHTML = '';// 根据文件类型显示不同预览if (['jpg', 'jpeg', 'png', 'gif'].includes(fileExt)) {previewBody.innerHTML = `<img src="${EVERYTHING_HTTP_URL}/?thumb=${encodeURIComponent(filePath)}" alt="${fileName}" onerror="this.src='https://via.placeholder.com/600x400?text=无法预览图片'">`;} else if (['mp4', 'avi', 'mov'].includes(fileExt)) {previewBody.innerHTML = `<video controls><source src="${EVERYTHING_HTTP_URL}/?download=${encodeURIComponent(filePath)}" type="video/${fileExt === 'mp4' ? 'mp4' : fileExt === 'mov' ? 'quicktime' : 'x-msvideo'}">您的浏览器不支持视频预览</video>`;}else if (['mp3', 'wav'].includes(fileExt)) {previewBody.innerHTML = `<audio controls><source src="${EVERYTHING_HTTP_URL}/?download=${encodeURIComponent(filePath)}" type="audio/${fileExt === 'mp3' ? 'mpeg' : 'wav'}">您的浏览器不支持音频预览</audio>`;}else if (fileExt === 'pdf') {previewBody.innerHTML = `<iframe src="${EVERYTHING_HTTP_URL}/?download=${encodeURIComponent(filePath)}" width="100%" height="600px" style="border: none;"></iframe>`;}else {previewBody.innerHTML = `<p>此文件类型不支持预览</p><p>文件路径: ${filePath}</p><p>大小: ${formatFileSize(getFileSizeFromPath(filePath))}</p>`;}previewContainer.style.display = 'block';}// 下载文件function downloadFile(filePath) {const fileName = filePath.split('\\').pop();const downloadUrl = `${EVERYTHING_HTTP_URL}/?download=${encodeURIComponent(filePath)}`;const a = document.createElement('a');a.href = downloadUrl;a.download = fileName;document.body.appendChild(a);a.click();document.body.removeChild(a);}// 辅助函数function getFileExtension(filename) {return filename.split('.').pop().toLowerCase();}function formatFileSize(bytes) {if (bytes === 0) return '0 B';const k = 1024;const sizes = ['B', 'KB', 'MB', 'GB'];const i = Math.floor(Math.log(bytes) / Math.log(k));return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + ' ' + sizes[i];}function formatDate(dateString) {const date = new Date(dateString);return date.toLocaleDateString() + ' ' + date.toLocaleTimeString();}function truncatePath(path, maxLength) {if (path.length <= maxLength) return path;const parts = path.split('\\');let result = '';for (let i = parts.length - 1; i >= 0; i--) {const newPart = '...\\' + parts.slice(i).join('\\');if (newPart.length <= maxLength) {return newPart;}}return '...\\' + path.slice(-maxLength + 4);}function getFileSizeFromPath(filePath) {// 在实际应用中,这里应该通过API获取文件大小// 此处仅用于演示return Math.floor(Math.random() * 10000000);}</script>
</body>
</html>

Everything 配置指南

步骤 1: 启用 HTTP 服务器

  1. 打开 Everything → 工具 → 选项 → HTTP 服务器
  2. 启用 HTTP 服务器
  3. 设置端口 (默认为 8080)
  4. 绑定到 127.0.0.1 (仅限本地访问)
  5. 勾选"允许文件下载"和"允许文件浏览"
  6. 保存设置

步骤 2: 高级配置 (可选)

在 Everything.ini 文件中添加以下配置以增强功能:

http_server_port=8080
http_server_bind_address=127.0.0.1
http_server_allow_http=1
http_server_allow_download=1
http_server_allow_file_browsing=1
http_server_thumbnails=1

功能说明

  1. 文件搜索

    • 支持文件名、扩展名和路径搜索
    • 可使用 Everything 高级搜索语法 (如 *.pdf, project.docx, size:>10MB)
  2. 筛选功能

    • 按文件类型筛选 (文档、图片、视频等)
    • 按路径筛选 (如 C:\Projects\)
    • 多种排序方式 (日期、大小、名称)
  3. 文件操作

    • 预览功能 (支持图片、视频、音频和PDF)
    • 文件下载
    • 文件详细信息查看
  4. 响应式设计

    • 适配桌面和移动设备
    • 美观的用户界面

使用说明

  1. 确保 Everything 正在运行且 HTTP 服务器已启用
  2. 在 Chrome 中打开此 HTML 文件
  3. 输入搜索关键字并点击"搜索文件"按钮
  4. 浏览搜索结果,可点击"预览"查看文件内容或"下载"获取文件

安全注意事项

  1. 仅限本地访问:HTTP 服务器应绑定到 127.0.0.1
  2. 访问控制:如果需要,可设置用户名和密码
  3. 文件权限:避免暴露敏感目录
  4. 浏览器限制:部分文件类型预览需要浏览器支持

此解决方案提供了一种安全、高效的方式来通过 Chrome 浏览器搜索和访问本地文件,充分利用了 Everything 强大的搜索能力和 HTTP 服务器的灵活性。在这里插入图片描述

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。
如若转载,请注明出处:http://www.pswp.cn/news/907769.shtml
繁体地址,请注明出处:http://hk.pswp.cn/news/907769.shtml
英文地址,请注明出处:http://en.pswp.cn/news/907769.shtml

如若内容造成侵权/违法违规/事实不符,请联系英文站点网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

Java八股文智能体——Agent提示词(Prompt)

这个智能体能够为正在学习Java八股文的同学提供切实帮助&#xff1a;不仅可以帮你优化答案表述&#xff0c;还能直接解答八股文相关问题——它会以面试者的视角&#xff0c;给出贴合求职场景的专业回答。 将以下内容发送给任何一个LLM&#xff0c;他会按照你提示词的内容&…

Android 缓存应用冻结器(Cached Apps Freezer)

一、核心功能与原理 1. 功能概述 目标&#xff1a;通过冻结后台缓存应用的进程&#xff0c;减少其对 CPU、内存等系统资源的消耗&#xff0c;优化设备性能与续航。适用场景&#xff1a;针对行为不当的后台应用&#xff08;如后台偷偷运行代码、占用 CPU&#xff09;&#xff…

内存管理 : 06 内存换出

内存换出的重要性及与换入的关系 现在我们讲第25讲&#xff0c;主题是内存的换出&#xff08;swipe out&#xff09;。实际上&#xff0c;上一讲我们讲的是内存的换入&#xff0c;而这一节聚焦于内存的换出。 换入和换出必须合在一起工作&#xff0c;不能只有换入而没有换出。…

第一节 51单片机概述

目录 一、单片机系统组成 &#xff08;一&#xff09;、单片机硬件系统 &#xff08;二&#xff09;单片机的软件系统 二、STC89C52单片机 &#xff08;1&#xff09;、基本信息 &#xff08;2&#xff09;、命名规则 &#xff08;3&#xff09;、单片机内部结构图 &am…

前端面试准备-4

1.React Router的history模式中&#xff0c;push和replace有什么区别 都是用于页面导航&#xff0c;但是他们对浏览器历史记录的处理不一样。 ①&#xff1a;push是在浏览历史栈里加入一条新的浏览历史&#xff0c;点击返回键会返回上一个页面 ②;replace是替换当前历史记录…

【机器学习基础】机器学习入门核心:Jaccard相似度 (Jaccard Index) 和 Pearson相似度 (Pearson Correlation)

机器学习入门核心&#xff1a;Jaccard相似度 &#xff08;Jaccard Index&#xff09; 和 Pearson相似度 &#xff08;Pearson Correlation&#xff09; 一、算法逻辑Jaccard相似度 (Jaccard Index)**Pearson相似度 (Pearson Correlation)** 二、算法原理与数学推导1. Jaccard相…

Unity3D仿星露谷物语开发57之保存库存信息到文件

1、目标 保存下面库存栏中信息到文件中。 2、修改SceneSave.cs脚本 添加2行代码&#xff1a; 3、修改InventoryManager对象 添加Generate GUID组件。 4、修改InventoryManager.cs脚本 添加继承自ISaveable 添加属性信息&#xff1a; private string _iSaveableUniqueID;pub…

测量3D翼片的距离与角度

1&#xff0c;目的。 测量3D翼片的距离与角度。说明&#xff1a; 标注A 红色框选的区域即为翼片&#xff0c;本示例的3D 对象共有3个翼片待测。L1与L2的距离、L1与L2的角度即为所求的翼片距离与角度。 2&#xff0c;原理。 使用线结构光模型&#xff08;标定模式&#xff0…

深入理解 SQL 的 JOIN 查询:从基础到高级的第一步

在处理数据库时&#xff0c;我们常常需要从多个表中提取数据。比如想知道一个城市的天气情况&#xff0c;同时又想知道这个城市的具体位置。这就需要将 weather 表和 cities 表结合起来查询。这种操作在 SQL 中被称为 JOIN 查询。 现在看下两种表的情况 1.weather 表&#xff…

上传头像upload的简易方法,转base64调接口的

1.首页使用el-image显示数据&#xff0c;用的是转base64后端返给的 <el-table-column prop"avatar" align"center" label"头像"><template #default"scope"><el-image style"height: 40px;width: 40px;" :sr…

[AD] CrownJewel-1 Logon 4799+vss-ShadowCopy+NTDS.dit/SYSTEM+$MFT

QA QA攻擊者可以濫用 vssadmin 實用程式來建立卷影快照&#xff0c;然後提取 NTDS.dit 等敏感檔案來繞過安全機制。確定卷影複製服務進入運作狀態的時間。2024-05-14 03:42:16建立卷影快照時&#xff0c;磁碟區複製服務會使用機器帳戶驗證權限並列舉使用者群組。找到卷影複製過…

rtpmixsound:实现音频混音攻击!全参数详细教程!Kali Linux教程!

简介 一种将预先录制的音频与指定目标音频流中的音频&#xff08;即 RTP&#xff09;实时混合的工具。 一款用于将预先录制的音频与指定目标音频流中的音频&#xff08;即 RTP&#xff09;实时混合的工具。该工具创建于 2006 年 8 月至 9 月之间。该工具名为 rtpmixsound。它…

GitHub 趋势日报 (2025年05月28日)

&#x1f4ca; 由 TrendForge 系统生成 | &#x1f310; https://trendforge.devlive.org/ &#x1f310; 本日报中的项目描述已自动翻译为中文 &#x1f4c8; 今日获星趋势图 今日获星趋势图 2379 agenticSeek 1521 computer-science 841 n8n 577 langflow 351 qlib 282 skt…

threejsPBR材质与纹理贴图

1. PBR材质简介 本节课没有具体的代码&#xff0c;就是给大家科普一下PBR材质&#xff0c;所谓PBR就是&#xff0c;基于物理的渲染(physically-based rendering)。 Three.js提供了两个PBR材质相关的APIMeshStandardMaterial和MeshPhysicalMaterial,MeshPhysicalMaterial是Mes…

Android 12系统源码_多屏幕(四)自由窗口模式

一、小窗模式 1.1 小窗功能的开启方式 开发者模式下开启小窗功能 adb 手动开启 adb shell settings put global enable_freeform_support 1 adb shell settings put global force_resizable_activities 11.2 源码配置 copy file # add for freedom PRODUCT_COPY_FILES …

C# 将HTML文档、HTML字符串转换为图片

在.NET开发中&#xff0c;将HTML内容转换为图片的需求广泛存在于报告生成、邮件内容存档、网页快照等场景。Free Spire.Doc for .NET作为一款免费的专业文档处理库&#xff0c;无需Microsoft Word依赖&#xff0c;即可轻松实现这一功能。本文将深入解析HTML文档和字符串转图片两…

【HTML-15.2】HTML表单按钮全面指南:从基础到高级实践

表单按钮是网页交互的核心元素&#xff0c;作为用户提交数据、触发操作的主要途径&#xff0c;其重要性不言而喻。本文将系统性地介绍HTML表单按钮的各种类型、使用场景、最佳实践以及高级技巧&#xff0c;帮助开发者构建更高效、更易用的表单交互体验。 1. 基础按钮类型 1.1…

吴恩达MCP课程(4):connect_server_mcp_chatbot

目录 完整代码代码解释1. 导入和初始化2. 类型定义3. MCP_ChatBot 类初始化4. 查询处理 (process_query)5. 服务器连接管理6. 核心特性总结 示例 完整代码 原课程代码是用Anthropic写的&#xff0c;下面代码是用OpenAI改写的&#xff0c;模型则用阿里巴巴的模型做测试 .env 文…

C++内存学习

引入 在实例化对象时&#xff0c;不管是编译器还是我们自己&#xff0c;会使用构造函数给成员变量一个合适的初始值。 但是经过构造函数之后&#xff0c;我们还不能将其称为成员变量的初始化&#xff1a; 构造函数中的语句只能称为赋初值&#xff0c;而不能称作初始化 因为初…

MySQL 大战 PostgreSQL

一、底层架构对比 ​​维度​​​​MySQL​​​​PostgreSQL​​​​存储引擎​​多引擎支持&#xff08;InnoDB、MyISAM等&#xff09;单一存储引擎&#xff08;支持扩展如Zheap、Zedstore&#xff09;​​事务实现​​基于UNDO日志的MVCC基于堆表(Heap)的MVCC​​锁机制​​…