diff --git a/package/lean/amule/Makefile b/package/lean/amule/Makefile new file mode 100644 index 000000000..50ccca8a3 --- /dev/null +++ b/package/lean/amule/Makefile @@ -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)) diff --git a/package/lean/amule/patches/001-amule-dlp.patch b/package/lean/amule/patches/001-amule-dlp.patch new file mode 100644 index 000000000..5a37a27a6 --- /dev/null +++ b/package/lean/amule/patches/001-amule-dlp.patch @@ -0,0 +1,1548 @@ +diff -Naur a/configure.ac b/configure.ac +--- a/configure.ac 2016-10-06 19:01:54.000000000 +0800 ++++ b/configure.ac 2016-10-14 12:33:51.660347919 +0800 +@@ -89,6 +89,14 @@ + KDE_CONFIG_OPTIONS + QT_CONFIG_OPTIONS + ++#Dynamic Leecher Protection - Bill Lee ++AC_ARG_ENABLE( ++ [dlp], ++ [AS_HELP_STRING( ++ [--disable-dlp], ++ [Do not compile DLP.])], ++ [ENABLE_DLP=$enableval], [ENABLE_DLP=yes]) ++ + # Default is yes, because they're most likely compatible. + # However, this is only used when cross-compiling. + AC_ARG_WITH( +@@ -457,6 +465,8 @@ + AM_CONDITIONAL(GENERATE_FLEX_HEADER, test x$HAVE_FLEX_EXTENDED = xyes) + AM_CONDITIONAL(INSTALL_SKINS, test MULE_IS_ENABLED_ANY([monolithic, amule-gui])) + AM_CONDITIONAL(PLASMAMULE, test MULE_IS_ENABLED([plasmamule])) ++#Dynamic Leech Protection - Bill Lee ++AM_CONDITIONAL(ENABLE_DLP, test x$ENABLE_DLP = xyes) + + AM_CONDITIONAL([COMPILE_LIB_COMMON], [test MULE_IS_ENABLED_ANY([monolithic, amule-daemon, amulecmd, webserver, amule-gui, fileview])]) + AM_CONDITIONAL([COMPILE_LIB_EC], [test MULE_IS_ENABLED_ANY([monolithic, amule-daemon, amulecmd, webserver, amule-gui])]) +diff -Naur a/po/zh_CN.po b/po/zh_CN.po +--- a/po/zh_CN.po 2016-10-06 19:01:54.000000000 +0800 ++++ b/po/zh_CN.po 2016-10-14 12:33:51.662347964 +0800 +@@ -5,6 +5,7 @@ + # xiaoqiao <29551030@qq.com>, 2007, 2008. + # JimHu , 2009. + # Xiaoqiao , 2010. ++# Bill Lee , 2010, 2011. + # Yi Qi ,2011. + # + msgid "" +@@ -467,6 +468,12 @@ + msgid "http://kademlia.scs.cs.nyu.edu\n" + msgstr "http://kademlia.scs.cs.nyu.edu\n" + ++msgid "\nDynamic Leech Protection\n" ++msgstr "\n动态吸血保护\n" ++ ++msgid " Homepage: http://amule-dlp.googlecode.com \n" ++msgstr " 主页:http://amule-dlp.googlecode.com \n" ++ + #: src/amuleDlg.cpp:512 src/KadDlg.cpp:193 src/PartFile.cpp:918 + #: src/PartFile.cpp:926 src/PrefsUnifiedDlg.cpp:629 + #: src/PrefsUnifiedDlg.cpp:734 src/PrefsUnifiedDlg.cpp:847 +@@ -3856,6 +3863,9 @@ + msgid "Click on this button to update the nodes list from URL ..." + msgstr "按此更新节点列表自网址..." + ++msgid "DLP Info" ++msgstr "动态反吸血信息" ++ + #: src/muuli_wdr.cpp:2649 + msgid "Nodes (0)" + msgstr "节点(0)" +@@ -7682,6 +7692,48 @@ + #~ "\n" + #~ "此外,浏览器设定已经被重设为系统默认值。如有必要,请重新配置浏览器选项。\n" + ++msgid "Dynamic Leecher Protection Options" ++msgstr "动态反吸血保护选项" ++ ++msgid "Reload antiLeech" ++msgstr "重新装载 antiLeech" ++ ++msgid "Check bad modstring" ++msgstr "根据 Mod 名字检测吸血驴" ++ ++msgid "Check bad username" ++msgstr "根据用户名字检测吸血驴" ++ ++msgid "Check bad userhash" ++msgstr "检测错误的用户哈希值" ++ ++msgid "Check bad hello tag" ++msgstr "根据握手标签(HelloTag)检测吸血驴" ++ ++msgid "Check bad info tag" ++msgstr "根据 InfoTag 检测吸血驴" ++ ++msgid "Check ghost mod" ++msgstr "检测幽灵客户端(Ghost Mod)" ++ ++#~ msgid "Ban VeryCD easyMule2" ++#~ msgstr "屏蔽 VeryCD easyMule2" ++ ++msgid "Ban eMule VeryCD mod(Please consider carefully whether to use)" ++msgstr "屏蔽 VeryCD eMule(请慎重考虑是否使用)" ++ ++#~ msgid "Ban VeryCD miniMule" ++#~ msgstr "屏蔽 VeryCD miniMule" ++ ++msgid "Trying to load antiLeech..." ++msgstr "尝试加载 antiLeech..." ++ ++msgid "No antiLeech available!" ++msgstr "未找到 antiLeech!" ++ ++msgid "Succeed loading antiLeech! Version: %d" ++msgstr "成功加载 antiLeech! 版本: %d" ++ + #~ msgid "Fetching status..." + #~ msgstr "正在获取状态..." + +diff -Naur a/src/BaseClient.cpp b/src/BaseClient.cpp +--- a/src/BaseClient.cpp 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/BaseClient.cpp 2016-10-14 12:35:45.793953665 +0800 +@@ -1,4 +1,3 @@ +-// + // This file is part of the aMule Project. + // + // Copyright (c) 2003-2011 aMule Team ( admin@amule.org / http://www.amule.org ) +@@ -23,6 +22,11 @@ + // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + // + ++//Dynamic Leech Protect - Bill Lee ++#ifdef AMULE_DLP ++#include "DLP.h" ++#endif ++ + #include + #include + #include +@@ -83,10 +87,8 @@ + #include "kademlia/kademlia/UDPFirewallTester.h" + #include "kademlia/routing/RoutingZone.h" + +- + //#define __PACKET_DEBUG__ + +- + // some client testing variables + static wxString crash_name = wxT("[Invalid User Name]"); + static wxString empty_name = wxT("[Empty User Name]"); +@@ -290,6 +292,10 @@ + m_cMessagesReceived = 0; + m_cMessagesSent = 0; + ++ #ifdef AMULE_DLP ++ dlp_nonofficialopcodes = false; //Dynamic Leecher Protect ++ #endif ++ + } + + +@@ -635,6 +641,15 @@ + m_fSharedDirectories = 1; + dwEmuleTags |= 4; + break; ++ //Bill Lee start ++ //Dynamic Leecher Protection ++ #ifdef AMULE_DLP ++ default: //if tag isn't those above, it may be used by leecher. ++ theDLP->CheckHelloTag(this, temptag.GetNameID()); ++ dlp_nonofficialopcodes = true; //to detect Ghost Mod ++ break; ++ //Bill Lee end ++ #endif + } + } + +@@ -717,6 +732,11 @@ + Kademlia::CKademlia::Bootstrap(wxUINT32_SWAP_ALWAYS(GetIP()), GetKadPort()); + } + ++ //Dynamic Leecher Protection - Bill Lee ++ #ifdef AMULE_DLP ++ theDLP->DLPCheck(this); ++ #endif ++ + return bIsMule; + } + +@@ -966,6 +986,14 @@ + % GetClientFullInfo() + ); + ++ //Bill Lee start ++ //Dynamic Leecher Protection ++ #ifdef AMULE_DLP ++ theDLP->CheckInfoTag(this, temptag.GetNameID()); ++ dlp_nonofficialopcodes = true; ++ #endif ++ //Bill Lee end ++ + break; + } + } +@@ -1003,6 +1031,11 @@ + m_byInfopacketsReceived |= IP_EMULEPROTPACK; + } + ++ //Dynamic Leecher Protection - Added by Bill Lee ++ #ifdef AMULE_DLP ++ theDLP->DLPCheck(this); ++ #endif ++ + return (protocol_version == 0xFF); // This was a OS_Info? + } + +@@ -2302,7 +2335,7 @@ + } + + +-#ifdef __DEBUG__ ++#if defined (__DEBUG__) || defined (AMULE_DLP) + wxString CUpDownClient::GetClientFullInfo() + { + if (m_clientVerString.IsEmpty()) { +diff -Naur a/src/CString_wx.h b/src/CString_wx.h +--- a/src/CString_wx.h 1970-01-01 08:00:00.000000000 +0800 ++++ b/src/CString_wx.h 2016-10-14 12:33:51.664348010 +0800 +@@ -0,0 +1,59 @@ ++/** ++ * Author: Bill Lee ++ * License: GNU GPL ++ */ ++//--------------------- ++#ifndef CSTRING_WX_H ++#define CSTRING_WX_H ++ ++//#include ++#include ++ ++class CString : public wxString{ ++ public: ++ CString(){} ++ CString(wxChar c, size_t n=1): wxString(c, n){} ++ CString(const wxChar* str): wxString(str){} ++ CString(const wxString& str): wxString(str){} ++ CString(const CString& str): wxString(str){} ++ //--------------------- ++ CString& operator=(const wxChar* str){ ++ wxString::operator=(str); ++ return *this; ++ } ++ //operator*() from wxString; ++ size_t GetLength()const{ return Length(); } ++ wxChar GetAt(size_t nIndex)const{ return GetChar(nIndex); } ++ //IsEmpty() from wxString; ++ CString& TrimLeft(wxChar c){ ++ size_t pos = find_first_not_of(c); ++ if(pos == 0) ++ return *this; ++ erase(0, pos); ++ return *this; ++ } ++ CString& TrimRight(wxChar c){ ++ size_t pos = find_last_not_of(c) + 1; ++ if(pos == Length()) ++ return *this; ++ erase(pos, Length() - pos); ++ return *this; ++ } ++ CString Trim(){ ++ CString ret(*this); ++ ret.wxString::Trim(false); /* wxString::Trim(bool fromright = true) */ ++ ret.wxString::Trim(true); ++ return ret; ++ } ++ //Find(wxChar) and Find(wxChar*) from wxString; ++ int Find(const CString& str)const{ return wxString::Find(str.c_str()); } ++ int ReverseFind(const wxChar c)const{ return wxString::Find(c, true); } ++ int ReverseFind(const wxChar* str)const{ return rfind(str); } ++ int ReverseFind(const CString& str)const{ return rfind(str); } ++ CString Right(size_t len)const{ return wxString::Right(len); } ++ CString Left(size_t len)const{ return wxString::Left(len); } ++ CString Mid(size_t first, size_t count = wxSTRING_MAXLEN)const{ ++ return wxString::Mid(first, count); ++ } ++}; ++#endif +diff -Naur a/src/DLP.cpp b/src/DLP.cpp +--- a/src/DLP.cpp 1970-01-01 08:00:00.000000000 +0800 ++++ b/src/DLP.cpp 2016-10-14 12:33:51.664348010 +0800 +@@ -0,0 +1,190 @@ ++// Copyright (C) 2011 Bill Lee ++// ++// This program is free software; you can redistribute it and/or modify ++// it under the terms of the GNU General Public License as published by ++// the Free Software Foundation; either version 2 of the License, or ++// (at your option) any later version. ++// ++// This program is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++// ++// You should have received a copy of the GNU General Public License ++// along with this program; if not, write to the Free Software ++// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA ++// ++#include "Logger.h" ++ ++#include "DLP.h" ++#include "antiLeech.h" ++#include /* Needed for wxDynamicLibrary */ ++ ++#include "DLPPref.h" ++#include "Preferences.h" // Needed for CPreferences ++#include "amule.h" // Needed for theApp ++ ++#include /* Needed for wxStandardPaths */ ++ ++#define PRE_CHECK(tag) if( (!c->IsBanned()) && antiLeech && (thePrefs::GetDLPCheckMask() & tagn) ) ++ ++void DLP::CheckHelloTag(CUpDownClient* c, UINT tagn){ ++ PRE_CHECK(PF_HELLOTAG){ ++ const wxChar* dlp_result = antiLeech->DLPCheckHelloTag(tagn); ++ if(dlp_result != NULL) { ++ wxString ret; ++ ret.Printf(_("[HelloTag %s] %s"), dlp_result, c->GetClientFullInfo().c_str()); ++ //ret.Printf(_("[HelloTag %s] %s"), dlp_result, c->GetClientShortInfo().c_str()); ++ c->Ban(); ++ theApp->AddDLPMessageLine(ret); ++ } ++ } ++} ++ ++void DLP::CheckInfoTag(CUpDownClient* c, UINT tagn){ ++ PRE_CHECK(PF_INFOTAG){ ++ const wxChar* dlp_result = antiLeech->DLPCheckInfoTag(tagn); ++ if(dlp_result != NULL) { ++ wxString ret; ++ ret.Printf(_("[InfoTag %s] %s"), dlp_result, c->GetClientFullInfo().c_str()); ++ //ret.Printf(_("[InfoTag %s] %s"), dlp_result, c->GetClientShortInfo().c_str()); ++ c->Ban(); ++ theApp->AddDLPMessageLine(ret); ++ } ++ } ++} ++ ++bool DLP::DLPCheck(CUpDownClient* c){ ++ const wxChar* tmp = NULL; ++ wxString ret; ++ ++ unsigned int prefs = thePrefs::GetDLPCheckMask(); ++ ++ CString modver(c->GetClientModString()); ++ CString clientver(c->GetClientVerString()); ++ CString uname(c->GetUserName()); ++ CString uhash(wxString(c->GetUserHash().EncodeSTL().c_str(), wxConvUTF8)); ++ ++ //CheckGhostMod ++ if(prefs & PF_GHOSTMOD) { ++ if(c->HasNonOfficialOpCodes() && (modver.IsEmpty())) { ++ ret = _("GhostMod"); ++ tmp = ret.c_str(); //char pointer ++ } ++ } ++ ++ // Check bad modstring ++ if ((prefs & PF_MODSTRING) && (tmp == NULL)) { ++ if((tmp = antiLeech->DLPCheckModstring_Soft(modver.c_str(), clientver.c_str())) == NULL) ++ tmp = antiLeech->DLPCheckModstring_Hard(modver.c_str(), clientver.c_str()); ++ } ++ /* ++ if ((prefs & PF_USERHASH) && (tmp == NULL)) { ++ // not finished ++ } ++ */ ++ // Check bad username ++ if ((prefs & PF_USERNAME) && (tmp == NULL)) { ++ if ((tmp = antiLeech->DLPCheckNameAndHashAndMod(uname, uhash, modver)) == NULL){ ++ if( (tmp = antiLeech->DLPCheckUsername_Hard(uname.c_str())) == NULL ) ++ tmp = antiLeech->DLPCheckUsername_Soft(uname.c_str()); ++ } ++ } ++ ++ ++ // Check VeryCD eMule ++ if ((prefs & PF_VERYCDEMULE) && (tmp == NULL)) { ++ if(modver.Find(wxT("VeryCD")) != wxNOT_FOUND){ ++ ret = _("VeryCD Mod"); ++ tmp = ret.c_str(); ++ } ++ } ++ ++ if (tmp != NULL) { ++ ret = tmp; ++ wxString wxInfo; ++ wxInfo.Printf(wxT("[%s] %s"), ret.c_str(), c->GetClientFullInfo().c_str()); ++ //wxInfo.Printf(wxT("[%s] %s"), ret.c_str(), c->GetClientShortInfo().c_str()); ++ c->Ban(); ++ theApp->AddDLPMessageLine(wxInfo); ++ return true; ++ } ++ ++ return false; ++ ++} ++ ++int DLP::ReloadAntiLeech(){ ++ //Unloading ++ AddLogLineN( _("Checking if there is a antiLeech working...")); ++ if(antiLeechLib.IsLoaded()){ ++ Destoryer fn = (Destoryer)(antiLeechLib.GetSymbol( wxT("destoryAntiLeechInstant"))); ++ wxASSERT(fn); ++ AddLogLineN( _("Unload previous antiLeech...")); ++ fn(antiLeech); ++ antiLeech = NULL; ++ antiLeechLib.Unload(); ++ } ++ else ++ AddLogLineN( _("No working antiLeech exists.")); ++ //Get lib's location ++ wxStandardPathsBase &spb(wxStandardPaths::Get()); ++#ifdef __WXMSW__ ++ wxString dataDir(spb.GetPluginsDir()); ++#elif defined(__WXMAC__) ++ wxString dataDir(spb.GetDataDir()); ++#else ++ wxString dataDir(spb.GetDataDir().BeforeLast(wxT('/')) + wxT("/amule")); ++#endif ++ wxString localName = wxDynamicLibrary::CanonicalizeName(wxT("antiLeech")); ++ wxString systemwideFile(JoinPaths(dataDir, localName)); ++ //wxString userFile(theApp->ConfigDir + localName); ++ wxString userFile(thePrefs::GetConfigDir() + localName); ++ wxString fallbackFile(wxT("antiLeech")); ++ //Try to load lib; ++ AddLogLineN( _("Trying to load antiLeech...")); ++ if( !LoadFrom(userFile) ){ ++ if( !LoadFrom(systemwideFile) ){ ++ if( !LoadFrom(fallbackFile) ){ ++ AddLogLineC( _("No antiLeech available!")); ++ return 1; //Not found ++ } ++ } ++ } ++ //Searching symbol "createAntiLeechInstant" ++ Creator fn = (Creator)(antiLeechLib.GetSymbol( wxT("createAntiLeechInstant") )); ++ if(!fn){ ++ antiLeechLib.Unload(); ++ AddLogLineC( _("antiLeech found, but it seems not to be a valid antiLeech!")); ++ return 2; //Found, but isn't antiLeech ++ } ++ //Try to create antiLeech ++ antiLeech = fn(); ++ if(antiLeech){ ++ wxString logline; ++ logline.Printf(_("Succeed loading antiLeech! Version: %d"), antiLeech->GetDLPVersion()); ++ AddLogLineC( logline); ++ return 0; ++ } ++ //else ++ antiLeechLib.Unload(); ++ AddLogLineC( _("FAIL! An error occur when setting up antiLeech.")); ++ return 3; //Fail to create antiLeech instant ++ ++} ++ ++DLP::~DLP(){ ++ if(antiLeechLib.IsLoaded()){ ++ Destoryer fn = (Destoryer)(antiLeechLib.GetSymbol( wxT("destoryAntiLeechInstant"))); ++ wxASSERT(fn); ++ AddLogLineN( _("Unload previous antiLeech...")); ++ fn(antiLeech); ++ //antiLeech = NULL; ++ //antiLeechLib.Unload(); ++ } ++} ++ ++bool DLP::LoadFrom(wxString& file){ ++ antiLeechLib.Load(file); ++ return antiLeechLib.IsLoaded(); ++} +diff -Naur a/src/DLP.h b/src/DLP.h +--- a/src/DLP.h 1970-01-01 08:00:00.000000000 +0800 ++++ b/src/DLP.h 2016-10-14 12:33:51.665348032 +0800 +@@ -0,0 +1,45 @@ ++// Copyright (C) 2011 Bill Lee ++// ++// This program is free software; you can redistribute it and/or modify ++// it under the terms of the GNU General Public License as published by ++// the Free Software Foundation; either version 2 of the License, or ++// (at your option) any later version. ++// ++// This program is distributed in the hope that it will be useful, ++// but WITHOUT ANY WARRANTY; without even the implied warranty of ++// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++// GNU General Public License for more details. ++// ++// You should have received a copy of the GNU General Public License ++// along with this program; if not, write to the Free Software ++// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA ++// ++ ++class IantiLeech; //forward declaretion ++ ++#include "updownclient.h" // Needed for CUpDownClient ++#include "antiLeech_wx.h" ++ ++#include ++ ++class DLP ++{ ++public: ++ DLP() : antiLeech(NULL) { ReloadAntiLeech(); } ++ ~DLP(); ++ ++ void CheckHelloTag(CUpDownClient*, UINT tagnumber); ++ void CheckInfoTag(CUpDownClient*, UINT tagnumber); ++ bool DLPCheck(CUpDownClient*); ++ ++ int ReloadAntiLeech(); ++ ++private: ++ typedef IantiLeech* (*Creator)(); ++ typedef int (*Destoryer)(IantiLeech*); ++ ++ wxDynamicLibrary antiLeechLib; ++ IantiLeech* antiLeech; ++ ++ bool LoadFrom(wxString& file); ++}; +diff -Naur a/src/DLPPref.h b/src/DLPPref.h +--- a/src/DLPPref.h 1970-01-01 08:00:00.000000000 +0800 ++++ b/src/DLPPref.h 2016-10-14 12:33:51.665348032 +0800 +@@ -0,0 +1,15 @@ ++#ifndef ANTILEECH_AMULE_H ++#define ANTILEECH_AMULE_H ++ ++/* Define DLPCheck prefs arg */ ++#define PF_MODSTRING 0x1 ++#define PF_USERHASH 0x2 ++#define PF_USERNAME 0x4 ++#define PF_HELLOTAG 0x8 ++#define PF_INFOTAG 0x10 ++#define PF_VERYCDEMULE 0x20 ++//#define PF_EASYMULE 0x40 ++//#define PF_MINIMULE 0x80 ++#define PF_GHOSTMOD 0x100 ++ ++#endif +diff -Naur a/src/DownloadQueue.cpp b/src/DownloadQueue.cpp +--- a/src/DownloadQueue.cpp 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/DownloadQueue.cpp 2016-10-14 12:33:51.665348032 +0800 +@@ -623,6 +623,15 @@ + return; + } + ++ //Dynamic Leecher Protect - Bill Lee ++ #ifdef AMULE_DLP ++ if ( source->IsBanned() ){ ++ source->Safe_Delete(); ++ return; ++ } ++ #endif ++ //Bill Lee end ++ + // Filter sources which are known to be dead/useless + if ( theApp->clientlist->IsDeadSource( source ) || sender->IsDeadSource(source) ) { + source->Safe_Delete(); +diff -Naur a/src/ExternalConn.cpp b/src/ExternalConn.cpp +--- a/src/ExternalConn.cpp 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/ExternalConn.cpp 2016-10-14 12:33:51.666348055 +0800 +@@ -57,6 +57,9 @@ + #include "kademlia/kademlia/UDPFirewallTester.h" + #include "Statistics.h" + ++#ifdef AMULE_DLP ++#include "DLP.h" ++#endif + + //-------------------- File_Encoder -------------------- + +@@ -1384,6 +1387,15 @@ + } + } + break; ++ //Dynamic Leech Protect - Bill Lee ++ #ifdef AMULE_DLP ++ case EC_OP_ANTILEECH_RELOAD: ++ if( theDLP->ReloadAntiLeech() ) ++ response = new CECPacket(EC_OP_FAILED); ++ else ++ response = new CECPacket(EC_OP_NOOP); ++ break; ++ #endif + // + // Status requests + // +diff -Naur a/src/Logger.cpp b/src/Logger.cpp +--- a/src/Logger.cpp 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/Logger.cpp 2016-10-14 12:40:22.827322335 +0800 +@@ -297,6 +297,8 @@ + } + + CLogger theLogger; ++//Dynamic Leech Protect - persmule ++CLogger dlpLogger; + + BEGIN_EVENT_TABLE(CLogger, wxEvtHandler) + EVT_MULE_LOGGING(CLogger::OnLoggingEvent) +diff -Naur a/src/Logger.h b/src/Logger.h +--- a/src/Logger.h 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/Logger.h 2016-10-14 12:41:14.694519856 +0800 +@@ -310,6 +310,8 @@ + }; + + extern CLogger theLogger; ++//Dynamic Leech Protect - persmule ++extern CLogger dlpLogger; + + /** + * This class forwards log-lines from wxWidgets to CLogger. +@@ -456,5 +458,8 @@ + #define AddLogLineF(string) theLogger.AddLogLine(__TFILE__, __LINE__, false, logStandard, string, false, false) + #endif + ++//Dynamic Leech Protect - persmule ++#define DlpAddLogLine(string) dlpLogger.AddLogLine(__TFILE__, __LINE__, false, logStandard, string, false, false) ++ + #endif + // File_checked_for_headers +diff -Naur a/src/LoggerConsole.cpp b/src/LoggerConsole.cpp +--- a/src/LoggerConsole.cpp 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/LoggerConsole.cpp 2016-10-14 12:41:54.805446813 +0800 +@@ -85,6 +85,8 @@ + } + + CLogger theLogger; ++//Dynamic Leech Protect - persmule ++CLogger dlpLogger; + + BEGIN_EVENT_TABLE(CLogger, wxEvtHandler) + END_EVENT_TABLE() +diff -Naur a/src/Makefile.am b/src/Makefile.am +--- a/src/Makefile.am 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/Makefile.am 2016-10-14 12:33:51.666348055 +0800 +@@ -179,6 +179,13 @@ + kademlia/routing/RoutingZone.cpp + + ++#Dynamic Leecher Protection - Bill Lee ++if ENABLE_DLP ++core_sources += \ ++ DLP.cpp ++AM_CPPFLAGS += -DAMULE_DLP ++endif ++ + gui_sources = \ + amule-gui.cpp \ + amuleDlg.cpp \ +diff -Naur a/src/Preferences.cpp b/src/Preferences.cpp +--- a/src/Preferences.cpp 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/Preferences.cpp 2016-10-14 12:33:51.667348078 +0800 +@@ -51,6 +51,11 @@ + + #include "UserEvents.h" + ++#ifdef AMULE_DLP ++#include "DLPPref.h" ++#include "antiLeech.h" ++#endif ++ + #ifndef AMULE_DAEMON + #include + #include "muuli_wdr.h" +@@ -344,6 +349,19 @@ + wxWindow* m_widget; + }; + ++/* Dynamic Leecher Protection */ ++#ifdef AMULE_DLP ++bool CPreferences::s_DLPCheckModString; ++bool CPreferences::s_DLPCheckUsername; ++bool CPreferences::s_DLPCheckUserHash; ++bool CPreferences::s_DLPCheckHelloTag; ++bool CPreferences::s_DLPCheckInfoTag; ++//bool CPreferences::s_DLPCheckEasyMule; ++bool CPreferences::s_DLPCheckVeryCDMod; ++//bool CPreferences::s_DLPCheckminiMule; //Added by Bill Lee ++bool CPreferences::s_DLPCheckGhostMod; ++unsigned int CPreferences::s_DLPCheckMask; ++#endif + + /** Cfg class for wxStrings. */ + class Cfg_Str : public Cfg_Tmpl +@@ -953,6 +971,11 @@ + s_userhash[5] = 14; + s_userhash[14] = 111; + ++ // Dynamic Leecher Protection ++ #ifdef AMULE_DLP ++ CalcDLPCheckMask(); ++ #endif ++ + #ifndef CLIENT_GUI + LoadPreferences(); + ReloadSharedFolders(); +@@ -1062,6 +1085,20 @@ + NewCfgItem( IDC_NETWORKKAD, (new Cfg_Bool( wxT("/eMule/ConnectToKad"), s_ConnectToKad, true )) ); + NewCfgItem( IDC_NETWORKED2K, ( new Cfg_Bool( wxT("/eMule/ConnectToED2K"), s_ConnectToED2K, true ) )); + ++ /** ++ * Dynamic Leecher Protection ++ **/ ++ #ifdef AMULE_DLP ++ NewCfgItem(IDC_CHECKMODSTRING, (new Cfg_Bool( wxT("/DLP/CheckModString"), s_DLPCheckModString, true ))); ++ NewCfgItem(IDC_CHECKUSERNAME, (new Cfg_Bool( wxT("/DLP/CheckUsername"), s_DLPCheckUsername, true ))); ++ NewCfgItem(IDC_CHECKUSERHASH, (new Cfg_Bool( wxT("/DLP/CheckUserHash"), s_DLPCheckUserHash, true ))); ++ NewCfgItem(IDC_CHECKHELLOTAG, (new Cfg_Bool( wxT("/DLP/CheckHelloTag"), s_DLPCheckHelloTag, true ))); ++ NewCfgItem(IDC_CHECKINFOTAG, (new Cfg_Bool( wxT("/DLP/CheckInfoTag"), s_DLPCheckInfoTag, true ))); ++ //NewCfgItem(IDC_CHECKEASYMULE, (new Cfg_Bool( wxT("/DLP/CheckEasyMule"), s_DLPCheckEasyMule, true ))); //Modified by Bill Lee ++ NewCfgItem(IDC_CHECKVERYCDMOD, (new Cfg_Bool( wxT("/DLP/CheckVeryCDMod"), s_DLPCheckVeryCDMod, false ))); ++ //NewCfgItem(IDC_CHECKMINIMULE, (new Cfg_Bool( wxT("/DLP/CheckminiMule"), s_DLPCheckminiMule, true))); //Added by Bill Lee ++ NewCfgItem(IDC_CHECKGHOSTMOD, (new Cfg_Bool( wxT("/DLP/CheckGhostMod"), s_DLPCheckGhostMod, true ))); //Added by Bill Lee. ++ #endif + + /** + * Files +@@ -1471,6 +1508,11 @@ + } + + SavePreferences(); ++ ++ // Dynamic Leecher Protection ++ #ifdef AMULE_DLP ++ CalcDLPCheckMask(); ++ #endif + + #ifndef CLIENT_GUI + CTextFile sdirfile; +@@ -1483,6 +1525,21 @@ + #endif + } + ++#ifdef AMULE_DLP ++void CPreferences::CalcDLPCheckMask() ++{ ++ s_DLPCheckMask = 0; ++ if (s_DLPCheckModString) s_DLPCheckMask |= PF_MODSTRING; ++ if (s_DLPCheckUsername) s_DLPCheckMask |= PF_USERNAME; ++ if (s_DLPCheckUserHash) s_DLPCheckMask |= PF_USERHASH; ++ if (s_DLPCheckHelloTag) s_DLPCheckMask |= PF_HELLOTAG; ++ if (s_DLPCheckInfoTag) s_DLPCheckMask |= PF_INFOTAG; ++ if (s_DLPCheckGhostMod) s_DLPCheckMask |= PF_GHOSTMOD; ++ //if (s_DLPCheckEasyMule) s_DLPCheckMask |= PF_EASYMULE; ++ if (s_DLPCheckVeryCDMod) s_DLPCheckMask |= PF_VERYCDEMULE; ++ //if (s_DLPCheckminiMule) s_DLPCheckMask |= PF_MINIMULE; //Added by Bill Lee ++} ++#endif + + CPreferences::~CPreferences() + { +diff -Naur a/src/Preferences.h b/src/Preferences.h +--- a/src/Preferences.h 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/Preferences.h 2016-10-14 12:33:51.667348078 +0800 +@@ -579,6 +579,11 @@ + // Sleep + static bool GetPreventSleepWhileDownloading() { return s_preventSleepWhileDownloading; } + static void SetPreventSleepWhileDownloading(bool status) { s_preventSleepWhileDownloading = status; } ++ ++ // Dynamic Leecher Protection ++ #ifdef AMULE_DLP ++ static unsigned int GetDLPCheckMask() {return s_DLPCheckMask;} ++ #endif + protected: + static int32 GetRecommendedMaxConnections(); + +@@ -599,6 +604,11 @@ + private: + void LoadPreferences(); + void SavePreferences(); ++ ++ // Dynamic Leecher Protection ++ #ifdef AMULE_DLP ++ void CalcDLPCheckMask(); ++ #endif + + protected: + static wxString s_configDir; +@@ -813,6 +823,20 @@ + // Stats server + static wxString s_StatsServerName; + static wxString s_StatsServerURL; ++ ++ // Dynamic Leecher Protection ++ #ifdef AMULE_DLP ++ static bool s_DLPCheckModString; ++ static bool s_DLPCheckUsername; ++ static bool s_DLPCheckUserHash; ++ static bool s_DLPCheckHelloTag; ++ static bool s_DLPCheckInfoTag; ++ //static bool s_DLPCheckEasyMule; ++ static bool s_DLPCheckVeryCDMod; ++ //static bool s_DLPCheckminiMule; //Added by Bill Lee ++ static bool s_DLPCheckGhostMod; //Added by Bill Lee ++ static unsigned int s_DLPCheckMask; ++ #endif + }; + + +diff -Naur a/src/PrefsUnifiedDlg.cpp b/src/PrefsUnifiedDlg.cpp +--- a/src/PrefsUnifiedDlg.cpp 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/PrefsUnifiedDlg.cpp 2016-10-14 12:33:51.668348101 +0800 +@@ -53,6 +53,11 @@ + #include "UserEvents.h" + #include "PlatformSpecific.h" // Needed for PLATFORMSPECIFIC_CAN_PREVENT_SLEEP_MODE + ++//Dynamic Leech Protect - Bill Lee ++#ifdef AMULE_DLP ++#include "DLP.h" ++#endif ++ + BEGIN_EVENT_TABLE(PrefsUnifiedDlg,wxDialog) + // Events + #define USEREVENTS_EVENT(ID, NAME, VARS) \ +@@ -114,6 +119,11 @@ + EVT_CHOICE(IDC_COLORSELECTOR, PrefsUnifiedDlg::OnColorCategorySelected) + EVT_LIST_ITEM_SELECTED(ID_PREFSLISTCTRL,PrefsUnifiedDlg::OnPrefsPageChange) + ++ //Dynamic Leech Protect - Bill Lee ++ #ifdef AMULE_DLP ++ EVT_BUTTON(IDC_RELOADANTILEECH, PrefsUnifiedDlg::OnButtonReloadAntiLeech) ++ #endif ++ + EVT_INIT_DIALOG(PrefsUnifiedDlg::OnInitDialog) + + EVT_COMMAND_SCROLL(IDC_SLIDER, PrefsUnifiedDlg::OnScrollBarChange) +@@ -187,6 +197,9 @@ + { wxTRANSLATE("Online Signature"), PreferencesOnlineSigTab, 21 }, + { wxTRANSLATE("Advanced"), PreferencesaMuleTweaksTab, 12 }, + { wxTRANSLATE("Events"), PreferencesEventsTab, 5 } ++#ifdef AMULE_DLP ++ ,{ wxTRANSLATE("DLP"), PreferencesDLPTab, 5} ++#endif + #ifdef __DEBUG__ + ,{ wxTRANSLATE("Debugging"), PreferencesDebug, 25 } + #endif +@@ -1076,6 +1089,21 @@ + theApp->ipfilter->Update( CastChild( IDC_IPFILTERURL, wxTextCtrl )->GetValue() ); + } + ++//Bill Lee ++#ifdef AMULE_DLP ++void PrefsUnifiedDlg::OnButtonReloadAntiLeech(wxCommandEvent& WXUNUSED(event)){ ++ #ifndef CLIENT_GUI ++ if( theDLP->ReloadAntiLeech() ) ++ wxMessageBox(_("Cannot load antiLeech!"), _("Message"), wxOK | wxICON_EXCLAMATION, this); ++ else ++ wxMessageBox(_("Succeed loading antiLeech!"), _("Message"), wxOK | wxICON_INFORMATION, this); ++ #else ++ AddLogLineN(_("Reload antiLeech from remote GUI has not been implemented.")); ++ wxMessageBox(_("Sorry, it has not been implemented yet!")); ++ #endif ++} ++#endif ++ + + void PrefsUnifiedDlg::OnPrefsPageChange(wxListEvent& event) + { +diff -Naur a/src/PrefsUnifiedDlg.h b/src/PrefsUnifiedDlg.h +--- a/src/PrefsUnifiedDlg.h 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/PrefsUnifiedDlg.h 2016-10-14 12:33:51.668348101 +0800 +@@ -124,6 +124,9 @@ + void OnUserEventSelected(wxListEvent& event); + void OnLanguageChoice(wxCommandEvent &event); + void CreateEventPanels(const int idx, const wxString& vars, wxWindow* parent); ++ #ifdef AMULE_DLP ++ void OnButtonReloadAntiLeech(wxCommandEvent &event); /* Dynamic Leech Protect - Bill Lee */ ++ #endif + + void OnInitDialog( wxInitDialogEvent& evt ); + +diff -Naur a/src/ServerWnd.cpp b/src/ServerWnd.cpp +--- a/src/ServerWnd.cpp 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/ServerWnd.cpp 2016-10-14 12:33:51.668348101 +0800 +@@ -46,6 +46,7 @@ + EVT_BUTTON(ID_BTN_RESET, CServerWnd::OnBnClickedResetLog) + EVT_BUTTON(ID_BTN_RESET_SERVER, CServerWnd::OnBnClickedResetServerLog) + EVT_SPLITTER_SASH_POS_CHANGED(ID_SRV_SPLITTER,CServerWnd::OnSashPositionChanged) ++ EVT_BUTTON(ID_BTN_RESET_DLP, CServerWnd::OnBnClickedResetDLPLog) + END_EVENT_TABLE() + + +@@ -152,6 +153,11 @@ + theApp->GetServerLog(true); // Reset it + } + ++void CServerWnd::OnBnClickedResetDLPLog(wxCommandEvent& WXUNUSED(evt)) ++{ ++ wxTextCtrl* cv= CastByID( ID_DLPINFO, this, wxTextCtrl ); ++ cv->Clear(); ++} + + void CServerWnd::UpdateED2KInfo() + { +diff -Naur a/src/ServerWnd.h b/src/ServerWnd.h +--- a/src/ServerWnd.h 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/ServerWnd.h 2016-10-14 12:33:51.668348101 +0800 +@@ -50,6 +50,7 @@ + void OnBnClickedUpdateservermetfromurl(wxCommandEvent& evt); + void OnBnClickedResetLog(wxCommandEvent& evt); + void OnBnClickedResetServerLog(wxCommandEvent& evt); ++ void OnBnClickedResetDLPLog(wxCommandEvent& evt); + + DECLARE_EVENT_TABLE() + }; +diff -Naur a/src/TextClient.cpp b/src/TextClient.cpp +--- a/src/TextClient.cpp 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/TextClient.cpp 2016-10-14 12:33:51.669348124 +0800 +@@ -73,6 +73,7 @@ + CMD_ID_RELOAD_SHARED, + CMD_ID_RELOAD_IPFILTER_LOCAL, + CMD_ID_RELOAD_IPFILTER_NET, ++ CMD_ID_RELOAD_ANTILEECH, /* Only used internally - Dynamic Leech Protect - Bill Lee */ + CMD_ID_SET_IPFILTER_ON, + CMD_ID_SET_IPFILTER_OFF, + CMD_ID_SET_IPFILTER_CLIENTS_ON, +@@ -106,7 +107,6 @@ + CMD_ID_DOWNLOAD, + // IDs for deprecated commands + CMD_ID_SET_IPFILTER +- + }; + + // method to create a SearchFile +@@ -240,6 +240,12 @@ + case CMD_ID_DISCONNECT_KAD: + request_list.push_back(new CECPacket(EC_OP_KAD_STOP)); + break; ++ //Dynamic Leech Protect - Bill Lee ++ #ifdef AMULE_DLP ++ case CMD_ID_RELOAD_ANTILEECH: ++ request_list.push_back(new CECPacket(EC_OP_ANTILEECH_RELOAD)); ++ break; ++ #endif + + case CMD_ID_RELOAD_SHARED: + request_list.push_back(new CECPacket(EC_OP_SHAREDFILES_RELOAD)); +@@ -903,6 +909,9 @@ + tmp2->AddCommand(wxT("Net"), CMD_ID_RELOAD_IPFILTER_NET, wxTRANSLATE("Update IP filtering table from URL."), + wxTRANSLATE("If URL is omitted the URL from the preferences is used."), CMD_PARAM_OPTIONAL); + ++ #ifdef AMULE_DLP ++ tmp->AddCommand(wxT("AntiLeech"), CMD_ID_RELOAD_ANTILEECH, wxTRANSLATE("Reloads antiLeech."), wxEmptyString, CMD_PARAM_NEVER); //Bill Lee ++ #endif + tmp = m_commands.AddCommand(wxT("Connect"), CMD_ID_CONNECT, wxTRANSLATE("Connect to the network."), + wxTRANSLATE("This will connect to all networks that are enabled in Preferences.\nYou may also optionally specify a server address in IP:Port form, to connect to\nthat server only. The IP must be a dotted decimal IPv4 address,\nor a resolvable DNS name."), CMD_PARAM_OPTIONAL); + tmp->AddCommand(wxT("ED2K"), CMD_ID_CONNECT_ED2K, wxTRANSLATE("Connect to eD2k only."), wxEmptyString, CMD_PARAM_NEVER); +diff -Naur a/src/UploadQueue.cpp b/src/UploadQueue.cpp +--- a/src/UploadQueue.cpp 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/UploadQueue.cpp 2016-10-14 12:33:51.669348124 +0800 +@@ -390,6 +390,11 @@ + return; + } + ++ //Dynamic Leecher Protect - Bill Lee ++ #if defined AMULE_DLP && defined __DEBUG__ ++ AddLogLineN(client->GetClientFullInfo()); ++ #endif ++ + client->AddAskedCount(); + client->SetLastUpRequest(); + +diff -Naur a/src/amule-gui.cpp b/src/amule-gui.cpp +--- a/src/amule-gui.cpp 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/amule-gui.cpp 2016-10-14 12:33:51.669348124 +0800 +@@ -333,6 +333,21 @@ + return CamuleApp::GetLog(reset); + } + ++#ifdef AMULE_DLP ++void CamuleGuiApp::AddDLPMessageLine(const wxString &msg) ++{ ++ wxString message; ++ time_t rawtime; ++ struct tm *timeinfo; ++ char tbuf[101]; ++ time(&rawtime); ++ timeinfo = localtime(&rawtime); ++ strftime(tbuf, 100, "%Y-%m-%d %X: ", timeinfo); ++ ++ message = wxString(tbuf, wxConvUTF8) + msg; ++ amuledlg->AddDLPMessageLine(message); ++} ++#endif + + wxString CamuleGuiApp::GetServerLog(bool reset) + { +diff -Naur a/src/amule.cpp b/src/amule.cpp +--- a/src/amule.cpp 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/amule.cpp 2016-10-14 12:33:51.670348146 +0800 +@@ -23,7 +23,6 @@ + // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + // + +- + #include "amule.h" // Interface declarations. + + #include +@@ -90,6 +89,11 @@ + #include // Do_not_auto_remove + #endif + ++//Dynamic Leecher Protection - Bill Lee ++#ifdef AMULE_DLP ++#include "DLP.h" ++#endif ++ + #ifndef AMULE_DAEMON + #ifdef __WXMAC__ + #include // Do_not_auto_remove +@@ -520,6 +524,11 @@ + uploadqueue = new CUploadQueue(); + ipfilter = new CIPFilter(); + ++ //DLP initialization - Bill Lee ++ #ifdef AMULE_DLP ++ theDLP = new DLP(); ++ #endif ++ + // Creates all needed listening sockets + wxString msg; + if (!ReinitializeNetwork(&msg)) { +@@ -2062,3 +2071,8 @@ + DEFINE_LOCAL_EVENT_TYPE(wxEVT_CORE_UDP_DNS_DONE) + DEFINE_LOCAL_EVENT_TYPE(wxEVT_CORE_SERVER_DNS_DONE) + // File_checked_for_headers ++ ++//Dynamic Leech Protect - Bill Lee ++#ifdef AMULE_DLP ++DLP* theDLP; ++#endif +diff -Naur a/src/amule.h b/src/amule.h +--- a/src/amule.h 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/amule.h 2016-10-14 12:42:22.776093625 +0800 +@@ -135,6 +135,8 @@ + bool m_geometryEnabled; + wxString m_geometryString; + wxString m_logFile; ++ //Dynamic Leech Protect - persmule ++ wxString m_dlplogFile; + wxString m_appName; + wxString m_PidFile; + +@@ -410,6 +412,7 @@ + wxString GetLog(bool reset = false); + wxString GetServerLog(bool reset = false); + void AddServerMessageLine(wxString &msg); ++ void AddDLPMessageLine(const wxString &msg); + DECLARE_EVENT_TABLE() + }; + +@@ -573,6 +576,8 @@ + + virtual int ShowAlert(wxString msg, wxString title, int flags); + ++ void AddDLPMessageLine(const wxString &msg); ++ + DECLARE_EVENT_TABLE() + }; + +@@ -583,3 +588,8 @@ + + #endif // AMULE_H + // File_checked_for_headers ++ ++#ifdef AMULE_DLP ++class DLP; //forward declaretion ++extern DLP* theDLP; ++#endif +diff -Naur a/src/amuleAppCommon.cpp b/src/amuleAppCommon.cpp +--- a/src/amuleAppCommon.cpp 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/amuleAppCommon.cpp 2016-10-14 12:44:08.981552362 +0800 +@@ -65,6 +65,9 @@ + m_configFile = wxT("amule.conf"); + m_logFile = wxT("logfile"); + ++ //Dynamic Leech Protect - persmule ++ m_dlplogFile = wxT("antileech.log"); ++ + if (IsDaemon()) { + m_appName = wxT("aMuleD"); + } else { +@@ -443,6 +446,21 @@ + return false; + } + ++ // Open the dlp log file - Dynamic Leech Protect - persmule ++ if (!IsRemoteGui()){ ++ CPath dlplogfileName = CPath(thePrefs::GetConfigDir() + m_dlplogFile); ++ if (dlplogfileName.FileExists()) { ++ CPath::BackupFile(dlplogfileName, wxT(".bak")); ++ } ++ ++ if (!dlpLogger.OpenLogfile(dlplogfileName.GetRaw())) { ++ // use std err as last resolt to indicate problem ++ fputs("ERROR: unable to open dlp log file\n", stderr); ++ // failure to open log is serious problem ++ return false; ++ } ++ } ++ + // Load Preferences + CPreferences::BuildItemList(thePrefs::GetConfigDir()); + CPreferences::LoadAllItems( wxConfigBase::Get() ); +diff -Naur a/src/amuleDlg.cpp b/src/amuleDlg.cpp +--- a/src/amuleDlg.cpp 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/amuleDlg.cpp 2016-10-14 12:44:47.637582726 +0800 +@@ -315,7 +315,7 @@ + wxNotebook* logs_notebook = CastChild( ID_SRVLOG_NOTEBOOK, wxNotebook); + wxNotebook* networks_notebook = CastChild( ID_NETNOTEBOOK, wxNotebook); + +- wxASSERT(logs_notebook->GetPageCount() == 4); ++ wxASSERT(logs_notebook->GetPageCount() == 5); + wxASSERT(networks_notebook->GetPageCount() == 2); + + for (uint32 i = 0; i < logs_notebook->GetPageCount(); ++i) { +@@ -507,7 +507,12 @@ + _("Part of aMule is based on \n") << + _("Kademlia: Peer-to-peer routing based on the XOR metric.\n") << + _(" Copyright (c) 2002-2011 Petar Maymounkov ( petar@post.harvard.edu )\n") << +- _("http://kademlia.scs.cs.nyu.edu\n"); ++ _("http://kademlia.scs.cs.nyu.edu\n") << ++ _("\nDynamic Leech Protection\n") << ++ _(" Homepage: http://amule-dlp.googlecode.com \n") << ++ _(" Copyright (C) 2002-2007 Xtreme-Mod \n") << ++ _(" Copyright (C) 2009 greensea \n") << ++ _(" Copyright (C) 2009-2011 Bill Lee \n"); + + if (m_is_safe_state) { + wxMessageBox(msg, _("Message"), wxOK | wxICON_INFORMATION, this); +@@ -659,8 +664,24 @@ + } + cv->ShowPosition(cv->GetLastPosition()-1); + } ++ //Dynamic Leech Protect - persmule ++ DlpAddLogLine(msg); + } + ++#ifdef AMULE_DLP ++void CamuleDlg::AddDLPMessageLine(const wxString& msg) /* modified by Bill Lee */ ++{ ++ wxTextCtrl* cv = CastByID( ID_DLPINFO, m_serverwnd, wxTextCtrl ); ++ if(cv) { ++ if (msg.Length() > 500) { ++ cv->AppendText(msg.Left(500) + wxT("\n")); ++ } else { ++ cv->AppendText(msg + wxT("\n")); ++ } ++ cv->ShowPosition(cv->GetLastPosition()-1); ++ } ++} ++#endif + + void CamuleDlg::ShowConnectionState(bool skinChanged) + { +@@ -1456,7 +1477,9 @@ + if (thePrefs::GetNetworkKademlia()) { + logs_notebook->AddPage(m_logpages[3].page, m_logpages[3].name); + } +- ++ ++ logs_notebook->AddPage(m_logpages[4].page, m_logpages[4].name); ++ + // Set the main window. + // If we have both networks active, activate a notebook to select between them. + // If only one is active, show the window directly without a surrounding one tab notebook. +diff -Naur a/src/amuleDlg.h b/src/amuleDlg.h +--- a/src/amuleDlg.h 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/amuleDlg.h 2016-10-14 12:33:51.671348169 +0800 +@@ -114,6 +114,9 @@ + + void AddLogLine(const wxString& line); + void AddServerMessageLine(wxString& message); ++ #ifdef AMULE_DLP ++ void AddDLPMessageLine(const wxString& msg); /* Modified by Bill Lee */ ++ #endif + void ResetLog(int id); + + void ShowUserCount(const wxString& info = wxEmptyString); +@@ -231,7 +234,7 @@ + WX_DECLARE_STRING_HASH_MAP(wxZipEntry*, ZipCatalog); + ZipCatalog cat; + +- PageType m_logpages[4]; ++ PageType m_logpages[5]; + PageType m_networkpages[2]; + + bool LoadGUIPrefs(bool override_pos, bool override_size); +diff -Naur a/src/amuled.cpp b/src/amuled.cpp +--- a/src/amuled.cpp 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/amuled.cpp 2016-10-14 12:45:23.506600119 +0800 +@@ -749,4 +749,10 @@ + return 0; // That's neither yes nor no, ok, cancel + } + ++void CamuleDaemonApp::AddDLPMessageLine(const wxString &msg) ++{ ++ //Dynamic Leech Protect - persmule ++ DlpAddLogLine(msg); ++} ++ + // File_checked_for_headers +diff -Naur a/src/antiLeech.h b/src/antiLeech.h +--- a/src/antiLeech.h 1970-01-01 08:00:00.000000000 +0800 ++++ b/src/antiLeech.h 2016-10-14 12:33:51.672348192 +0800 +@@ -0,0 +1,48 @@ ++#ifndef ANTILEECH_H ++#define ANTILEECH_H ++ ++ ++#pragma once ++ ++#include "antiLeech_wx.h" ++#include "CString_wx.h" ++ ++class IantiLeech ++{ ++public: ++ virtual ~IantiLeech(){}; /* Bill Lee: Not be used currently */ ++ //BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD,LPVOID); ++ virtual DWORD GetDLPVersion() = 0; ++ //old versions to keep compatible ++ /* //drop old version support ++ virtual LPCTSTR DLPCheckModstring(LPCTSTR modversion, LPCTSTR clientversion); ++ virtual LPCTSTR DLPCheckUsername(LPCTSTR username); ++ virtual LPCTSTR DLPCheckNameAndHash(CString username, CString& userhash); ++ */ ++ //new versions ++ virtual LPCTSTR DLPCheckModstring_Hard(LPCTSTR modversion, LPCTSTR clientversion) = 0; ++ virtual LPCTSTR DLPCheckModstring_Soft(LPCTSTR modversion, LPCTSTR clientversion) = 0; ++ virtual LPCTSTR DLPCheckUsername_Hard(LPCTSTR username) = 0; ++ virtual LPCTSTR DLPCheckUsername_Soft(LPCTSTR username) = 0; ++ virtual LPCTSTR DLPCheckNameAndHashAndMod(const CString& username, const CString& userhash, const CString& modversion) = 0; ++ virtual LPCTSTR DLPCheckMessageSpam(LPCTSTR messagetext) = 0; ++ ++ ++ virtual LPCTSTR DLPCheckUserhash(const PBYTE userhash) = 0; ++ ++ ++ virtual LPCTSTR DLPCheckHelloTag(UINT tagnumber) = 0; ++ virtual LPCTSTR DLPCheckInfoTag(UINT tagnumber) = 0; ++ ++ //void TestFunc(); ++ ++//Bill Lee: no need in interface abstract class ++//private: ++// static bool IsTypicalHex (const CString& addon); ++}; ++ ++//Bill Lee: never call delete on IantiLeech, use destoryAntiLeechInstat instead. ++extern "C" IantiLeech* createAntiLeechInstant(); ++extern "C" int destoryAntiLeechInstant(IantiLeech*); ++ ++#endif +diff -Naur a/src/antiLeech_wx.h b/src/antiLeech_wx.h +--- a/src/antiLeech_wx.h 1970-01-01 08:00:00.000000000 +0800 ++++ b/src/antiLeech_wx.h 2016-10-14 12:33:51.672348192 +0800 +@@ -0,0 +1,49 @@ ++#ifndef ANTILEECH_WX_H ++#define ANTILEECH_WX_H ++ ++#include ++#include ++ ++#define LPCTSTR const wxChar* ++#define BOOL bool ++//#define _T(var) wxT(var) //defined in wxWidgets ++#define DWORD wxUint32 ++#define UINT wxUint16 ++#define WINAPI ++#define HINSTANCE ++#define LPVOID void* ++#define PBYTE unsigned char* ++#define TCHAR wxChar ++#define _TINT wxInt32 ++ ++#define StrCmpI _tcsicmp ++ ++#define _istdigit(var) iswdigit(var) ++#define _istcntrl(var) iswcntrl(var) ++#define _istpunct(var) iswpunct(var) ++#define _istspace(var) iswspace(var) ++#define _istxdigit(var) iswxdigit(var) ++inline float _tstof(const wchar_t* str){ ++ wchar_t** ptail = NULL; ++ return wcstof(str, ptail); ++} ++//This function is not used. by Orzogc Lee ++//But I think there is no need to removing, linker will remove it. ++/* ++inline void tolowers(wxChar* str){ ++ int i = 0; ++ do{ ++ str[i] = towlower(str[i]); ++ }while(str[++i]); ++} ++*/ ++#define _tcsstr(haystack, needle) wcsstr(haystack, needle) ++#define _tcslen(var) wcslen(var) ++#define StrStr(a, b) wcsstr(a, b) ++ ++LPCTSTR StrStrI(LPCTSTR haystack, LPCTSTR needle); ++//Bill Lee: I think inlining this function make no senses, because it is a very large operation. ++ ++#define _tcsicmp(a, b) wcscasecmp(a, b) ++ ++#endif +diff -Naur a/src/libs/ec/abstracts/ECCodes.abstract b/src/libs/ec/abstracts/ECCodes.abstract +--- a/src/libs/ec/abstracts/ECCodes.abstract 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/libs/ec/abstracts/ECCodes.abstract 2016-10-14 12:33:51.672348192 +0800 +@@ -148,6 +148,8 @@ + + EC_OP_FRIEND 0x57 + ++EC_OP_ANTILEECH_RELOAD 0x80 ++ + [/Section] + + [Section Content] +diff -Naur a/src/libs/ec/cpp/ECCodes.h b/src/libs/ec/cpp/ECCodes.h +--- a/src/libs/ec/cpp/ECCodes.h 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/libs/ec/cpp/ECCodes.h 2016-10-14 12:33:51.673348215 +0800 +@@ -121,7 +121,8 @@ + EC_OP_CLIENT_SWAP_TO_ANOTHER_FILE = 0x54, + EC_OP_SHARED_FILE_SET_COMMENT = 0x55, + EC_OP_SERVER_SET_STATIC_PRIO = 0x56, +- EC_OP_FRIEND = 0x57 ++ EC_OP_FRIEND = 0x57, ++ EC_OP_ANTILEECH_RELOAD = 0x80 + }; + + enum ECTagNames { +@@ -556,6 +557,7 @@ + case 0x55: return wxT("EC_OP_SHARED_FILE_SET_COMMENT"); + case 0x56: return wxT("EC_OP_SERVER_SET_STATIC_PRIO"); + case 0x57: return wxT("EC_OP_FRIEND"); ++ case 0x80 : return wxT("EC_OP_ANTILEECH_RELOAD"); + default: return CFormat(wxT("unknown %d 0x%x")) % arg % arg; + } + } +diff -Naur a/src/libs/ec/java/ECCodes.java b/src/libs/ec/java/ECCodes.java +--- a/src/libs/ec/java/ECCodes.java 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/libs/ec/java/ECCodes.java 2016-10-14 12:33:51.673348215 +0800 +@@ -112,6 +112,7 @@ + public final static byte EC_OP_SHARED_FILE_SET_COMMENT = 0x55; + public final static byte EC_OP_SERVER_SET_STATIC_PRIO = 0x56; + public final static byte EC_OP_FRIEND = 0x57; ++public final static byte EC_OP_ANTILEECH_RELOAD = 0x80 ; + + public final static short EC_TAG_STRING = 0x0000; + public final static short EC_TAG_PASSWD_HASH = 0x0001; +diff -Naur a/src/muuli_wdr.cpp b/src/muuli_wdr.cpp +--- a/src/muuli_wdr.cpp 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/muuli_wdr.cpp 2016-10-14 12:33:51.676348283 +0800 +@@ -1769,6 +1769,51 @@ + return item0; + } + ++#ifdef AMULE_DLP ++wxSizer *PreferencesDLPTab( wxWindow *parent, bool call_fit, bool set_sizer ) ++{ ++ wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); ++ ++ wxButton* btnReload = new wxButton( parent, IDC_RELOADANTILEECH, _("Reload antiLeech"), wxDefaultPosition, wxDefaultSize, 0 ); //Bill Lee ++ ++ wxStaticBox *item2 = new wxStaticBox( parent, -1, _("Dynamic Leecher Protection Options") ); ++ wxStaticBoxSizer *item1 = new wxStaticBoxSizer( item2, wxVERTICAL ); ++ ++ wxCheckBox *item4 = new wxCheckBox( parent, IDC_CHECKMODSTRING, _("Check bad modstring"), wxDefaultPosition, wxDefaultSize, 0 ); ++ item1->Add( item4, 0, wxALIGN_CENTER_VERTICAL, 5 ); ++ ++ wxCheckBox *item5 = new wxCheckBox( parent, IDC_CHECKUSERNAME, _("Check bad username"), wxDefaultPosition, wxDefaultSize, 0 ); ++ item1->Add( item5, 0, wxALIGN_CENTER_VERTICAL, 5 ); ++ ++ wxCheckBox *item6 = new wxCheckBox( parent, IDC_CHECKUSERHASH, _("Check bad userhash"), wxDefaultPosition, wxDefaultSize, 0 ); ++ item1->Add( item6, 0, wxALIGN_CENTER_VERTICAL, 5 ); ++ ++ wxCheckBox *item7 = new wxCheckBox( parent, IDC_CHECKHELLOTAG, _("Check bad hello tag"), wxDefaultPosition, wxDefaultSize, 0 ); ++ item1->Add( item7, 0, wxALIGN_CENTER_VERTICAL, 5 ); ++ ++ wxCheckBox *item8 = new wxCheckBox( parent, IDC_CHECKINFOTAG, _("Check bad info tag"), wxDefaultPosition, wxDefaultSize, 0 ); ++ item1->Add( item8, 0, wxALIGN_CENTER_VERTICAL, 5 ); ++ ++ wxCheckBox *item9 = new wxCheckBox( parent, IDC_CHECKGHOSTMOD, _("Check ghost mod"), wxDefaultPosition, wxDefaultSize, 0); ++ item1->Add( item9, 0, wxALIGN_CENTER_VERTICAL, 5 ); ++ ++ wxCheckBox *item10 = new wxCheckBox( parent, IDC_CHECKVERYCDMOD, _("Ban eMule VeryCD mod(Please consider carefully whether to use)"), wxDefaultPosition, wxDefaultSize, 0 ); //Modified by Bill Lee ++ item1->Add( item10, 0, wxALIGN_CENTER_VERTICAL, 5 ); ++ ++ item0->Add( btnReload, 0, wxGROW|wxALL, 5); //Bill Lee ++ item0->Add( item1, 0, wxGROW|wxALL, 5 ); ++ ++ if (set_sizer) ++ { ++ parent->SetSizer( item0 ); ++ if (call_fit) ++ item0->SetSizeHints( parent ); ++ } ++ ++ return item0; ++} ++#endif ++ + wxSizer *PreferencesFilesTab( wxWindow *parent, bool call_fit, bool set_sizer ) + { + wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); +@@ -2587,6 +2632,42 @@ + return item0; + } + ++wxSizer *DLPInfoLog( wxWindow *parent, bool call_fit, bool set_sizer ) ++{ ++ wxBoxSizer *item0 = new wxBoxSizer( wxVERTICAL ); ++ ++ wxBoxSizer *item1 = new wxBoxSizer( wxHORIZONTAL ); ++ ++ wxStaticBitmap *item2 = new wxStaticBitmap( parent, -1, amuleDlgImages( 3 ), wxDefaultPosition, wxDefaultSize ); ++ item2->SetToolTip( _("Display DLP log") ); ++ item1->Add( item2, 0, wxALIGN_CENTER|wxALL, 5 ); ++ ++ wxStaticText *item3 = new wxStaticText( parent, -1, _("DLP Info"), wxDefaultPosition, wxDefaultSize, 0 ); ++ item1->Add( item3, 0, wxALIGN_CENTER|wxALL, 5 ); ++ ++ item0->Add( item1, 0, wxALIGN_CENTER_VERTICAL, 5 ); ++ ++ wxBoxSizer *item4 = new wxBoxSizer( wxHORIZONTAL ); ++ ++ CMuleTextCtrl *item5 = new CMuleTextCtrl( parent, ID_DLPINFO, wxT(""), wxDefaultPosition, wxDefaultSize, wxTE_MULTILINE|wxTE_READONLY|wxVSCROLL ); ++ item4->Add( item5, 1, wxGROW|wxALIGN_CENTER_HORIZONTAL, 5 ); ++ ++ wxButton *item6 = new wxButton( parent, ID_BTN_RESET_DLP, _("Reset"), wxDefaultPosition, wxDefaultSize, 0 ); ++ item6->SetToolTip( _("Click this button to reset the log.") ); ++ item4->Add( item6, 0, wxGROW|wxALIGN_CENTER_HORIZONTAL|wxALL, 5 ); ++ ++ item0->Add( item4, 1, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); ++ ++ if (set_sizer) ++ { ++ parent->SetSizer( item0 ); ++ if (call_fit) ++ item0->SetSizeHints( parent ); ++ } ++ ++ return item0; ++} ++ + wxSizer *serverListDlgDown( wxWindow *parent, bool call_fit, bool set_sizer ) + { + wxStaticBox *item1 = new wxStaticBox( parent, -1, wxT("") ); +@@ -2602,7 +2683,7 @@ + wxPanel *item4 = new wxPanel( item3, -1 ); + aMuleLog( item4, FALSE ); + item3->AddPage( item4, _("aMule Log") ); +- ++ + wxPanel *item5 = new wxPanel( item3, -1 ); + ServerInfoLog( item5, FALSE ); + item3->AddPage( item5, _("Server Info") ); +@@ -2614,6 +2695,10 @@ + wxPanel *item7 = new wxPanel( item3, -1 ); + Kad_Info( item7, FALSE ); + item3->AddPage( item7, _("Kad Info") ); ++ ++ wxPanel *item8 = new wxPanel( item3, -1); ++ DLPInfoLog( item8, FALSE); ++ item3->AddPage(item8, _("DLP Info")); + + item0->Add( item2, 1, wxGROW|wxALIGN_CENTER_VERTICAL, 5 ); + +diff -Naur a/src/muuli_wdr.h b/src/muuli_wdr.h +--- a/src/muuli_wdr.h 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/muuli_wdr.h 2016-10-14 12:33:51.676348283 +0800 +@@ -335,6 +335,10 @@ + #define ID_BTN_RESET_SERVER 10240 + wxSizer *ServerInfoLog( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); + ++#define ID_DLPINFO 22001 ++#define ID_BTN_RESET_DLP 22002 ++wxSizer *DLPInfoLog( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); ++ + #define ID_LOGVIEW 10241 + #define ID_BTN_RESET 10242 + wxSizer *aMuleLog( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); +@@ -424,6 +428,21 @@ + #define ID_DEBUGCATS 10307 + wxSizer *PreferencesDebug( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); + ++/* Dynamic Leecher Protection */ ++#define IDC_CHECKMODSTRING 11001 ++#define IDC_CHECKUSERNAME 11002 ++#define IDC_CHECKUSERHASH 11003 ++#define IDC_CHECKHELLOTAG 11004 ++#define IDC_CHECKINFOTAG 11005 ++#define IDC_CHECKEASYMULE 11006 ++#define IDC_CHECKVERYCDMOD 11007 ++#define IDC_CHECKMINIMULE 11008 ++#define IDC_CHECKGHOSTMOD 11009 ++#ifdef AMULE_DLP ++#define IDC_RELOADANTILEECH 11010 //Bill Lee ++wxSizer *PreferencesDLPTab( wxWindow *parent, bool call_fit = TRUE, bool set_sizer = TRUE ); ++#endif ++ + extern wxSizer *IDC_CURJOB; + #define IDC_CONV_PB_LABEL 10308 + #define IDC_CONV_PROZENT 10309 +diff -Naur a/src/updownclient.h b/src/updownclient.h +--- a/src/updownclient.h 2016-10-06 19:01:54.000000000 +0800 ++++ b/src/updownclient.h 2016-10-14 12:37:03.224728226 +0800 +@@ -408,7 +408,13 @@ + bool GetSentCancelTransfer() const { return m_fSentCancelTransfer; } + void SetSentCancelTransfer(bool bVal) { m_fSentCancelTransfer = bVal; } + +- DEBUG_ONLY( wxString GetClientFullInfo(); ) ++#if defined (__DEBUG__) || defined (AMULE_DLP) ++ /* ++ * This function is essential for dlp to produce ban log. ++ * So I decide to retain it when dlp is enabled. ++ */ ++ wxString GetClientFullInfo(); ++#endif + wxString GetClientShortInfo(); + + const wxString& GetClientOSInfo() const { return m_sClientOSInfo; } +@@ -581,7 +587,10 @@ + bool ShouldReceiveCryptUDPPackets() const; + + bool HasDisabledSharedFiles() const { return m_fNoViewSharedFiles; } +- ++ #ifdef AMULE_DLP ++ bool HasNonOfficialOpCodes() const { return dlp_nonofficialopcodes; } //Dynamic Leecher Protection - Bill Lee ++ #endif ++ + private: + + CClientCredits *credits; +@@ -842,6 +851,10 @@ + #ifdef __DEBUG__ + wxString connection_reason; + #endif ++ ++ #ifdef AMULE_DLP ++ bool dlp_nonofficialopcodes; //Dynamic Leecher Protect - Bill Lee ++ #endif + }; + + diff --git a/package/lean/amule/patches/003_enable_upnp_cross_compile.patch b/package/lean/amule/patches/003_enable_upnp_cross_compile.patch new file mode 100644 index 000000000..462e490c0 --- /dev/null +++ b/package/lean/amule/patches/003_enable_upnp_cross_compile.patch @@ -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]) diff --git a/package/lean/amule/patches/004_file_name_conversion.patch b/package/lean/amule/patches/004_file_name_conversion.patch new file mode 100644 index 000000000..2c511d0ce --- /dev/null +++ b/package/lean/amule/patches/004_file_name_conversion.patch @@ -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. diff --git a/package/lean/amule/patches/005_best_keyword_kad_search.diff b/package/lean/amule/patches/005_best_keyword_kad_search.diff new file mode 100644 index 000000000..c450a9f8e --- /dev/null +++ b/package/lean/amule/patches/005_best_keyword_kad_search.diff @@ -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 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 diff --git a/package/lean/libcryptopp/Makefile b/package/lean/libcryptopp/Makefile new file mode 100644 index 000000000..f37b6088b --- /dev/null +++ b/package/lean/libcryptopp/Makefile @@ -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)) diff --git a/package/lean/luci-app-amule/Makefile b/package/lean/luci-app-amule/Makefile new file mode 100644 index 000000000..bd1e1e63c --- /dev/null +++ b/package/lean/luci-app-amule/Makefile @@ -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 + diff --git a/package/lean/luci-app-amule/luasrc/controller/amule.lua b/package/lean/luci-app-amule/luasrc/controller/amule.lua new file mode 100644 index 000000000..1728c4eaa --- /dev/null +++ b/package/lean/luci-app-amule/luasrc/controller/amule.lua @@ -0,0 +1,160 @@ +--[[ +LuCI - Lua Configuration Interface - amule support + +Copyright 2016 maz-1 + +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 diff --git a/package/lean/luci-app-amule/luasrc/model/cbi/amule.lua b/package/lean/luci-app-amule/luasrc/model/cbi/amule.lua new file mode 100644 index 000000000..b18138f85 --- /dev/null +++ b/package/lean/luci-app-amule/luasrc/model/cbi/amule.lua @@ -0,0 +1,456 @@ +--[[ +LuCI - Lua Configuration Interface - Aria2 support + +Copyright 2016 maz-1 +]]-- + +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 "

" .. translate(Value) .. "

" +end + +m = Map("amule", translate("aMule"), translate("aMule is a ED2K/KAD client for all platforms.") .. "
luci interface by maz-1") + +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"), "") +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"), "") +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 diff --git a/package/lean/luci-app-amule/luasrc/view/amule/detail_logview.htm b/package/lean/luci-app-amule/luasrc/view/amule/detail_logview.htm new file mode 100644 index 000000000..8effbacfd --- /dev/null +++ b/package/lean/luci-app-amule/luasrc/view/amule/detail_logview.htm @@ -0,0 +1,56 @@ + + + + +<%+cbi/valueheader%> + +
+ +<% +-- one button on top, one at the buttom +%> + /> + +

+ +<% +-- 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 +%> + +

+ +<% +-- one button on top, one at the buttom +%> + /> + +<%+cbi/valuefooter%> + diff --git a/package/lean/luci-app-amule/luasrc/view/amule/overview_status.htm b/package/lean/luci-app-amule/luasrc/view/amule/overview_status.htm new file mode 100644 index 000000000..8fd752186 --- /dev/null +++ b/package/lean/luci-app-amule/luasrc/view/amule/overview_status.htm @@ -0,0 +1,94 @@ + + +
+ <%:aMule Status%> +

+ <%:Collecting data...%> +

+

+ <%:Collecting data...%> +

+
diff --git a/package/lean/luci-app-amule/luasrc/view/amule/webshell.htm b/package/lean/luci-app-amule/luasrc/view/amule/webshell.htm new file mode 100644 index 000000000..998fa170a --- /dev/null +++ b/package/lean/luci-app-amule/luasrc/view/amule/webshell.htm @@ -0,0 +1,90 @@ + + + + diff --git a/package/lean/luci-app-amule/po/zh-cn/amule.po b/package/lean/luci-app-amule/po/zh-cn/amule.po new file mode 100644 index 000000000..18f7184d5 --- /dev/null +++ b/package/lean/luci-app-amule/po/zh-cn/amule.po @@ -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 "百分比" + diff --git a/package/lean/luci-app-amule/root/etc/amule/amule.conf.template b/package/lean/luci-app-amule/root/etc/amule/amule.conf.template new file mode 100644 index 000000000..3ab24a0b0 --- /dev/null +++ b/package/lean/luci-app-amule/root/etc/amule/amule.conf.template @@ -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= diff --git a/package/lean/luci-app-amule/root/etc/config/amule b/package/lean/luci-app-amule/root/etc/config/amule new file mode 100644 index 000000000..4e6a110d8 --- /dev/null +++ b/package/lean/luci-app-amule/root/etc/config/amule @@ -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' diff --git a/package/lean/luci-app-amule/root/etc/hotplug.d/iface/20-amule b/package/lean/luci-app-amule/root/etc/hotplug.d/iface/20-amule new file mode 100644 index 000000000..a42adfb0f --- /dev/null +++ b/package/lean/luci-app-amule/root/etc/hotplug.d/iface/20-amule @@ -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 + } + +} diff --git a/package/lean/luci-app-amule/root/etc/init.d/amule b/package/lean/luci-app-amule/root/etc/init.d/amule new file mode 100755 index 000000000..f64202a21 --- /dev/null +++ b/package/lean/luci-app-amule/root/etc/init.d/amule @@ -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 +} + diff --git a/package/lean/luci-app-amule/root/etc/uci-defaults/luci-amule b/package/lean/luci-app-amule/root/etc/uci-defaults/luci-amule new file mode 100755 index 000000000..e1c0c0842 --- /dev/null +++ b/package/lean/luci-app-amule/root/etc/uci-defaults/luci-amule @@ -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 diff --git a/package/lean/wsdd2/Makefile b/package/lean/wsdd2/Makefile new file mode 100644 index 000000000..7bda797c9 --- /dev/null +++ b/package/lean/wsdd2/Makefile @@ -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 +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)) diff --git a/package/lean/wsdd2/files/wsdd2.init b/package/lean/wsdd2/files/wsdd2.init new file mode 100644 index 000000000..b795d8e8b --- /dev/null +++ b/package/lean/wsdd2/files/wsdd2.init @@ -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 +} diff --git a/package/lean/wsdd2/patches/001-add_uuid_boot_id.patch b/package/lean/wsdd2/patches/001-add_uuid_boot_id.patch new file mode 100644 index 000000000..0c59365a1 --- /dev/null +++ b/package/lean/wsdd2/patches/001-add_uuid_boot_id.patch @@ -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; + } diff --git a/package/lean/wxbase/Makefile b/package/lean/wxbase/Makefile new file mode 100644 index 000000000..97f6e7015 --- /dev/null +++ b/package/lean/wxbase/Makefile @@ -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)) diff --git a/package/lean/wxbase/patches/wxGTK-2.8.12-abicheck.patch b/package/lean/wxbase/patches/wxGTK-2.8.12-abicheck.patch new file mode 100644 index 000000000..97055ba46 --- /dev/null +++ b/package/lean/wxbase/patches/wxGTK-2.8.12-abicheck.patch @@ -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 +