re-add luci app amule and app

This commit is contained in:
coolsnowwolf 2018-10-30 13:29:59 +08:00
parent 648a384b19
commit 2614b0bfcf
23 changed files with 3954 additions and 0 deletions

109
package/lean/amule/Makefile Normal file
View File

@ -0,0 +1,109 @@
#
# Copyright (C) 2007-2009 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=aMule
PKG_VERSION:=2.3.2
PKG_RELEASE:=2
PKG_REV=4b87b20
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-r$(PKG_REV).tar.bz2
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_VERSION:=$(PKG_REV)
PKG_SOURCE_URL:=https://github.com/amule-project/amule.git
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
PKG_BUILD_DEPENDS:=libgd libcryptopp
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/nls.mk
define Package/amule/config
config AMULE_CRYPTOPP_STATIC_LINKING
bool "Link libcryptopp statically"
default y
endef
define Package/amule
SUBMENU:=P2P
SECTION:=net
CATEGORY:=Network
TITLE:=A multi-platform eMule-like ed2k client
URL:=http://www.amule.org/
DEPENDS:=+libpng +libpthread +libncurses +libreadline +libwxbase +libupnp +libbfd \
$(ICONV_DEPENDS) $(INTL_DEPENDS) +!AMULE_CRYPTOPP_STATIC_LINKING:libcryptopp
endef
CONFIGURE_ARGS+= \
--disable-static \
--disable-rpath \
--with-gnu-ld \
--disable-ccache \
--disable-optimize \
--disable-profile \
--disable-monolithic \
--enable-amule-daemon \
--enable-amulecmd \
--enable-webserver \
--disable-amule-gui \
--disable-cas \
--disable-wxcas \
--disable-ed2k \
--disable-alc \
--disable-alcc \
--disable-fileview \
--disable-plasmamule \
--without-wxdebug \
--enable-dlp \
--enable-upnp \
--with-zlib="$(STAGING_DIR)/usr" \
--with-gdlib-prefix="$(STAGING_DIR)/usr" \
--with-libpng-prefix="$(STAGING_DIR)/usr" \
--with-wx-prefix="$(STAGING_DIR)/usr" \
--with-crypto-prefix="$(STAGING_DIR)/usr" \
--with-libiconv-prefix="$(ICONV_PREFIX)" \
--with-libintl-prefix="$(INTL_PREFIX)" \
--with-libupnp-prefix="$(STAGING_DIR)/usr" \
--without-x \
--disable-debug
TARGET_LDFLAGS += -liconv
define Build/Configure
cd $(PKG_BUILD_DIR) && sh ./autogen.sh
$(call Build/Configure/Default)
endef
ifeq ($(CONFIG_AMULE_CRYPTOPP_STATIC_LINKING),y)
SED_CMD:=sed
else
SED_CMD:=true
endif
define Build/Compile
$(SED_CMD) -i 's;^CRYPTOPP_LIBS.*;CRYPTOPP_LIBS \= "$(STAGING_DIR)/usr/lib/libcryptopp.a";g' \
$(PKG_BUILD_DIR)/src/Makefile
$(MAKE) -C $(PKG_BUILD_DIR) \
HOSTCC="$(HOSTCC)" \
DESTDIR="$(PKG_INSTALL_DIR)" \
all
endef
define Package/amule/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_DIR) $(1)/usr/share/amule/webserver
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/amule{cmd,d} $(1)/usr/bin/
$(INSTALL_BIN) $(PKG_BUILD_DIR)/src/webserver/src/amuleweb $(1)/usr/bin/
$(CP) $(PKG_BUILD_DIR)/src/webserver/default $(1)/usr/share/amule/webserver
endef
$(eval $(call BuildPackage,amule))

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,23 @@
diff -Naur a/m4/libupnp.m4 b/m4/libupnp.m4
--- a/m4/libupnp.m4 2016-10-06 19:01:54.000000000 +0800
+++ b/m4/libupnp.m4 2016-10-11 07:36:39.198318574 +0800
@@ -52,7 +52,6 @@
[export PKG_CONFIG_PATH=$withval/lib/pkgconfig])
dnl Check for libupnp >= MIN_LIBUPNP_VERSION
- AS_IF([test $cross_compiling = no], [
AC_MSG_CHECKING([for libupnp version >= MIN_LIBUPNP_VERSION])
AS_IF([test -n "$PKG_CONFIG"], [
AS_IF([$PKG_CONFIG libupnp --exists], [
@@ -79,11 +78,6 @@
])
AC_MSG_RESULT([$result$resultstr])
libupnp_error="libupnp >= MIN_LIBUPNP_VERSION not found$resultstr"
- ], [
-dnl Currently cross-compilation with libupnp is not supported.
- result=no
- libupnp_error="cross compiling"
- ])
dnl Execute the right action.
AS_IF([test ${result:-no} = yes], [$2], [$3])

View File

@ -0,0 +1,78 @@
diff --git a/src/amule.h b/src/amule.h
index f25702f..240c02d 100644
--- a/src/amule.h
+++ b/src/amule.h
@@ -553,6 +553,13 @@ class CamuleDaemonApp : public CamuleApp
int OnExit();
virtual int InitGui(bool geometry_enable, wxString &geometry_string);
+ // The GTK wxApps sets its file name conversion properly
+ // in wxApp::Initialize(), while wxAppConsole::Initialize()
+ // does not, leaving wxConvFile being set to wxConvLibc. File
+ // name conversion should be set otherwise amuled will abort to
+ // handle non-ASCII file names which monolithic amule can handle.
+ // This function are overrided to perform this.
+ virtual bool Initialize(int& argc_, wxChar **argv_);
#ifdef AMULED_APPTRAITS
struct sigaction m_oldSignalChildAction;
diff --git a/src/amuled.cpp b/src/amuled.cpp
index 486da59..86e1ff8 100644
--- a/src/amuled.cpp
+++ b/src/amuled.cpp
@@ -704,6 +704,41 @@ int CamuleDaemonApp::InitGui(bool ,wxString &)
return 0;
}
+bool CamuleDaemonApp::Initialize(int& argc_, wxChar **argv_)
+{
+ if ( !wxAppConsole::Initialize(argc_, argv_) ) {
+ return false;
+ }
+
+#ifdef __UNIX__
+ wxString encName;
+#if wxUSE_INTL
+ // if a non default locale is set,
+ // assume that the user wants his
+ // filenames in this locale too
+ encName = wxLocale::GetSystemEncodingName().Upper();
+
+ // But don't consider ASCII in this case.
+ if ( !encName.empty() ) {
+ if ( encName == wxT("US-ASCII") ) {
+ // This means US-ASCII when returned
+ // from GetEncodingFromName().
+ encName.clear();
+ }
+ }
+#endif // wxUSE_INTL
+
+ // in this case, UTF-8 is used by default.
+ if ( encName.empty() ) {
+ encName = wxT("UTF-8");
+ }
+
+ static wxConvBrokenFileNames fileconv(encName);
+ wxConvFileName = &fileconv;
+#endif // __UNIX__
+
+ return true;
+}
int CamuleDaemonApp::OnExit()
{
diff --git a/src/libs/common/Path.cpp b/src/libs/common/Path.cpp
index 28152a2..5efefd0 100644
--- a/src/libs/common/Path.cpp
+++ b/src/libs/common/Path.cpp
@@ -229,7 +229,8 @@ CPath::CPath(const wxString& filename)
}
wxCharBuffer fn = filename2char(filename);
- if (fn.data()) {
+ // add fn.length() for wx 3.x
+ if (fn.data()) {
// Filename is valid in the current locale. This means that
// it either originated from a (wx)system-call, or from a
// user with a properly setup system.

View File

@ -0,0 +1,174 @@
diff --git a/src/SearchList.cpp b/src/SearchList.cpp
index 32b28e9..342a18f 100644
--- a/src/SearchList.cpp
+++ b/src/SearchList.cpp
@@ -75,7 +75,7 @@ void ParsedSearchExpression(const CSearchExpr* pexpr)
int iOpNot = 0;
for (unsigned int i = 0; i < pexpr->m_aExpr.GetCount(); i++) {
- wxString str(pexpr->m_aExpr[i]);
+ const wxString& str = pexpr->m_aExpr[i];
if (str == SEARCHOPTOK_AND) {
iOpAnd++;
} else if (str == SEARCHOPTOK_OR) {
@@ -108,6 +108,25 @@ void ParsedSearchExpression(const CSearchExpr* pexpr)
// optimize search expression, if no OR nor NOT specified
if (iOpAnd > 0 && iOpOr == 0 && iOpNot == 0) {
+ // figure out if we can use a better keyword than the one the user selected
+ // for example most user will search like this "The oxymoronaccelerator 2", which would ask the node which indexes "the"
+ // This causes higher traffic for such nodes and makes them a viable target to attackers, while the kad result should be
+ // the same or even better if we ask the node which indexes the rare keyword "oxymoronaccelerator", so we try to rearrange
+ // keywords and generally assume that the longer keywords are rarer
+ if (/*thePrefs::GetRearrangeKadSearchKeywords() &&*/ !s_strCurKadKeyword.IsEmpty()) {
+ for (unsigned int i = 0; i < pexpr->m_aExpr.GetCount(); i++) {
+ if (pexpr->m_aExpr[i] != SEARCHOPTOK_AND) {
+ if (pexpr->m_aExpr[i] != s_strCurKadKeyword
+ && pexpr->m_aExpr[i].find_first_of(Kademlia::CSearchManager::GetInvalidKeywordChars()) == wxString::npos
+ && pexpr->m_aExpr[i].Find('"') != 0 // no quoted expressions as keyword
+ && pexpr->m_aExpr[i].length() >= 3
+ && s_strCurKadKeyword.length() < pexpr->m_aExpr[i].length())
+ {
+ s_strCurKadKeyword = pexpr->m_aExpr[i];
+ }
+ }
+ }
+ }
wxString strAndTerms;
for (unsigned int i = 0; i < pexpr->m_aExpr.GetCount(); i++) {
if (pexpr->m_aExpr[i] != SEARCHOPTOK_AND) {
@@ -285,7 +304,7 @@ void CSearchList::RemoveResults(long searchID)
}
-wxString CSearchList::StartNewSearch(uint32* searchID, SearchType type, const CSearchParams& params)
+wxString CSearchList::StartNewSearch(uint32* searchID, SearchType type, CSearchParams& params)
{
// Check that we can actually perform the specified desired search.
if ((type == KadSearch) && !Kademlia::CKademlia::IsRunning()) {
@@ -306,6 +325,16 @@ wxString CSearchList::StartNewSearch(uint32* searchID, SearchType type, const CS
m_resultType.Clear();
}
+ if (type == KadSearch) {
+ Kademlia::WordList words;
+ Kademlia::CSearchManager::GetWords(params.searchString, &words);
+ if (!words.empty()) {
+ params.strKeyword = words.front();
+ } else {
+ return _("No keyword for Kad search - aborting");
+ }
+ }
+
bool supports64bit = type == KadSearch ? true : theApp->serverconnect->GetCurrentServer() != NULL && (theApp->serverconnect->GetCurrentServer()->GetTCPFlags() & SRV_TCPFLG_LARGEFILES);
bool packetUsing64bit;
@@ -332,8 +361,7 @@ wxString CSearchList::StartNewSearch(uint32* searchID, SearchType type, const CS
// searchstring will get tokenized there
// The tab must be created with the Kad search ID, so searchID is updated.
- Kademlia::CSearch* search = Kademlia::CSearchManager::PrepareFindKeywords(
- params.searchString, data->GetLength(), data->GetRawBuffer(), *searchID);
+ Kademlia::CSearch* search = Kademlia::CSearchManager::PrepareFindKeywords(params.strKeyword, data->GetLength(), data->GetRawBuffer(), *searchID);
*searchID = search->GetSearchID();
m_currentSearch = *searchID;
@@ -632,7 +660,7 @@ void CSearchList::StopSearch(bool globalOnly)
}
-CSearchList::CMemFilePtr CSearchList::CreateSearchData(const CSearchParams& params, SearchType WXUNUSED(type), bool supports64bit, bool& packetUsing64bit)
+CSearchList::CMemFilePtr CSearchList::CreateSearchData(CSearchParams& params, SearchType type, bool supports64bit, bool& packetUsing64bit)
{
// Count the number of used parameters
unsigned int parametercount = 0;
@@ -659,14 +687,16 @@ CSearchList::CMemFilePtr CSearchList::CreateSearchData(const CSearchParams& para
_astrParserErrors.Empty();
_SearchExpr.m_aExpr.Empty();
+ s_strCurKadKeyword.Clear();
+ if (type == KadSearch) {
+ wxASSERT( !params.strKeyword.IsEmpty() );
+ s_strCurKadKeyword = params.strKeyword;
+ }
+
LexInit(params.searchString);
int iParseResult = yyparse();
LexFree();
-#ifdef __DEBUG__
- AddLogLineNS(CFormat(wxT("Search parsing result for \"%s\": %i"))
- % params.searchString % iParseResult);
-#endif
if (_astrParserErrors.GetCount() > 0) {
for (unsigned int i=0; i < _astrParserErrors.GetCount(); ++i) {
AddLogLineNS(CFormat(wxT("Error %u: %s\n")) % i % _astrParserErrors[i]);
@@ -681,21 +711,13 @@ CSearchList::CMemFilePtr CSearchList::CreateSearchData(const CSearchParams& para
return CMemFilePtr(NULL);
}
- #ifdef __DEBUG__
- wxString mes(wxT("Search expression:"));
- for (unsigned int i = 0; i < _SearchExpr.m_aExpr.GetCount(); i++) {
- mes << wxT(" ") << _SearchExpr.m_aExpr[i];
+ if (type == KadSearch && s_strCurKadKeyword != params.strKeyword) {
+ AddDebugLogLineN(logSearch, CFormat(wxT("Keyword was rearranged, using '%s' instead of '%s'")) % s_strCurKadKeyword % params.strKeyword);
+ params.strKeyword = s_strCurKadKeyword;
}
- AddLogLineNS(mes);
- AddLogLineNS(CFormat(wxT("Expression count: %i")) % _SearchExpr.m_aExpr.GetCount());
- #endif
parametercount += _SearchExpr.m_aExpr.GetCount();
- #ifdef __DEBUG__
- AddLogLineNS(CFormat(wxT("Parameters: %i")) % parametercount);
- #endif
-
/* Leave the unicode comment there, please... */
CSearchExprTarget target(data.get(), true /*I assume everyone is unicoded */ ? utf8strRaw : utf8strNone, supports64bit, packetUsing64bit);
diff --git a/src/SearchList.h b/src/SearchList.h
index 35b0fc6..6db7508 100644
--- a/src/SearchList.h
+++ b/src/SearchList.h
@@ -64,6 +64,8 @@ class CSearchList : public wxEvtHandler
//! The actual string to search for.
wxString searchString;
+ //! The keyword selected for Kad search
+ wxString strKeyword;
//! The type of files to search for (may be empty), one of ED2KFTSTR_*
wxString typeText;
//! The filename extension. May be empty.
@@ -90,7 +92,7 @@ class CSearchList : public wxEvtHandler
* @param params The search parameters, see CSearchParams.
* @return An empty string on success, otherwise an error-message.
*/
- wxString StartNewSearch(uint32* searchID, SearchType type, const CSearchParams& params);
+ wxString StartNewSearch(uint32* searchID, SearchType type, CSearchParams& params);
/** Stops the current search (global or Kad), if any is in progress. */
void StopSearch(bool globalOnly = false);
@@ -189,7 +191,7 @@ class CSearchList : public wxEvtHandler
typedef std::auto_ptr<CMemFile> CMemFilePtr;
/** Create a basic search-packet for the given search-type. */
- CMemFilePtr CreateSearchData(const CSearchParams& params, SearchType type, bool supports64bit, bool& packetUsing64bit);
+ CMemFilePtr CreateSearchData(CSearchParams& params, SearchType type, bool supports64bit, bool& packetUsing64bit);
//! Timer used for global search intervals.
diff --git a/src/kademlia/kademlia/SearchManager.cpp b/src/kademlia/kademlia/SearchManager.cpp
index e7f25d4..f9ee924 100644
--- a/src/kademlia/kademlia/SearchManager.cpp
+++ b/src/kademlia/kademlia/SearchManager.cpp
@@ -127,7 +127,7 @@ CSearch* CSearchManager::PrepareFindKeywords(const wxString& keyword, uint32_t s
wxString wstrKeyword = s->m_words.front();
- AddLogLineNS(CFormat(_("Keyword for search: %s")) % wstrKeyword);
+ AddDebugLogLineN(logSearch, CFormat(wxT("Keyword for search: %s")) % wstrKeyword);
// Kry - I just decided to assume everyone is unicoded
// GonoszTopi - seconded

View File

@ -0,0 +1,66 @@
#
# Copyright (C) 2009-2012 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=libcryptopp
PKG_VERSION:=5.6.4
PKG_RELEASE:=1
PKG_SOURCE:=cryptopp$(subst .,,$(PKG_VERSION)).zip
PKG_SOURCE_URL:=http://www.cryptopp.com/
PKG_MD5SUM:=4ee7e5cdd4a45a14756c169eaf2a77fc
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)/$(PKG_NAME)-$(PKG_VERSION)
CMAKE_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/libcryptopp
SECTION:=libs
CATEGORY:=Libraries
DEPENDS:=+libpthread +libstdcpp
TITLE:=Crypto++ is library for creating C++ programs which use cryptographic algorithms
URL:=http://packages.debian.org/sid/libcrypto++-dev
endef
define Package/package/libcryptopp
Crypto++ is library for creating C++ programs which use cryptographic algorithms.
The library uses a Pipes & Filters architecture with heavy use of templates and
abstract base classes.
endef
#CONFIGURE_ARGS += \
# --enable-static \
# --enable-shared
#TARGET_LDFLAGS += \
# -lpthread
CMAKE_OPTIONS += -DCMAKE_CXX_FLAGS="$(FPIC)"
CMAKE_OPTIONS += -DBUILD_STATIC=ON
CMAKE_OPTIONS += -DBUILD_SHARED=ON
UNPACK_CMD=cd $(PKG_BUILD_DIR) && unzip "$(DL_DIR)/$(PKG_SOURCE)"
define Build/Prepare
$(Build/Prepare/Default)
cd $(PKG_BUILD_DIR) && rm -f GNUmakefile GNUmakefile-cross
endef
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/include/cryptopp
$(CP) $(PKG_INSTALL_DIR)/usr/include/cryptopp/* $(1)/usr/include/cryptopp/
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcryptopp.{a,so*} $(1)/usr/lib/
endef
define Package/libcryptopp/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libcryptopp.so* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libcryptopp))

View File

@ -0,0 +1,15 @@
# Copyright (C) 2016 Openwrt.org
#
# This is free software, licensed under the Apache License, Version 2.0 .
#
include $(TOPDIR)/rules.mk
LUCI_TITLE:=LuCI support for Amule
LUCI_DEPENDS:=+amule
LUCI_PKGARCH:=all
include $(TOPDIR)/feeds/luci/luci.mk
# call BuildPackage - OpenWrt buildroot signature

View File

@ -0,0 +1,160 @@
--[[
LuCI - Lua Configuration Interface - amule support
Copyright 2016 maz-1 <ohmygod19993@gmail.com>
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
]]--
module("luci.controller.amule", package.seeall)
local uci = luci.model.uci.cursor()
local configdir = uci:get("amule", "main", "config_dir")
function index()
if not nixio.fs.access("/etc/config/amule") then
return
end
entry({"admin", "nas"}, firstchild(), "NAS", 45).dependent = false
local page = entry({"admin", "nas", "amule"}, cbi("amule"), _("aMule Settings"))
page.dependent = true
entry( {"admin", "nas", "amule", "logview"}, call("logread") ).leaf = true
entry( {"admin", "nas", "amule", "status"}, call("get_pid") ).leaf = true
entry( {"admin", "nas", "amule", "amulecmd"}, call("amulecmd") ).leaf = true
entry( {"admin", "nas", "amule", "startstop"}, post("startstop") ).leaf = true
entry( {"admin", "nas", "amule", "down_kad"}, post("down_kad") ).leaf = true
entry( {"admin", "nas", "amule", "down_ed2k"}, post("down_ed2k") ).leaf = true
end
-- called by XHR.get from detail_logview.htm
function logread()
-- read application settings
local uci = luci.model.uci.cursor()
local logdir = uci:get("amule", "main", "config_dir") or "/var/run/amule"
uci:unload("amule")
local ldata=nixio.fs.readfile(logdir .. "/logfile")
if not ldata or #ldata == 0 then
ldata="_nodata_"
end
luci.http.write(ldata)
end
-- called by XHR.get from detail_startstop.htm
function startstop()
local pid = get_pid(true)
if pid > 0 then
luci.sys.call("/etc/init.d/amule stop")
nixio.nanosleep(1) -- sleep a second
if nixio.kill(pid, 0) then -- still running
nixio.kill(pid, 9) -- send SIGKILL
end
pid = 0
else
luci.sys.call("/etc/init.d/amule start")
nixio.nanosleep(1) -- sleep a second
pid = tonumber(luci.sys.exec("pidof amuled")) or 0
if pid > 0 and not nixio.kill(pid, 0) then
pid = 0 -- process did not start
end
end
luci.http.write(tostring(pid)) -- HTTP needs string not number
end
function down_kad()
url = uci:get("amule", "main", "kad_nodes_url")
data_path = configdir .. "/nodes.dat"
proto = string.gsub(url, "://%S*", "")
proto_opt = ( proto == "https" ) and " --no-check-certificate" or ""
cmd = "wget -O /tmp/down_nodes.dat \"" .. url .. "\"" .. proto_opt ..
" && cat /tmp/down_nodes.dat > " .. "\"" .. data_path .. "\""
luci.sys.call(cmd)
end
function down_ed2k()
url = uci:get("amule", "main", "ed2k_servers_url")
data_path = configdir .. "/server.met"
proto = string.gsub(url, "://%S*", "")
proto_opt = ( proto == "https" ) and " --no-check-certificate" or ""
cmd = "wget -O /tmp/down_server.met \"" .. url .. "\"" .. proto_opt ..
" && cat /tmp/down_server.met > " .. "\"" .. data_path .. "\""
luci.sys.call(cmd)
end
-- called by XHR.poll from detail_startstop.htm
-- and from lua (with parameter "true")
function get_pid(from_lua)
local pid_amuled = tonumber(luci.sys.exec("pidof amuled")) or 0
local amuled_stat =false
if pid_amuled > 0 and not nixio.kill(pid_amuled, 0) then
pid_amuled = 0
end
if pid_amuled > 0 then
amuled_stat =true
else
amuled_stat =false
end
local pid_amuleweb = tonumber(luci.sys.exec("pidof amuleweb")) or 0
local amuleweb_stat = false
if pid_amuleweb > 0 and not nixio.kill(pid_amuleweb, 0) then
pid_amuleweb = 0
end
if pid_amuleweb > 0 then
amuleweb_stat =true
else
amuleweb_stat =false
end
local status = {
amuled = amuled_stat,
amuled_pid = pid_amuled,
amuleweb = amuleweb_stat
}
if from_lua then
return pid_amuled
else
luci.http.prepare_content("application/json")
luci.http.write_json(status)
end
end
function amulecmd()
local re =""
local rv = { }
local cmd = luci.http.formvalue("cmd")
local full_cmd = "HOME=\""..configdir.. "\" /usr/bin/amulecmd".." -c \""..cmd.."\" 2>&1"
local shellpipe = io.popen(full_cmd,"rw")
re = shellpipe:read("*a")
shellpipe:close()
if not re then
re=""
end
re = string.gsub(re, "This is amulecmd %S*\n", "")
re = string.gsub(re, "Creating client%S*\n", "")
re = string.gsub(re, "Succeeded! Connection established to aMule %S*\n", "")
re = string.gsub(re, "\n", "\r\n")
rv[#rv+1]=re
if #rv > 0 then
luci.http.prepare_content("application/json")
luci.http.write_json(rv)
return
end
luci.http.status(404, "No such device")
end

View File

@ -0,0 +1,456 @@
--[[
LuCI - Lua Configuration Interface - Aria2 support
Copyright 2016 maz-1 <ohmygod19993@gmail.com>
]]--
local sys = require "luci.sys"
local util = require "luci.util"
local uci = require "luci.model.uci".cursor()
ptype = {
"socks5",
"socks4",
"http",
"socks4a",
}
whocan = {
"anyone",
"friends",
"nobody",
}
function titlesplit(Value)
return "<p style=\"font-size:20px;font-weight:bold;color: DodgerBlue\">" .. translate(Value) .. "</p>"
end
m = Map("amule", translate("aMule"), translate("aMule is a ED2K/KAD client for all platforms.") .. "<br/><a href=\"https://github.com/maz-1\">luci interface by maz-1</a>")
m:section(SimpleSection).template = "amule/overview_status"
s = m:section(TypedSection, "amule", translate("aMule Settings"))
s.addremove = false
s.anonymous = true
s:tab("general", translate("General"))
s:tab("connection", translate("Connections"))
s:tab("server", translate("Server"))
s:tab("path_and_file", translate("Path And File"))
s:tab("security", translate("Security"))
s:tab("remote", translate("External Control"))
s:tab("template", translate("Edit Template"))
s:tab("logview", translate("Log File Viewer"))
s:tab("amulecmd", translate("aMule command"))
-- GENERAL --
o = s:taboption("general", Flag, "enabled", translate("Enabled"))
o.rmempty = false
user = s:taboption("general", ListValue, "runasuser", translate("Run daemon as user"))
local p_user
for _, p_user in util.vspairs(util.split(sys.exec("cat /etc/passwd | cut -f 1 -d :"))) do
user:value(p_user)
end
o = s:taboption("general", Value, "config_dir", translate("Configuration directory"))
o.rmempty = false
o.placeholder = "/var/run/amule"
o = s:taboption("general", Value, "mem_percentage", translate("Memory Limit"), translate("Percentage"))
o.rmempty = false
o.placeholder = "50"
o.datatype = "range(1, 99)"
o = s:taboption("general", Value, "nick", translate("Nickname"))
o.placeholder = "http://www.aMule.org"
o = s:taboption("general", Value, "max_upload", translate("Max upload speed"), translate("Unlimited when set to 0"))
o.datatype = "uinteger"
o.rmempty = false
o.placeholder = "0"
o = s:taboption("general", Value, "max_download", translate("Max download speed"), translate("Unlimited when set to 0"))
o.datatype = "uinteger"
o.rmempty = false
o.placeholder = "0"
o = s:taboption("general", Value, "slot_allocation", translate("Slot allocation"))
o.datatype = "uinteger"
o.rmempty = false
o.placeholder = "2"
o = s:taboption("general", Value, "max_connections", translate("Max connections"))
o.datatype = "uinteger"
o.rmempty = false
o.placeholder = "500"
o = s:taboption("general", Value, "max_sources_per_file", translate("Max sources per file"))
o.datatype = "uinteger"
o.rmempty = false
o.placeholder = "300"
-- CONNECTIONS --
o = s:taboption("connection", Value, "port", translate("TCP port"))
o.datatype = "port"
o.rmempty = false
o.placeholder = "4662"
o = s:taboption("connection", Flag, "udp_enable", translate("Enable UDP port"))
o.rmempty = false
o = s:taboption("connection", Value, "udp_port", translate("UDP port"))
o.datatype = "port"
o.rmempty = false
o.placeholder = "4672"
o = s:taboption("connection", Flag, "upnp_enabled", translate("Enable UPnP"))
o.rmempty = false
o = s:taboption("connection", Value, "upnp_tcp_port", translate("UPnP TCP port"))
o.datatype = "port"
o.rmempty = false
o.placeholder = "50000"
o = s:taboption("connection", Value, "address", translate("Bind Address"), translate("Leave blank to bind all"))
o.datatype = "ip4addr"
o.rmempty = true
o = s:taboption("connection", Flag, "auto_connect", translate("Automatically connect"))
o.rmempty = false
o = s:taboption("connection", Flag, "reconnect", translate("Automatically reconnect"))
o.rmempty = false
o = s:taboption("connection", Flag, "connect_to_kad", translate("Connect to Kad network"))
o.rmempty = false
o = s:taboption("connection", Flag, "connect_to_ed2k", translate("Connect to ED2K network"))
o.rmempty = false
s:taboption("connection", DummyValue,"titlesplit1" ,titlesplit(translate("Proxy Configuration")))
o = s:taboption("connection", Flag, "proxy_enable_proxy", translate("Enable proxy"))
o.rmempty = false
o = s:taboption("connection", ListValue, "proxy_type", translate("Proxy type"))
for i,v in ipairs(ptype) do
o:value(v)
end
o.rmempty = false
o = s:taboption("connection", Value, "proxy_name", translate("Proxy name"))
o.rmempty = true
o = s:taboption("connection", Value, "proxy_port", translate("Proxy port"))
o.datatype = "port"
o.rmempty = true
o = s:taboption("connection", Flag, "proxy_enable_password", translate("Proxy requires authentication"))
o.rmempty = true
o = s:taboption("connection", Value, "proxy_user", translate("Proxy user"))
--o:depends("proxy_enable_password", "1")
o.rmempty = true
o = s:taboption("connection", Value, "proxy_password", translate("Proxy password"))
o.password = true
o.rmempty = true
-- SERVER --
o = s:taboption("server", Value, "kad_nodes_url", translate("Kad Nodes Url"), "<input type=\"button\" size=\"0\" title=\""
.. translate("Download now") .. "\" onclick=\"onclick_down_kad(this.id)\" "
.. "value=\"&#10597;&#10597;&#10597;\" "
.. "style=\"font-weight:bold;text-decoration:overline;\""
.. "/>")
o.rmempty = false
o.placeholder = "http://upd.emule-security.org/nodes.dat"
o = s:taboption("server", Value, "ed2k_servers_url", translate("Ed2k Servers List Url"), "<input type=\"button\" size=\"0\" title=\""
.. translate("Download now") .. "\" onclick=\"onclick_down_ed2k(this.id)\" "
.. "value=\"&#10597;&#10597;&#10597;\" "
.. "style=\"font-weight:bold;text-decoration:overline;\""
.. "/>")
o.rmempty = false
o.placeholder = "http://upd.emule-security.org/server.met"
o = s:taboption("server", Flag, "remove_dead_server", translate("Remove Dead Server"))
o.rmempty = false
o = s:taboption("server", Value, "dead_server_retry", translate("Dead Server Retry"))
--o:depends("remove_dead_server", "1")
o.datatype = "uinteger"
o.rmempty = false
o.placeholder = "3"
o.default = "3"
o = s:taboption("server", Flag, "add_server_list_from_server", translate("Update server list when connecting to a server"))
o.rmempty = false
o = s:taboption("server", Flag, "add_server_list_from_client", translate("Update server list when a client connects"))
o.rmempty = false
o = s:taboption("server", Flag, "scoresystem", translate("Use priority system"))
o.rmempty = false
o = s:taboption("server", Flag, "smart_id_check", translate("Use smart LowID check on connect"))
o.rmempty = false
o = s:taboption("server", Flag, "safe_server_connect", translate("Safe connect"))
o.rmempty = false
o = s:taboption("server", Flag, "auto_connect_static_only", translate("Auto connect to servers in static list only"))
o.rmempty = false
o = s:taboption("server", Flag, "manual_high_prio", translate("Set manually added servers to high priority"))
o.rmempty = false
o = s:taboption("server", Flag, "serverlist", translate("Auto update server list at startup"), translate("addresses.dat file"))
o.rmempty = false
addr = s:taboption("server", Value, "addresses", translate("Server addresses"),
translate("Content of addresses.dat. One address per line"))
addr:depends("serverlist", "1")
addr.template = "cbi/tvalue"
addr.rows = 5
addr.rmempty = true
function addr.cfgvalue(self, section)
return nixio.fs.readfile("/etc/amule/addresses.dat")
end
function addr.write(self, section, value)
value = value:gsub("\r\n?", "\n")
nixio.fs.writefile("//etc/amule/addresses.dat", value)
end
-- PATH AND FILE --
o = s:taboption("path_and_file", Value, "temp_dir", translate("Temporary directory"))
o.rmempty = false
o.placeholder = "/var/run/amule/.aMule/Temp"
o = s:taboption("path_and_file", Value, "incoming_dir", translate("Incoming directory"))
o.rmempty = false
o.placeholder = "/var/run/amule/.aMule/Incoming"
shareddir = s:taboption("path_and_file", Value, "shareddir", translate("Shared directory"),
translate("Content of shareddir.dat. One directory per line"))
shareddir.template = "cbi/tvalue"
shareddir.titleref = luci.dispatcher.build_url("admin", "system", "fstab")
shareddir.rows = 5
shareddir.rmempty = true
function shareddir.cfgvalue(self, section)
return nixio.fs.readfile("/etc/amule/shareddir.dat")
end
function shareddir.write(self, section, value)
value = value:gsub("\r\n?", "\n")
nixio.fs.writefile("//etc/amule/shareddir.dat", value)
end
o = s:taboption("path_and_file", Flag, "ich", translate("Intelligent corruption handling (I.C.H.)"))
o.rmempty = false
o = s:taboption("path_and_file", Flag, "a_ich_trust", translate("Advanced I.C.H trusts every hash (not recommended)"))
o.rmempty = false
o = s:taboption("path_and_file", Flag, "add_new_files_paused", translate("Add files to download in pause mode"))
o.rmempty = false
o = s:taboption("path_and_file", Flag, "dap_pref", translate("Add files to download with auto priority"))
o.rmempty = false
o = s:taboption("path_and_file", Flag, "start_next_file", translate("Start next paused file when a file completes"))
o.rmempty = false
o = s:taboption("path_and_file", Flag, "start_next_file_same_cat", translate("Start next paused file from the same category"))
o:depends("start_next_file", "1")
o.rmempty = true
o = s:taboption("path_and_file", Flag, "start_next_file_alpha", translate("Start next paused file in alphabetic order"))
o:depends("start_next_file", "1")
o.rmempty = true
o = s:taboption("path_and_file", Flag, "allocate_full_file", translate("Preallocate disk space for new files"))
o.rmempty = false
o = s:taboption("path_and_file", Value, "min_free_disk_space", translate("Minimum free disk space. in Mbytes"))
o.datatype = "uinteger"
o.placeholder = "1"
o.rmempty = false
o = s:taboption("path_and_file", Flag, "use_src_seed", translate("Save 10 sources on rare files (< 20 sources)"))
o.rmempty = false
o = s:taboption("path_and_file", Flag, "uap_pref", translate("Add new shares with auto priority"))
o.rmempty = false
-- SECURITY --
o = s:taboption("security", Flag, "use_sec_ident", translate("Use secure user identification"))
o.rmempty = false
o = s:taboption("security", Flag, "is_crypt_layer_requested", translate("Use obfuscation for outgoing connections"))
o.rmempty = false
o = s:taboption("security", Flag, "is_client_crypt_layer_required", translate("Accept only obfuscation connections"))
o.rmempty = false
o = s:taboption("security", ListValue, "see_share", translate("Who can see my shared files"))
for i,v in ipairs(whocan) do
o:value(v)
end
o.rmempty = false
s:taboption("security", DummyValue,"titlesplit2" ,titlesplit(translate("IP Filter Configuration")))
shareddir = s:taboption("security", Value, "ipfilter_static", translate("Static IP list for filtering"),
translate("Content of ipfilter_static.dat"))
shareddir.template = "cbi/tvalue"
shareddir.titleref = luci.dispatcher.build_url("admin", "system", "fstab")
shareddir.rows = 5
shareddir.rmempty = true
function shareddir.cfgvalue(self, section)
return nixio.fs.readfile("/etc/amule/ipfilter_static.dat")
end
function shareddir.write(self, section, value)
value = value:gsub("\r\n?", "\n")
nixio.fs.writefile("//etc/amule/ipfilter_static.dat", value)
end
o = s:taboption("security", Flag, "ip_filter_clients", translate("Filter clients by IP"))
o.rmempty = false
o = s:taboption("security", Flag, "ip_filter_servers", translate("Filter servers by IP"))
o.rmempty = false
o = s:taboption("security", Value, "ip_filter_url", translate("IP filter list URL"))
o.rmempty = true
o = s:taboption("security", Flag, "ip_filter_auto_load", translate("Auto-update ipfilter at startup"))
o.rmempty = false
o = s:taboption("security", Value, "filter_level", translate("Filtering Level"))
o.datatype = "range(1, 255)"
o.rmempty = false
o.placeholder = "127"
o = s:taboption("security", Flag, "filter_lan_ips", translate("Always filter LAN IPs"))
o.rmempty = false
o = s:taboption("security", Flag, "paranoid_filtering", translate("Paranoid handling of non-matching IPs"))
o.rmempty = false
o = s:taboption("security", Flag, "ip_filter_system", translate("Use system-wide ipfilter.dat if available"))
o.rmempty = false
-- REMOTE CONTROL --
o = s:taboption("remote", Value, "ec_address", translate("IP of the listening interface for external connection"))
o.datatype = "ip4addr"
o.placeholder = "127.0.0.1"
o.rmempty = true
o = s:taboption("remote", Value, "ec_port", translate("TCP port for EC"))
o.datatype = "port"
o.placeholder = "4712"
o.rmempty = false
o = s:taboption("remote", Flag, "upnp_ec_enabled", translate("Enable upnp port forwarding on the EC port"))
o.rmempty = false
o = s:taboption("remote", Value, "ec_password", translate("EC password"))
o.password = true
o.rmempty = false
s:taboption("remote", DummyValue,"titlesplit3", titlesplit(translate("aMule Web Configuration")))
o = s:taboption("remote", Flag, "web_enabled", translate("Enable web server on startup"))
o.rmempty = false
o = s:taboption("remote", Value, "template", translate("Web template"))
o.rmempty = false
local tpth_suggestions = luci.sys.exec("ls /usr/share/amule/webserver/|sed ':a;N;$!ba;s/\\n/:/g'")
if tpth_suggestions then
for entry in string.gmatch(tpth_suggestions, "[^:]+") do
o:value(entry)
end
end
o = s:taboption("remote", Value, "web_password", translate("Web full rights password"))
o.password = true
o.rmempty = true
o = s:taboption("remote", Flag, "use_low_rights_user", translate("Use low rights user"))
o.rmempty = false
o = s:taboption("remote", Value, "password_low", translate("Web low rights password"))
o.password = true
o.rmempty = true
o = s:taboption("remote", Value, "web_port", translate("Web TCP port"))
o.datatype = "port"
o.placeholder = "4711"
o.rmempty = false
o = s:taboption("remote", Flag, "upnp_web_server_enabled", translate("Enable UPnP port forwarding of the web server port"))
o.rmempty = false
o = s:taboption("remote", Value, "web_upnp_tcp_port", translate("Web UPnP TCP port"))
o.datatype = "port"
o.placeholder = "50001"
o.rmempty = false
o = s:taboption("remote", Value, "page_refresh_time", translate("Page refresh time(in secs)"))
o.datatype = "range(1, 600)"
o.rmempty = false
o.placeholder = "121"
o = s:taboption("remote", Flag, "use_gzip", translate("Enable Gzip compression"))
o.rmempty = false
-- TEMPLATE --
tmpl = s:taboption("template", Value, "_tmpl",
translate("Edit the template that is used for generating the aMule configuration."),
translate("This is the content of the file '/etc/amule/amule.conf.template' from which your amule configuration will be generated. " ..
"Values enclosed by pipe symbols ('|') should not be changed. They get their values from other tabs."))
tmpl.template = "cbi/tvalue"
tmpl.rows = 20
function tmpl.cfgvalue(self, section)
return nixio.fs.readfile("/etc/amule/amule.conf.template")
end
function tmpl.write(self, section, value)
value = value:gsub("\r\n?", "\n")
nixio.fs.writefile("//etc/amule/amule.conf.template", value)
end
-- LOGVIEW --
local lv = s:taboption("logview", DummyValue, "_logview")
lv.template = "amule/detail_logview"
lv.inputtitle = translate("Read / Reread log file")
lv.rows = 50
function lv.cfgvalue(self, section)
return translate("Please press [Read] button")
end
-- AMULECMD --
local cmd = s:taboption("amulecmd", DummyValue, "_amulecmd")
cmd.template = "amule/webshell"
return m

View File

@ -0,0 +1,56 @@
<!-- ++ BEGIN ++ aMule ++ detail_logview.htm ++ -->
<script type="text/javascript">//<![CDATA[
function onclick_logview(section, bottom) {
// get elements
var txt = document.getElementById("cbid.amule.main._logview.txt"); // TextArea
if ( !txt ) { return; } // security check
var lvXHR = new XHR();
lvXHR.get('<%=url('admin/nas/amule/logview')%>', null,
function(x) {
if (x.responseText == "_nodata_")
txt.value = "<%:File not found or empty%>";
else
txt.value = x.responseText;
if (bottom)
txt.scrollTop = txt.scrollHeight;
else
txt.scrollTop = 0; }
);
}
//]]></script>
<%+cbi/valueheader%>
<br />
<%
-- one button on top, one at the buttom
%>
<input class="cbi-button cbi-input-button" style="align: center; width: 100%" type="button" onclick="onclick_logview(this.name, false)"
<%=
attr("name", section) .. attr("id", cbid .. ".btn1") .. attr("value", self.inputtitle)
%> />
<br /><br />
<%
-- set a readable style taken from openwrt theme for textarea#syslog
-- in openwrt theme there are problems with a width of 100 so we check for theme and set to lower value
%>
<textarea style="width: <%if media == "/luci-static/openwrt.org" then%>98.7%<%else%>100%<%end%> ; min-height: 500px; border: 3px solid #cccccc; padding: 5px; font-family: monospace; resize: none;" wrap="off" readonly="readonly"
<%=
attr("name", cbid .. ".txt") .. attr("id", cbid .. ".txt") .. ifattr(self.rows, "rows")
%> >
<%-=pcdata(self:cfgvalue(section))-%>
</textarea>
<br /><br />
<%
-- one button on top, one at the buttom
%>
<input class="cbi-button cbi-input-button" style="align: center; width: 100%" type="button" onclick="onclick_logview(this.name, true)"
<%= attr("name", section) .. attr("id", cbid .. ".btn2") .. attr("value", self.inputtitle) %> />
<%+cbi/valuefooter%>
<!-- ++ END ++ aMule ++ detail_logview.htm ++ -->

View File

@ -0,0 +1,94 @@
<script type="text/javascript">//<![CDATA[
XHR.poll(5, '<%=luci.dispatcher.build_url("admin/nas/amule/status")%>', null,
function(x, data) {
var tb = document.getElementById('amule_status');
var btn = document.getElementById("amule_startstop");
var btn_tmpl = '<input class="cbi-button cbi-button-apply" id="btn_startstop" style="font-size: 100%;" value="PID: NUMBER"type="button" onclick="onclick_startstop(this.id)">'
if (data && tb) {
if (data.amuled) {
var links = '<em><%:aMule daemon is running.%></em>';
if (data.amuleweb) {
links += '<input class="cbi-button mar-10" type="button" value="<%:Open aMuleWeb%>" onclick="openWebUI();" />';
}
tb.innerHTML = links;
} else {
tb.innerHTML = '<em><%:aMule daemon is not running.%></em>';
}
if (data.amuled_pid == "0") {
btn.innerHTML = btn_tmpl.replace("PID: NUMBER", "<%:Start aMule%>");
} else {
btn.innerHTML = btn_tmpl.replace("NUMBER", data.amuled_pid);
}
}
}
);
function _data2elements(x, data) {
var btn = document.getElementById("btn_startstop");
if ( ! btn ) { return; } // security check
if (data.amuled_pid == "0") {
btn.value = "<%:Start aMule%>";
btn.className = "cbi-button cbi-button-apply";
btn.disabled = false;
} else {
btn.value = "PID: " + data.amuled_pid;
btn.className = "cbi-button cbi-button-reset";
btn.disabled = false;
}
}
// event handler for start/stop button
function onclick_startstop(id) {
// do start/stop
var btnXHR = new XHR();
btnXHR.post('<%=url('admin/nas/amule/startstop')%>', { token: '<%=token%>' },
function(x, data) { _data2elements(x, data); }
);
}
// event handler for download files
function onclick_down_kad(id) {
if(confirm("<%:Existing file will be overwritten, do you really want to proceed?%>"))
{
var btnXHR = new XHR();
btnXHR.post('<%=url('admin/nas/amule/down_kad')%>', { token: '<%=token%>' },
function(x) {}
);
}
}
function onclick_down_ed2k(id) {
if(confirm("<%:Existing file will be overwritten, do you really want to proceed?%>"))
{
var btnXHR = new XHR();
btnXHR.post('<%=url('admin/nas/amule/down_ed2k')%>', { token: '<%=token%>' },
function(x) {}
);
}
}
function openWebUI() {
var curWwwPath = window.document.location.href;
var pathName = window.document.location.pathname;
var pos = curWwwPath.indexOf(pathName);
var localhostPath = curWwwPath.substring(0, pos);
var auth_port = document.getElementById("cbid.amule.main.web_port");
if (auth_port.value == "") {
auth_port_value = "44711"
} else {
auth_port_value = auth_port.value
};
var url = "http:" + localhostPath.substring(window.location.protocol.length) + ":" + auth_port_value;
window.open(url)
};
//]]>
</script>
<style>.mar-10 {margin-left: 10px; margin-right: 10px;}</style>
<fieldset class="cbi-section">
<legend><%:aMule Status%></legend>
<p id="amule_status">
<em><%:Collecting data...%></em>
</p>
<p id="amule_startstop">
<em><%:Collecting data...%></em>
</p>
</fieldset>

View File

@ -0,0 +1,90 @@
<script type="text/javascript">//<![CDATA[
String.prototype.startsWith = function (str){
return this.indexOf(str) == 0;
};
var iwxhr = new XHR();
function update_status(e) {
if(e!=null && e.keyCode!=13) return false;
/*var cmd = document.getElementById("cmd").value;
if(cmd.startsWith("cd"))
{
newpath = cmd.replace("cd","").replace(" ","");
if(newpath.startsWith("/")){
document.getElementById("currentpath").value = newpath;
}else{
document.getElementById("currentpath").value += newpath;
}
cmd="";
}*/
obj = document.getElementById("screen");
cmdstr=(document.getElementById("cmd").value).replace(/\s+/g,"")
if (cmdstr == "cls" || cmdstr == "clear")
{
obj = document.getElementById("screen");
obj.value = "";
document.getElementById("cmd").value = "";
return false;
}
iwxhr.get('<%=luci.dispatcher.build_url("admin", "nas", "amule", "amulecmd")%>', {cmd: document.getElementById("cmd").value },
function(x, ifc)
{
obj = document.getElementById("screen");
obj.value+=ifc[0];
document.getElementById("cmd").focus();
}
)
if ((document.getElementById("cmd").value).replace(/\s+/g,"") != "")
{
obj.value+="\r\n--------------------------------------------\r\n"+document.getElementById("cmd").value+"\r\n--------------------------------------------\r\n";
document.getElementById("cmd").value = "";
return false;
}
};
function clear_textfield() {
obj = document.getElementById("screen");
obj.value=""
}
//]]></script>
<style>
.cmd_line{
background-color:yellow;
}
#list ul li
{
margin-right:5px;
height:16px;
display:block;
float:left;
word-break: keep-all;
}
#list ul li:hover
{
background:blue;
cursor:pointer;
}
</style>
<div class="cbi-map" id="cbi-system">
<h4><a id="content" name="content"><%:You can call amulecmd commands here to control your amule.%></a></h4>
<h4><a id="content" name="content"><%:Execute 'Help' to get more infomation.%></a></h4>
<textarea id="screen" style="width:100%;height:400px;overflow:auto;font-size:12px;" readonly="readonly" ></textarea>
<br/>
<%=translate("Command: ")%>
<input type="text" id="cmd"/>
<input class="cbi-button cbi-input-button" style="align: center; width: 100%" type="button" onclick="update_status(null)"
<%= attr("name", section) .. attr("id", cbid .. ".btn2") .. attr("value", translate("Execute")) %> />
<input class="cbi-button cbi-input-button" style="align: center; width: 100%" type="button" onclick="clear_textfield()"
<%= attr("name", section) .. attr("id", cbid .. ".btn3") .. attr("value", translate("Clear")) %> />
<br/>
</div>

View File

@ -0,0 +1,360 @@
msgid "aMule is a ED2K/KAD client for all platforms."
msgstr "aMule是一个跨平台的ED2K/KAD客户端"
msgid "NAS"
msgstr "网络存储"
msgid "General"
msgstr "常规"
msgid "Connections"
msgstr "连接"
msgid "Server"
msgstr "服务器"
msgid "Path And File"
msgstr "路径和文件"
msgid "Security"
msgstr "安全"
msgid "External Control"
msgstr "远程控制"
msgid "Edit Template"
msgstr "编辑配置模版"
msgid "Log File Viewer"
msgstr "日志查看"
msgid "aMule Settings"
msgstr "aMule设置"
msgid "Run daemon as user"
msgstr "运行守护进程的用户"
msgid "Configuration directory"
msgstr "配置目录"
msgid "Nickname"
msgstr "昵称"
msgid "Max upload speed"
msgstr "最大上传速度"
msgid "Max download speed"
msgstr "最大下载速度"
msgid "Unlimited when set to 0"
msgstr "设为0时不限制"
msgid "Slot allocation"
msgstr "槽速度"
msgid "Max connections"
msgstr "最大连接数"
msgid "Max sources per file"
msgstr "单文件最大连接数"
msgid "TCP port"
msgstr "TCP端口"
msgid "UDP port"
msgstr "UDP端口"
msgid "Enable UDP port"
msgstr "启用UDP端口"
msgid "Enable UPnP"
msgstr "启用UPnP"
msgid "UPnP TCP port"
msgstr "UPnP TCP端口"
msgid "Bind Address"
msgstr "地址绑定"
msgid "Leave blank to bind all"
msgstr "留空则全部绑定"
msgid "Default to bind all"
msgstr "默认全部绑定"
msgid "Automatically connect"
msgstr "自动连接"
msgid "Automatically reconnect"
msgstr "自动重连"
msgid "Connect to Kad network"
msgstr "连接到Kad网络"
msgid "Connect to ED2K network"
msgstr "连接到ED2K网络"
msgid "Proxy Configuration"
msgstr "代理设置"
msgid "Enable proxy"
msgstr "启用代理"
msgid "Proxy type"
msgstr "代理类型"
msgid "Proxy name"
msgstr "代理名称"
msgid "Proxy port"
msgstr "代理端口"
msgid "Proxy requires authentication"
msgstr "代理需要认证"
msgid "Proxy user"
msgstr "代理用户"
msgid "Proxy password"
msgstr "代理密码"
msgid "Kad Nodes Url"
msgstr "Kad节点URL"
msgid "Ed2k Servers List Url"
msgstr "Ed2k服务器列表URL"
msgid "Remove Dead Server"
msgstr "删除无效服务器"
msgid "Dead Server Retry"
msgstr "删除前重连次数"
msgid "Update server list when connecting to a server"
msgstr "与服务器连接时更新服务器列表"
msgid "Update server list when a client connects"
msgstr "与其他用户连接时更新服务器列表"
msgid "Use priority system"
msgstr "启用优先级系统"
msgid "Use smart LowID check on connect"
msgstr "智能LOWID检测"
msgid "Safe connect"
msgstr "安全连接"
msgid "Auto connect to servers in static list only"
msgstr "只自动连接到静态列表中的服务器"
msgid "Set manually added servers to high priority"
msgstr "将手动输入的服务器设为高优先级"
msgid "Auto update server list at startup"
msgstr "启动时自动更新服务器列表"
msgid "addresses.dat file"
msgstr "addresses.dat文件"
msgid "Server addresses"
msgstr "服务器地址"
msgid "Content of addresses.dat. One address per line"
msgstr "addresses.dat的内容. 每行一个地址."
msgid "Temporary directory"
msgstr "临时文件夹"
msgid "Incoming directory"
msgstr "下载文件夹"
msgid "Shared directory"
msgstr "共享文件夹"
msgid "Content of shareddir.dat. One directory per line"
msgstr "shareddir.dat的内容. 每行一个目录."
msgid "Intelligent corruption handling (I.C.H.)"
msgstr "智能损坏数据处理(I.C.H.)"
msgid "Advanced I.C.H trusts every hash (not recommended)"
msgstr "高级I.C.H信任全部校验值不推荐"
msgid "Add files to download in pause mode"
msgstr "添加新下载文件时设为暂停"
msgid "Add files to download with auto priority"
msgstr "添加新下载文件时设定优先级为自动"
msgid "Start next paused file when a file completes"
msgstr "一个文件完成时开始下一个暂停的文件"
msgid "Start next paused file from the same category"
msgstr "从同一分类开始下一个暂停的文件"
msgid "Start next paused file in alphabetic order"
msgstr "根据字母顺序开始下一个暂停的文件"
msgid "Preallocate disk space for new files"
msgstr "为新文件预分配磁盘空间"
msgid "Minimum free disk space. in Mbytes"
msgstr "最低剩余空间单位MB"
msgid "Save 10 sources on rare files (< 20 sources)"
msgstr "保存稀有文件少于20个源的十个源"
msgid "Add new shares with auto priority"
msgstr "添加新共享文件时设优先级为自动"
msgid "Use secure user identification"
msgstr "使用安全用户认证"
msgid "Use obfuscation for outgoing connections"
msgstr "为传出连接使用迷惑协议"
msgid "Accept only obfuscation connections"
msgstr "只接受迷惑协议连接"
msgid "Who can see my shared files"
msgstr "谁可查看我的共享文件"
msgid "IP Filter Configuration"
msgstr "IP过滤设置"
msgid "Static IP list for filtering"
msgstr "静态IP过滤列表"
msgid "Content of ipfilter_static.dat"
msgstr "ipfilter_static.dat的内容"
msgid "Filter clients by IP"
msgstr "过滤用户"
msgid "Filter servers by IP"
msgstr "过滤服务器"
msgid "IP filter list URL"
msgstr "过滤列表URL"
msgid "Auto-update ipfilter at startup"
msgstr "自动更新过滤列表"
msgid "Filtering Level"
msgstr "过滤级别"
msgid "Always filter LAN IPs"
msgstr "总是过滤局域网ip地址"
msgid "Paranoid handling of non-matching IPs"
msgstr "处理不匹配的IP"
msgid "Use system-wide ipfilter.dat if available"
msgstr "可用情况下使用系统级的ipfilter.dat"
msgid "IP of the listening interface for external connection"
msgstr "远程连接监听IP"
msgid "TCP port for EC"
msgstr "远程连接TCP端口"
msgid "Enable upnp port forwarding on the EC port"
msgstr "为远程连接端口启用upnp"
msgid "aMule Web Configuration"
msgstr "aMule Web设置"
msgid "EC password"
msgstr "远程连接密码"
msgid "Enable web server on startup"
msgstr "启动时运行Web服务"
msgid "Web template"
msgstr "Web模版"
msgid "Web full rights password"
msgstr "Web最高权限密码"
msgid "Use low rights user"
msgstr "启用低权限用户"
msgid "Web low rights password"
msgstr "Web低权限密码"
msgid "Web TCP port"
msgstr "Web TCP端口"
msgid "Enable UPnP port forwarding of the web server port"
msgstr "为Web服务端口启用UPnP端口转发"
msgid "Web UPnP TCP port"
msgstr "Web服务UPnP的TCP端口"
msgid "Page refresh time(in secs)"
msgstr "页面刷新周期(秒)"
msgid "Enable Gzip compression"
msgstr "启用Gzip压缩"
msgid "Edit the template that is used for generating the aMule configuration."
msgstr "编辑用来生成aMule设置的模板"
msgid "This is the content of the file '/etc/amule/amule.conf.template' from which your amule configuration will be generated. Values enclosed by pipe symbols ('|') should not be changed. They get their values from other tabs."
msgstr "创建aMule设置的 '/etc/amule/amule.conf.template' 文件的内容。被通道符|包围的值不应该在这里改动,请在其他标签修改这些设置。"
msgid "Read / Reread log file"
msgstr "读取/重载日志文件"
msgid "Please press [Read] button"
msgstr "请点击[读取]按钮"
msgid "File not found or empty"
msgstr "文件不存在或为空"
msgid "aMule Status"
msgstr "aMule状态"
msgid "Open aMuleWeb"
msgstr "打开aMuleWeb"
msgid "aMule daemon is running."
msgstr "aMule守护进程正在运行"
msgid "aMule daemon is not running."
msgstr "aMule守护进程未运行"
msgid "Start aMule"
msgstr "启动aMule"
msgid "aMule command"
msgstr "aMule命令"
msgid "aMule Command"
msgstr "aMule命令"
msgid "You can call amulecmd commands here to control your amule."
msgstr "你可以在这里运行amulecmd命令以控制你的aMule"
msgid "Execute 'Help' to get more infomation."
msgstr "执行'Help'命令以获取更多信息"
msgid "Execute"
msgstr "执行"
msgid "Clear"
msgstr "清空"
msgid "Command: "
msgstr "命令: "
msgid "Download now"
msgstr "立即下载"
msgid "Existing file will be overwritten, do you really want to proceed?"
msgstr "已有文件将被覆盖,是否继续?"
msgid "Percentage"
msgstr "百分比"

View File

@ -0,0 +1,206 @@
[eMule]
Nick=|NICK|
MaxUpload=|MAXUPLOAD|
MaxDownload=|MAXDOWNLOAD|
SlotAllocation=|SLOTALLOCATION|
MaxConnections=|MAXCONNECTIONS|
MaxSourcesPerFile=|MAXSOURCESPERFILE|
Port=|PORT|
UDPPort=|UDPPORT|
UDPEnable=|UDPENABLE|
UPnPEnabled=|UPNPENABLED|
UPnPTCPPort=|UPNPTCPPORT|
Address=|ADDRESS|
Autoconnect=|AUTOCONNECT|
Reconnect=|RECONNECT|
ConnectToKad=|CONNECTTOKAD|
ConnectToED2K=|CONNECTTOED2K|
KadNodesUrl=|KADNODESURL|
Ed2kServersUrl=|ED2KSERVERSURL|
RemoveDeadServer=|REMOVEDEADSERVER|
DeadServerRetry=|DEADSERVERRETRY|
AddServerListFromServer=|ADDSERVERLISTFROMSERVER|
AddServerListFromClient=|ADDSERVERLISTFROMCLIENT|
Scoresystem=|SCORESYSTEM|
SmartIdCheck=|SMARTIDCHECK|
SafeServerConnect=|SAFESERVERCONNECT|
AutoConnectStaticOnly=|AUTOCONNECTSTATICONLY|
ManualHighPrio=|MANUALHIGHPRIO|
Serverlist=|SERVERLIST|
TempDir=|TEMPDIR|
IncomingDir=|INCOMINGDIR|
ICH=|ICH|
AICHTrust=|AICHTRUST|
AddNewFilesPaused=|ADDNEWFILESPAUSED|
DAPPref=|DAPPREF|
StartNextFile=|STARTNEXTFILE|
StartNextFileSameCat=|STARTNEXTFILESAMECAT|
StartNextFileAlpha=|STARTNEXTFILEALPHA|
AllocateFullFile=|ALLOCATEFULLFILE|
MinFreeDiskSpace=|MINFREEDISKSPACE|
UAPPref=|UAPPREF|
SeeShare=|SEESHARE|
IPFilterURL=|IPFILTERURL|
IPFilterAutoLoad=|IPFILTERAUTOLOAD|
FilterLevel=|FILTERLANIPS|
FilterLanIPs=|FILTERLANIPS|
ParanoidFiltering=|PARANOIDFILTERING|
IPFilterSystem=|IPFILTERSYSTEM|
FilterMessages=1
FilterAllMessages=0
MessagesFromFriendsOnly=0
MessageFromValidSourcesOnly=1
FilterWordMessages=0
MessageFilter=
ShowMessagesInLog=1
FilterComments=0
CommentFilter=
AppVersion=SVN
QueueSizePref=50
MaxConnectionsPerFiveSeconds=20
ServerKeepAliveTimeout=0
CheckDiskspace=1
PreviewPrio=0
FileBufferSizePref=16
OSDirectory=/var/run/amule
OnlineSignature=0
OnlineSignatureUpdate=5
EnableTrayIcon=0
MinToTray=0
ConfirmExit=1
StartupMinimized=0
3DDepth=10
ToolTipDelay=1
ShowOverhead=0
ShowInfoOnCatTabs=1
VerticalToolbar=0
GeoIPEnabled=1
VideoPlayer=
StatGraphsInterval=3
statsInterval=30
DownloadCapacity=300
UploadCapacity=100
StatsAverageMinutes=5
VariousStatisticsMaxValue=100
ShareHiddenFiles=0
AutoSortDownloads=0
NewVersionCheck=1
AdvancedSpamFilter=1
MessageUseCaptchas=1
Language=
SplitterbarPosition=75
YourHostname=
DateTimeFormat=%A, %x, %X
AllcatType=0
ShowAllNotCats=0
SmartIdState=0
DropSlowSources=0
ShowRatesOnTitle=0
GeoLiteCountryUpdateUrl=http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz
StatsServerName=Shorty's ED2K stats
StatsServerURL=http://ed2k.shortypower.dyndns.org/?hash=
CreateSparseFiles=1
[Browser]
OpenPageInTab=1
CustomBrowserString=
[Proxy]
ProxyEnableProxy=|PROXYENABLEPROXY|
ProxyType=|PROXYTYPE|
ProxyName=|PROXYNAME|
ProxyPort=|PROXYPORT|
ProxyEnablePassword=|PROXYENABLEPASSWORD|
ProxyUser=|PROXYUSER|
ProxyPassword=|PROXYPASSWORD|
[DLP]
CheckModString=1
CheckUsername=1
CheckUserHash=1
CheckHelloTag=1
CheckInfoTag=1
CheckVeryCDMod=0
CheckGhostMod=1
[ExternalConnect]
ECAddress=|ECADDRESS|
ECPort=|ECPORT|
UPnPECEnabled=|UPNPECENABLED|
ECPassword=|ECPASSWORD|
UseSrcSeeds=|USESRCSEED|
UseSecIdent=|USESECIDENT|
IpFilterClients=|IPFILTERCLIENTS|
IpFilterServers=|IPFILTERSERVERS|
AcceptExternalConnections=1
ShowProgressBar=1
ShowPercent=1
TransmitOnlyUploadingClients=0
[WebServer]
Enabled=|WEBENABLED|
Template=|TEMPLATE|
Password=|WEBPASSWORD|
UseLowRightsUser=|USELOWRIGHTSUSER|
PasswordLow=|PASSWORDLOW|
Port=|WEBPORT|
UPnPWebServerEnabled=|UPNPWEBSERVERENABLED|
WebUPnPTCPPort=|WEBUPNPTCPPORT|
PageRefreshTime=|PAGEREFRESHTIME|
UseGzip=|USEGZIP|
Path=amuleweb
[GUI]
HideOnClose=0
[Razor_Preferences]
FastED2KLinksHandler=1
[SkinGUIOptions]
Skin=
[Statistics]
MaxClientVersions=0
[Obfuscation]
IsCryptLayerRequested=|ISCRYPTLAYERREQUESTED|
IsClientCryptLayerRequired=|ISCLIENTCRYPTLAYERREQUIRED|
IsClientCryptLayerSupported=1
CryptoPaddingLenght=254
CryptoKadUDPKey=281625462
[PowerManagement]
PreventSleepWhileDownloading=0
[UserEvents]
[UserEvents/DownloadCompleted]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[UserEvents/NewChatSession]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[UserEvents/OutOfDiskSpace]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[UserEvents/ErrorOnCompletion]
CoreEnabled=0
CoreCommand=
GUIEnabled=0
GUICommand=
[HTTPDownload]
URL_1=

View File

@ -0,0 +1,71 @@
config amule 'main'
option enabled '0'
option runasuser 'amule'
option config_dir '/var/run/amule'
option mem_percentage '50'
option nice '10'
option ionice_flags '-c 3'
option nick 'http://www.aMule.org'
option max_upload '0'
option max_download '0'
option slot_allocation '2'
option max_connections '500'
option max_sources_per_file '300'
option port '4662'
option udp_enable '1'
option udp_port '4672'
option upnp_tcp_port '50000'
option auto_connect '1'
option reconnect '1'
option connect_to_kad '1'
option connect_to_ed2k '1'
option kad_nodes_url 'http://upd.emule-security.org/nodes.dat'
option ed2k_servers_url 'http://upd.emule-security.org/server.met'
option remove_dead_server '1'
option dead_server_retry '3'
option scoresystem '1'
option smart_id_check '1'
option use_sec_ident '1'
option is_crypt_layer_requested '1'
option ip_filter_clients '1'
option ip_filter_servers '1'
option ip_filter_auto_load '1'
option filter_level '127'
option filter_lan_ips '1'
option paranoid_filtering '1'
option ec_port '4712'
option ec_password '12345678'
option ich '1'
option dap_pref '1'
option start_next_file '1'
option min_free_disk_space '1'
option use_src_seed '1'
option temp_dir '/var/run/amule/Temp'
option incoming_dir '/var/run/amule/Incoming'
option proxy_enable_proxy '0'
option add_server_list_from_server '0'
option add_server_list_from_client '0'
option safe_server_connect '0'
option auto_connect_static_only '0'
option manual_high_prio '0'
option serverlist '0'
option a_ich_trust '0'
option add_new_files_paused '0'
option allocate_full_file '0'
option uap_pref '0'
option is_client_crypt_layer_required '0'
option see_share 'nobody'
option ip_filter_system '0'
option upnp_ec_enabled '0'
option web_enabled '0'
option upnp_enabled '0'
option proxy_type 'socks5'
option template 'default'
option use_low_rights_user '0'
option web_port '44711'
option upnp_web_server_enabled '0'
option web_upnp_tcp_port '50001'
option page_refresh_time '121'
option use_gzip '0'

View File

@ -0,0 +1,14 @@
#!/bin/sh
# Copyright (C) 2007 OpenWrt.org
/etc/init.d/amule enabled && {
[ "$ACTION" = "ifup" ] && {
/etc/init.d/amule start
}
[ "$ACTION" = "ifdown" ] && {
/etc/init.d/amule stop
}
}

View File

@ -0,0 +1,175 @@
#!/bin/sh /etc/rc.common
# Copyright (C) 2010-2015 OpenWrt.org
START=99
USE_PROCD=1
LIST_SEP="
"
unregex() {
echo "$1" | sed -e 's/[]\/()$*.^|[]/\\&/g'
}
option_word_to_digit() {
word=$(grep -ioE "\b$2=\S+" "$1"|awk -F= '{print $2}')
digit=$(echo "$3" |grep -oE "$word/\S+"|awk -F'/' '{print $2}')
sed -i "s/\b$2=$word\b/$2=$digit/g" "$1"
}
encrypt_password() {
pass_notencryted=$(grep -ioE "\b$2=[^\n]+" "$1"|sed "s/.*$2=//g")
pass_encryted=$(echo -n $pass_notencryted|md5sum|grep -oE "[a-z0-9]{32}")
[[ -z $pass_notencryted ]] || sed -i "s/\b$2=$(unregex $pass_notencryted)/$2=$pass_encryted/g" "$1"
}
write_dat_file() {
if [[ -s "$1" ]] ; then
cat "$1" > "$2"
else
[[ -s "$2" ]] && cat "$2" > "$1"
fi
}
set_params() {
cat /etc/amule/amule.conf.template > "$config_file"
local p; local v; local s="$1"; shift
for p in $*; do
config_get v "$s" "$p"
IFS="$LIST_SEP"
for v in $v; do
[ -n "$v" ] && (
sed -i "s;|$(echo $p|tr '[a-z]' '[A-Z]'|sed -e 's|_||g')|;$(unregex $v);g" "$config_file"
)
done
unset IFS
done
#delete unreplaced placeholders
sed -i "s;=|[A-Z0-9]*|;=;g" "$config_file"
#convert some options to digit
option_word_to_digit "$config_file" "ProxyType" "socks5/0 socks4/1 http/2 socks4a/3"
option_word_to_digit "$config_file" "SeeShare" "anyone/0 friends/1 nobody/2"
#encrypt password
encrypt_password "$config_file" "ECPassword"
encrypt_password "$config_file" "Password"
encrypt_password "$config_file" "PasswordLow"
}
section_enabled() {
config_get_bool enabled "$1" 'enabled' 0
[ $enabled -gt 0 ]
}
set_owner() {
case $(echo "$1"|grep -oE "^/[^/]+") in
"/var"|"/tmp"|"/mnt"|"root")
cur_user=$(ls -w50 -ld "$1"|awk '{print $3}')
cur_group=$(ls -w50 -ld "$1"|awk '{print $4}')
[[ $cur_user == $2 ]] || ( chown -R $2 "$1" )
[[ $cur_group == $3 ]] || ( chgrp -R $3 "$1" )
;;
*)
false
;;
esac
}
amule() {
local cfg="$1"
local USE
local runasuser
local incoming_dir config_dir temp_dir
local mem_percentage
local config_overwrite nice ionice_flags
local cmdline
section_enabled "$section" || return 1
config_get config_dir "$cfg" 'config_dir' '/var/run/amule'
config_get runasuser "$cfg" 'runasuser' 'daemon'
config_get incoming_dir "$cfg" 'incoming_dir' "$config_dir/Incoming"
config_get temp_dir "$cfg" 'temp_dir' "$config_dir/Temp"
config_get mem_percentage "$cfg" 'mem_percentage' '50'
config_get config_overwrite "$cfg" config_overwrite 1
config_get nice "$cfg" nice "-19"
config_get ionice_flags "$cfg" ionice_flags ''
group=$(id -Gn $runasuser)
case $(echo "$config_dir"|grep -oE "^/[^/]+") in
"/var"|"/tmp"|"/mnt"|"/root"|"/home")
true
;;
*)
echo "You should set config_dir to subfolders under /var, /tmp ,/mnt or /root"
return 1
;;
esac
which ionice > /dev/null || ionice_flags=''
local MEM=$(sed -ne 's!^MemTotal:[[:space:]]*\([0-9]*\) kB$!\1!p' /proc/meminfo)
if test "$MEM" -gt 1;then
USE=$(expr $MEM \* $mem_percentage \* 10)
fi
config_file="$config_dir/amule.conf"
#[ -d "$config_dir" ] || {
mkdir -m 0755 -p "$config_dir"
chmod g+s "$config_dir"
chown $group:$runasuser "$config_dir"
touch "$config_file" "$config_dir/addresses.dat" "$config_dir/shareddir.dat" \
"$config_dir/ipfilter_static.dat"
[ -d "$config_dir/.aMule" ] || ln -s ./ $config_dir/.aMule
#[ -z "$runasuser" ] || set_owner "$config_dir" $runasuser $group
#}
touch "$config_file"
write_dat_file /etc/amule/addresses.dat "$config_dir/addresses.dat"
write_dat_file /etc/amule/shareddir.dat "$config_dir/shareddir.dat"
write_dat_file /etc/amule/ipfilter_static.dat "$config_dir/ipfilter_static.dat"
#[ "$config_overwrite" == 0 ] || {
set_params "$cfg" $(uci show amule|awk -F'[.=]' '{print $3}'|tr '\n' ' ')
#}
HOME="$config_dir" /usr/bin/amulecmd --create-config-from="$config_file"
cmdline="/usr/bin/amuled -c $config_dir"
[ "$ionice_flags" ] && cmdline="ionice $ionice_flags $cmdline"
procd_open_instance
procd_set_param command $cmdline
procd_set_param respawn retry=60
procd_set_param user "$runasuser"
procd_set_param nice "$nice"
if test -z "$USE";then
procd_set_param limits core="0 0"
else
procd_set_param limits core="0 0" as="$USE $USE"
logger -t amule "Starting with $USE virt mem"
fi
procd_add_jail amule log
procd_add_jail_mount_rw $config_file
procd_add_jail_mount_rw $incoming_dir
procd_add_jail_mount_rw $temp_dir
procd_close_instance
}
start_service() {
killall -9 amuleweb >/dev/null 2>&1
config_load 'amule'
config_foreach amule 'amule'
}
restart() {
stop
sleep 2
start
}

View File

@ -0,0 +1,25 @@
#!/bin/sh
uci -q batch <<-EOF >/dev/null
delete ucitrack.@amule[-1]
add ucitrack amule
set ucitrack.@amule[-1].init=amule
commit ucitrack
EOF
while [ ! $(grep -e "amule" ${IPKG_INSTROOT}/etc/passwd) ]
do
gid=$(awk -v min=1000 -v max=1500 'BEGIN{srand(); print int(min+rand()*(max-min+1))}')
echo amule:x:0:0:99999:7::: >> ${IPKG_INSTROOT}/etc/shadow
grep -e ":$gid:" ${IPKG_INSTROOT}/etc/passwd || ( \
echo "amule:x:$gid:amule" >> ${IPKG_INSTROOT}/etc/group ; \
echo "amule:x:$gid:$gid:amule:/var/run/amule:/bin/false" >> ${IPKG_INSTROOT}/etc/passwd )
done
mkdir -p ${IPKG_INSTROOT}/etc/amule/
touch ${IPKG_INSTROOT}/etc/amule/addresses.dat
touch ${IPKG_INSTROOT}/etc/amule/ipfilter_static.dat
touch ${IPKG_INSTROOT}/etc/amule/shareddir.dat
rm -f /tmp/luci-indexcache
exit 0

View File

@ -0,0 +1,46 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=wsdd2
PKG_RELEASE:=2
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/Andy2244/wsdd2.git
PKG_SOURCE_DATE:=2018-07-24
PKG_SOURCE_VERSION:=2c31ba3b720af81848c47dff7ad7c6c30c0c0f50
PKG_MIRROR_HASH:=eb903a870d99c6001996dbfc22c15e1020278c45ed2441ceb61bc5395f417afa
PKG_MAINTAINER:=Andy Walsh <andy.walsh44+github@gmail.com>
PKG_LICENSE:=GPL-3.0-only
PKG_LICENSE_FILES:=COPYING
include $(INCLUDE_DIR)/package.mk
define Package/wsdd2
SECTION:=net
CATEGORY:=Network
SUBMENU:=IP Addresses and Names
TITLE:=Web Services for Devices (WSD) daemon
URL:=https://kb.netgear.com/2649/NETGEAR-Open-Source-Code-for-Programmers-GPL
endef
define Package/wsdd2/description
Web Services for Devices or Web Services on Devices (WSD),
is a Microsoft API to simplify programming connections to web service
enabled devices, such as printers, scanners and file shares.
This daemon advertises and responds to probe requests from Windows clients looking for file shares.
It also implements LLMNR multicast name lookup services.
endef
define Build/Compile
$(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) $(PKG_BUILD_DIR)/{wsdd2.c,wsd.c,llmnr.c} -o $(PKG_BUILD_DIR)/wsdd2
endef
define Package/wsdd2/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/wsdd2 $(1)/usr/bin/
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./files/wsdd2.init $(1)/etc/init.d/wsdd2
endef
$(eval $(call BuildPackage,wsdd2))

View File

@ -0,0 +1,12 @@
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
start_service() {
procd_open_instance
procd_set_param command /usr/bin/wsdd2 -w
procd_set_param respawn
procd_set_param file /var/etc/smb.conf
procd_close_instance
}

View File

@ -0,0 +1,25 @@
--- a/wsd.c 2018-07-24
+++ b/wsd.c 2018-09-10
@@ -96,13 +96,19 @@ static void uuid_endpoint(char *uuid, si
{
FILE *fp = fopen("/etc/machine-id", "r");
int c, i = 0;
+
+ if (!fp) {
+ fp = fopen("/proc/sys/kernel/random/boot_id", "r");
+ }
- if (!fp)
+ if (!fp) {
+ DEBUG(0, W, "Can't open required '/etc/machine-id' or '/proc/sys/kernel/random/boot_id'");
return;
+ }
while (i < 36 && (c = getc(fp)) != EOF &&
- (isdigit(c) || (islower(c) && isxdigit(c)))) {
- if (i == 8 || i == 13 || i == 18 || i == 23)
+ ((c == '-') || isdigit(c) || (islower(c) && isxdigit(c)))) {
+ if ((c != '-') && (i == 8 || i == 13 || i == 18 || i == 23))
uuid[i++] = '-';
uuid[i++] = c;
}

View File

@ -0,0 +1,136 @@
#
# Copyright (C) 2007-2009 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#
include $(TOPDIR)/rules.mk
PKG_NAME:=wxbase
PKG_VERSION:=2.8.12
PKG_RELEASE:=1
PKG_SOURCE:=wxGTK-$(PKG_VERSION).tar.bz2
PKG_SOURCE_URL:=@SF/wxwindows
PKG_MD5SUM:=08f81ab60647308058f6ce99712b14f8
PKG_BUILD_DIR:=$(BUILD_DIR)/wxGTK-$(PKG_VERSION)
PKG_INSTALL:=1
PKG_CHECK_FORMAT_SECURITY:=0
include $(INCLUDE_DIR)/package.mk
define Package/libwxbase
SECTION:=libs
CATEGORY:=Libraries
TITLE:=Cross-platform C++ framework
URL:=http://www.wxwidgets.org/
DEPENDS:=+libexpat +libstdcpp +zlib +libpthread
endef
define Package/libwxbase/description
wxBase contains most of the non-GUI classes from the wxWindows cross-
-platform C++ framework. There are 2 categories: generally useful portable
code (date/time handling, command line parsing, regular expression support)
and wrappers for the OS objects (files, directories, sockets, threads,
etc.) allowing you to write portable programs easily.
endef
TARGET_CFLAGS += $(FPIC)
# XXX: aMule *needs* the following configure options to be enabled:
# --enable-intl
# --enable-largefile
# --disable-no_rtti
# --with-regex
# --enable-unicode
CONFIGURE_ARGS+= \
--enable-shared \
--disable-rpath \
--with-gnu-ld \
--disable-gui \
--disable-monolithic \
--enable-plugins \
--disable-universal \
--disable-nanox \
--disable-gtk2 \
--disable-gpe \
--disable-optimise \
--disable-debug \
--disable-stl \
--disable-omf \
--disable-debug_flag \
--disable-debug_info \
--disable-debug_gdb \
--disable-debug_cntxt \
--disable-mem_tracing \
--disable-profile \
--disable-no_rtti \
--disable-no_exceptions \
--disable-compat22 \
--disable-compat24 \
--enable-intl \
--disable-backtrace \
--enable-exceptions \
--disable-sound \
--enable-largefile \
\
--without-gtk \
--without-motif \
--without-mac \
--without-cocoa \
--without-wine \
--without-msw \
--without-pm \
--without-mgl \
--without-microwin \
--without-x11 \
--without-libpng \
--without-libjpeg \
--without-libtiff \
--without-libxpm \
--without-libmspack \
--without-sdl \
--without-gnomeprint \
--without-opengl \
--without-dmalloc \
--with-regex="sys" \
--with-zlib="sys" \
--without-odbc \
--with-expat="sys" \
--without-gtk-prefix \
--without-x \
--without-libiconv-prefix \
--without-sdl-prefix \
--without-cppunit-prefix \
--disable-precomp-headers
UNICODE=yes
ifeq ($(UNICODE),yes)
CONFIGURE_ARGS+= --enable-unicode
LIB_PFX:=u
else
CONFIGURE_ARGS+= --disable-unicode
LIB_PFX:=
endif
define Build/InstallDev
$(INSTALL_DIR) $(1)/usr/bin $(1)/usr/include $(1)/usr/lib
$(CP) -L $(PKG_BUILD_DIR)/wx-config $(1)/usr/bin/
$(CP) $(PKG_INSTALL_DIR)/usr/include/wx-2.8 $(1)/usr/include/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libwx_base$(LIB_PFX){,_net,_xml}-*.so* $(1)/usr/lib/
$(CP) $(PKG_INSTALL_DIR)/usr/lib/wx $(1)/usr/lib/
$(SED) 's,-I$$$${includedir}/wx-2.8,-I$(STAGING_DIR)/usr/include/wx-2.8,g' $(1)/usr/bin/wx-config
$(SED) 's,-I$$$${libdir}/wx/include,-I$(STAGING_DIR)/usr/lib/wx/include,g' $(1)/usr/bin/wx-config
endef
define Package/libwxbase/install
$(INSTALL_DIR) $(1)/usr/lib
$(CP) $(PKG_INSTALL_DIR)/usr/lib/libwx_base$(LIB_PFX){,_net,_xml}-*.so.* $(1)/usr/lib/
endef
$(eval $(call BuildPackage,libwxbase))

View File

@ -0,0 +1,15 @@
diff -up wxGTK-2.8.12/src/common/appbase.cpp.abicheck wxGTK-2.8.12/src/common/appbase.cpp
--- wxGTK-2.8.12/src/common/appbase.cpp.abicheck 2015-03-12 17:15:18.000000000 +0100
+++ wxGTK-2.8.12/src/common/appbase.cpp 2015-03-12 17:15:57.000000000 +0100
@@ -424,10 +424,7 @@ bool wxAppConsole::CheckBuildOptions(con
msg.Printf(_T("Mismatch between the program and library build versions detected.\nThe library used %s,\nand %s used %s."),
lib.c_str(), progName.c_str(), prog.c_str());
- wxLogFatalError(msg.c_str());
-
- // normally wxLogFatalError doesn't return
- return false;
+ wxLogWarning(msg.c_str());
}
#undef wxCMP