链接到 html 中的 samba 共享

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/37804/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-28 22:11:02  来源:igfitidea点击:

Link to samba shares in html

htmlsambasmb

提问by SCdF

First off if you're unaware, samba or smb == Windows file sharing, \\computer\share etc.

首先,如果您不知道,samba 或 smb == Windows 文件共享,\\computer\share 等。

I have a bunch of different files on a bunch of different computers. It's mostly media and there is quite a bit of it. I'm looking into various ways of consolidating this into something more manageable.

我在一堆不同的计算机上有一堆不同的文件。它主要是媒体,而且有很多。我正在研究将其整合为更易于管理的各种方法。

Currently there are a few options I'm looking at, the mostinsane of which is some kind of samba share indexer that would generate a list of things shared on the various samba servers I tell it about and upload them to a website which could then be searched and browsed.

目前我正在查看一些选项,其中疯狂的是某种 samba 共享索引器,它会生成我告诉它的各种 samba 服务器上共享的内容列表并将它们上传到一个网站,然后被搜索和浏览。

It's a cheap solution, OK?

这是一个便宜的解决方案,好吗?

Ignoring the fact that the idea is obviously a couple of methods short of a class, do you chaps know of any way to link to samba file shares in html in a cross-browser way? In windows one does \\computer\share, in linux one does smb://computer/share, neither of which work afaik from browsers that aren't also used as file managers (e.g. any browser that isn't Internet Explorer).

忽略这个想法显然是一个类的几个方法的事实,你们知道有什么方法可以跨浏览器链接到 html 中的 samba 文件共享吗?在 Windows 中,\\computer\share 是 \\computer\share,在 linux 中是 smb://computer/share,这两个都不能从不用作文件管理器的浏览器(例如,不是 Internet Explorer 的任何浏览器)中工作。

Some Clarifications

一些说明

  • The computers used to access this website are a mixture of WIndows (XP) and Linux (Ubuntu) with a mixture of browsers (Opera and Firefox).
  • In linux entering smb://computer/share only seems to work in Nautilus (and presumably Konqueror / Dolphin for you KDE3.5/4 people). It doesn't work in Firefox or Opera (Firefox does nothing, Opera complains the URL is invalid).
  • I don't have a Windows box handy atm so I'm unsure if \\computer\share works in anything apart from IE (e.g. Firefox / Opera).
  • If you have a better idea for consolidating a bunch of random samba shares (it certainly can't get much worse than mine ;-)) it's worth knowing that there is no guarantee that any of the servers I would be wanting to index / consolidate would be up at any particular moment. Moreover, I wouldn't want the knowledge of what they have shared lost or hidden just because they weren't available. I would want to know that they share 'foo' but they are currently down.
  • 用于访问本网站的计算机混合了 WINdows (XP) 和 Linux (Ubuntu) 以及混合浏览器(Opera 和 Firefox)。
  • 在 linux 中输入 smb://computer/share 似乎只适用于 Nautilus(对于 KDE3.5/4 人来说,可能是 Konqueror/Dolphin)。它在 Firefox 或 Opera 中不起作用(Firefox 什么也不做,Opera 抱怨 URL 无效)。
  • 我没有方便的 Windows 自动取款机,所以我不确定 \\computer\share 是否适用于 IE 之外的任何东西(例如 Firefox / Opera)。
  • 如果您对合并一堆随机 samba 共享有更好的想法(它肯定不会比我的更糟糕;-))值得知道的是,不能保证我想要索引/合并的任何服务器会在任何特定时刻上升。此外,我不希望仅仅因为他们不可用而丢失或隐藏他们共享的内容。我想知道他们共享“foo”,但他们目前已关闭。

采纳答案by SCdF

Hmm, protocol handlers look interesting.

嗯,协议处理程序看起来很有趣。

As Marksaid, in Windows protocol handlers can be dealt with at the OS level

正如马克所说,在 Windows 协议处理程序可以在操作系统级别处理

Protocol handlers can also be done at the browser level (which is preferred, as it is cross platform and doesn't involve installing anything).

协议处理程序也可以在浏览器级别完成(这是首选,因为它是跨平台的并且不涉及安装任何东西)。

Summary of how it works in Firefox
Summary of how it works in Opera

Firefox 中的工作原理
摘要 Opera 中的工作原理摘要

回答by Mark Brackett

I'd probably just setup Apache on the SAMBA servers and let it serve the files via HTTP. That'd give you a nice autoindex default page too, and you could just wget and concatenate each index for your master list.

我可能只是在 SAMBA 服务器上设置 Apache 并让它通过 HTTP 提供文件。这也将为您提供一个不错的自动索引默认页面,您只需 wget 并连接主列表的每个索引即可。

A couple of other thoughts:

一些其他的想法:

  1. file://server/share/file is the defacto Windows way of doing it
  2. You can register protocol handlersin Windows, so you could register smb and redirect it to file://. I'd suspect GNOME/KDE/etc. would offer the same.
  1. file://server/share/file 是事实上的 Windows 方式
  2. 您可以在 Windows 中注册协议处理程序,因此您可以注册 smb 并将其重定向到 file://。我怀疑 GNOME/KDE/等。会提供相同的。

回答by Dave Webb

To make the links work cross platform you could look at the User Agent either in a CGI script or in JavaScript and update your URLs appropriately.

为了使链接跨平台工作,您可以在 CGI 脚本或 JavaScript 中查看用户代理并适当地更新您的 URL。

Alternatively, if you want to consolidate SMB shares you could try using Microsoft DFS(which also works with Samba).

或者,如果您想合并 SMB 共享,您可以尝试使用Microsoft DFS(也适用于 Samba)。

You set up a DFS root and tell it about all the other SMB/Samba shares you have in your environment. Clients then connect to the root and see all the shares as if they were hosted on that single root machine; the root silently redirects clients to the correct system when they open a share.

您设置了一个 DFS 根目录,并告诉它您环境中的所有其他 SMB/Samba 共享。客户端然后连接到根并查看所有共享,就好像它们托管在该单个根机器上一样;当客户端打开共享时,root 会默默地将客户端重定向到正确的系统。

Think of it as like symbolic links or a virtual file system for SMB.

可以将其视为 SMB 的符号链接或虚拟文件系统。

It would solve your browsing problem. I'm not sure if it would solve your searching one.

它将解决您的浏览问题。我不确定它是否会解决您的搜索问题。