├── VERSION ├── jnode-core ├── .gitignore ├── src │ └── jnode │ │ ├── dto │ │ ├── Entity.java │ │ ├── Mail.java │ │ ├── ScriptHelper.java │ │ ├── Robot.java │ │ ├── FilemailAwaiting.java │ │ ├── FileSubscription.java │ │ ├── Subscription.java │ │ ├── FileForLink.java │ │ ├── Jscript.java │ │ └── EchomailAwaiting.java │ │ ├── jscript │ │ ├── JScriptConsole.java │ │ ├── CoreHelper.java │ │ ├── IJscriptHelper.java │ │ ├── WriteStatToEchoareaHelper.java │ │ └── WriteFileToEchoareaHelper.java │ │ ├── event │ │ ├── IEvent.java │ │ ├── IEventHandler.java │ │ ├── NewNetmailEvent.java │ │ ├── NewEchomailEvent.java │ │ ├── NewFilemailEvent.java │ │ ├── NewEchoareaEvent.java │ │ ├── NewFileareaEvent.java │ │ ├── SharedModuleEvent.java │ │ ├── Notifier.java │ │ └── ConnectionEndEvent.java │ │ ├── robot │ │ └── IRobot.java │ │ ├── stat │ │ ├── IStatPoster.java │ │ └── FileareaStat.java │ │ ├── main │ │ └── threads │ │ │ ├── TimerPoll.java │ │ │ ├── TosserQueue.java │ │ │ ├── ThreadPool.java │ │ │ ├── NetmailFallback.java │ │ │ └── HealthReporter.java │ │ ├── protocol │ │ └── binkp │ │ │ ├── types │ │ │ └── BinkpCommand.java │ │ │ ├── exceprion │ │ │ └── ConnectionEndException.java │ │ │ └── BinkpConnectorRegistry.java │ │ ├── install │ │ ├── DefaultVersion.java │ │ └── support │ │ │ ├── LinkOption_1_1.java │ │ │ └── Dupe_1_4.java │ │ ├── ftn │ │ └── exception │ │ │ └── LastMessageException.java │ │ ├── ndl │ │ └── NodelistIndex.java │ │ ├── module │ │ ├── JnodeModule.java │ │ └── JnodeModuleException.java │ │ └── store │ │ └── XMLSerializer.java └── test │ └── java │ └── jnode │ ├── jscript │ └── JscriptExecutorTest.java │ ├── ftn │ └── types │ │ ├── Ftn2DTest.java │ │ └── FtnAddressTest.java │ ├── ndl │ └── NodelistIndexTest.java │ └── robot │ └── ScriptFixTest.java ├── jnode-nntp ├── .gitignore ├── src │ ├── main │ │ ├── resources │ │ │ └── nntp_module.conf │ │ └── java │ │ │ └── org │ │ │ └── jnode │ │ │ └── nntp │ │ │ ├── processor │ │ │ ├── BaseProcessor.java │ │ │ ├── QuitProcessor.java │ │ │ ├── ModeReaderProcessor.java │ │ │ ├── AuthInfoUserProcessor.java │ │ │ ├── AuthInfoPassProcessor.java │ │ │ ├── ListProcessor.java │ │ │ └── GroupProcessor.java │ │ │ ├── Processor.java │ │ │ ├── event │ │ │ ├── AuthPassEvent.java │ │ │ ├── PostEndEvent.java │ │ │ ├── PostStartEvent.java │ │ │ ├── AuthUserEvent.java │ │ │ ├── ArticleSelectedEvent.java │ │ │ └── GroupSelectedEvent.java │ │ │ ├── Constants.java │ │ │ ├── model │ │ │ ├── NntpEntity.java │ │ │ ├── Auth.java │ │ │ ├── NewsGroup.java │ │ │ ├── NewsMessage.java │ │ │ └── NntpCommand.java │ │ │ ├── exception │ │ │ ├── EndOfSessionException.java │ │ │ ├── NntpException.java │ │ │ ├── UnknownCommandException.java │ │ │ └── ProcessorNotFoundException.java │ │ │ ├── DataProvider.java │ │ │ ├── ProcessorResolver.java │ │ │ ├── util │ │ │ └── Converter.java │ │ │ └── NntpModule.java │ └── test │ │ └── java │ │ └── org │ │ └── jnode │ │ └── nntp │ │ ├── NntpCheck.java │ │ └── processor │ │ └── PostProcessorTest.java └── pom.xml ├── jnode-dumb-module ├── .gitignore ├── resources │ └── dumb.cfg ├── pom.xml └── src │ └── org │ └── jnode │ └── dumb │ └── DumbModule.java ├── jnode-rss-module └── .gitignore ├── jnode-xmpp-module ├── .gitignore ├── resources │ └── xmpp.cfg ├── pom.xml └── src │ └── org │ └── jnode │ └── xmpp │ ├── commands │ ├── CommandProcessor.java │ ├── DummyCommandProcessor.java │ ├── HelpCommandProcessor.java │ └── QuitCommandProcessor.java │ ├── XMPPModule.java │ └── ControlTools.java ├── centos ├── policy_module │ ├── jnode.if │ ├── jnode.fc │ └── jnode.te ├── jnode.service └── jnode.run ├── .travis.yml ├── docs ├── FAQ.ru.win.txt ├── FAQ.ru.koi8.txt ├── INSTALL.ru.koi8.txt ├── INSTALL.ru.win.txt ├── configs │ ├── nntp_module.conf │ ├── xmpp.conf │ ├── mail_module.conf │ ├── httpd_module.conf │ ├── pointchecker.conf │ ├── jnode.nix.conf │ └── jnode.win.conf ├── bin │ ├── run.bat │ └── run.sh ├── CONTACTS.txt ├── INSTALL.ru.txt └── INSTALL.en.txt ├── jdbc-drivers ├── h2-1.3.174.jar ├── postgresql-9.2-1003-jdbc4.jar └── mysql-connector-java-5.1.28-bin.jar ├── jnode-httpd-module ├── resources │ ├── www │ │ ├── parts │ │ │ ├── footer.html │ │ │ ├── header.html │ │ │ ├── menu.html │ │ │ ├── requestlink.html │ │ │ ├── secure_menu.html │ │ │ ├── requestpoint.html │ │ │ ├── users.html │ │ │ ├── route.html │ │ │ ├── echoes.html │ │ │ └── fechoes.html │ │ ├── confirmlink.html │ │ ├── requestpointresult.html │ │ ├── requestlinkresult.html │ │ ├── js │ │ │ └── jnode.js │ │ └── css │ │ │ └── jnode.css │ └── httpd_module.cfg └── src │ └── org │ └── jnode │ └── httpd │ ├── util │ └── JSONConverter.java │ ├── dto │ ├── EchoareaCSV.java │ ├── WebAdmin.java │ ├── PointRequest.java │ └── LinkRequest.java │ ├── filters │ ├── CharsetFilter.java │ └── SecureFilter.java │ └── routes │ ├── JsRoute.java │ ├── get │ ├── BecomeLinkRoute.java │ ├── LinkoptionsRoute.java │ ├── UsersRoute.java │ ├── HealthRoute.java │ ├── BecomePointRoute.java │ ├── EchoareaCSVRoute.java │ ├── RewritesRoute.java │ └── RoutingsRoute.java │ └── post │ └── LinkoptionRoute.java ├── jnode-mail-module ├── resources │ └── mail_module.cfg └── pom.xml ├── .gitignore ├── jnode-pointchecker-module ├── resources │ └── pointchecker.cfg └── pom.xml ├── README.md ├── README.ru.md ├── NOTICE └── jnode-assembly └── pom.xml /VERSION: -------------------------------------------------------------------------------- 1 | 0.5.3c 2 | -------------------------------------------------------------------------------- /jnode-core/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /jnode-nntp/.gitignore: -------------------------------------------------------------------------------- 1 | /target/ 2 | -------------------------------------------------------------------------------- /jnode-dumb-module/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /jnode-rss-module/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /jnode-xmpp-module/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /jnode-dumb-module/resources/dumb.cfg: -------------------------------------------------------------------------------- 1 | delay = 60000 -------------------------------------------------------------------------------- /centos/policy_module/jnode.if: -------------------------------------------------------------------------------- 1 | ## 2 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/resources/nntp_module.conf: -------------------------------------------------------------------------------- 1 | nntp.port=1119 -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: java 2 | script: mvn clean package 3 | jdk: 4 | - oraclejdk8 -------------------------------------------------------------------------------- /docs/FAQ.ru.win.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annmuor/jnode/HEAD/docs/FAQ.ru.win.txt -------------------------------------------------------------------------------- /docs/FAQ.ru.koi8.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annmuor/jnode/HEAD/docs/FAQ.ru.koi8.txt -------------------------------------------------------------------------------- /docs/INSTALL.ru.koi8.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annmuor/jnode/HEAD/docs/INSTALL.ru.koi8.txt -------------------------------------------------------------------------------- /docs/INSTALL.ru.win.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annmuor/jnode/HEAD/docs/INSTALL.ru.win.txt -------------------------------------------------------------------------------- /docs/configs/nntp_module.conf: -------------------------------------------------------------------------------- 1 | jdbc.url=builder/etc/jnode 2 | jdbc.user=jnode 3 | jdbc.pass=jnode -------------------------------------------------------------------------------- /jdbc-drivers/h2-1.3.174.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annmuor/jnode/HEAD/jdbc-drivers/h2-1.3.174.jar -------------------------------------------------------------------------------- /jnode-core/src/jnode/dto/Entity.java: -------------------------------------------------------------------------------- 1 | package jnode.dto; 2 | 3 | public interface Entity { 4 | Long getId(); 5 | } 6 | -------------------------------------------------------------------------------- /jdbc-drivers/postgresql-9.2-1003-jdbc4.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annmuor/jnode/HEAD/jdbc-drivers/postgresql-9.2-1003-jdbc4.jar -------------------------------------------------------------------------------- /jdbc-drivers/mysql-connector-java-5.1.28-bin.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/annmuor/jnode/HEAD/jdbc-drivers/mysql-connector-java-5.1.28-bin.jar -------------------------------------------------------------------------------- /docs/configs/xmpp.conf: -------------------------------------------------------------------------------- 1 | xmpp.server = 127.0.0.1 2 | xmpp.uid = jnode@fidonode.in 3 | xmpp.pwd = password 4 | masters = kreon@xmpp.ru 5 | master.password = masterpassword 6 | -------------------------------------------------------------------------------- /jnode-httpd-module/resources/www/parts/footer.html: -------------------------------------------------------------------------------- 1 |
2 | Powered by jNode 3 | 4 | -------------------------------------------------------------------------------- /jnode-xmpp-module/resources/xmpp.cfg: -------------------------------------------------------------------------------- 1 | xmpp.server = 127.0.0.1 2 | xmpp.uid = jnode@fidonode.in 3 | xmpp.pwd = password 4 | masters = kreon@xmpp.ru 5 | master.password = masterpassword 6 | -------------------------------------------------------------------------------- /docs/configs/mail_module.conf: -------------------------------------------------------------------------------- 1 | smtp.from=Super Node 2 | smtp.host=smtp.googlemail.com 3 | smtp.port=25 4 | smtp.password=******** 5 | smtp.user=user.gmail 6 | robot=mailsender 7 | -------------------------------------------------------------------------------- /jnode-mail-module/resources/mail_module.cfg: -------------------------------------------------------------------------------- 1 | smtp.from=Super Node 2 | smtp.host=smtp.googlemail.com 3 | smtp.port=25 4 | smtp.password=******** 5 | smtp.user=user.gmail 6 | robot=mailsender 7 | -------------------------------------------------------------------------------- /centos/jnode.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=JNode Fidonet Server 3 | After=network.target 4 | 5 | [Install] 6 | WantedBy=multi-user.target 7 | 8 | [Service] 9 | User=jnode 10 | Group=jnode 11 | ExecStart=/opt/jnode/jnode.run 12 | 13 | -------------------------------------------------------------------------------- /jnode-httpd-module/resources/www/parts/header.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | %s@fidonet :: WEB Admin tools 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /docs/configs/httpd_module.conf: -------------------------------------------------------------------------------- 1 | # Port to listen on 2 | port = 8080 3 | # Enable auto point register; default false 4 | #pointreg = true 5 | # Enable auto link register; default false; 6 | #linkreg = true 7 | # External html files; default is off 8 | #external = /var/www 9 | -------------------------------------------------------------------------------- /docs/configs/pointchecker.conf: -------------------------------------------------------------------------------- 1 | # config for pointchecker 2 | multi = false 3 | correct = /home/jnode/point/good 4 | incorrect = /home/jnode/point/bad 5 | name = N5020PK 6 | zip = zip\d{5}.pnt 7 | seg = seg\d{5}.pnt 8 | boss = 2:5020\/\d{1,5}\.?0? 9 | scandelay = 60 10 | -------------------------------------------------------------------------------- /jnode-httpd-module/resources/httpd_module.cfg: -------------------------------------------------------------------------------- 1 | # Port to listen on 2 | port = 8080 3 | # Enable auto point register; default false 4 | #pointreg = true 5 | # Enable auto link register; default false; 6 | #linkreg = true 7 | # External html files; default is off 8 | #external = /var/www -------------------------------------------------------------------------------- /docs/bin/run.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | setLocal EnableDelayedExpansion 3 | set CLASSPATH=. 4 | for /R ../lib %%a in (*.jar) do ( 5 | set CLASSPATH=!CLASSPATH!;"%%a" 6 | ) 7 | set CLASSPATH=!CLASSPATH! 8 | echo !CLASSPATH! 9 | java -Xmx300m -server -cp !CLASSPATH! jnode.main.Main ..\\etc\\jnode.win.conf -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | jnode-core/target 2 | jnode-rss/target 3 | jnode-xmpp/target 4 | jnode-dumb-module/target 5 | jnode-pointchecker-module/target 6 | jnode-httpd-module/target 7 | jnode-mail-module/target 8 | jnode-assembly/target 9 | .project 10 | .settings 11 | .idea 12 | .classpath 13 | *.iml 14 | -------------------------------------------------------------------------------- /jnode-pointchecker-module/resources/pointchecker.cfg: -------------------------------------------------------------------------------- 1 | # config for pointchecker 2 | multi = false 3 | correct = /home/jnode/point/good 4 | incorrect = /home/jnode/point/bad 5 | name = N5020PK 6 | zip = zip\d{5}.pnt 7 | seg = seg\d{5}.pnt 8 | boss = 2:5020\/\d{1,5}\.?0? 9 | scandelay = 60 10 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/processor/BaseProcessor.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.processor; 2 | 3 | import org.jnode.nntp.model.Auth; 4 | 5 | public class BaseProcessor { 6 | 7 | public boolean isAuthorized(Auth auth) { 8 | return auth.getFtnAddress() != null; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /jnode-httpd-module/resources/www/parts/menu.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/Processor.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp; 2 | 3 | import org.jnode.nntp.model.Auth; 4 | 5 | import java.util.Collection; 6 | 7 | public interface Processor { 8 | 9 | Collection process(Collection params, Long selectedGroupId, Long selectedArticleId, Auth auth); 10 | } 11 | -------------------------------------------------------------------------------- /docs/CONTACTS.txt: -------------------------------------------------------------------------------- 1 | Lead developer/Project manager: 2 | Ivan 'kreon' Agarkov; Moscow, Russia 3 | Netmail: 2:5020/848, 2:5020/849 4 | Email: ivan.agarkov@gmail.com 5 | ICQ: 2515521 6 | Jabber: kreon@xmpp.ru 7 | 8 | Developer: 9 | Kirill Temnenkov; Moscow, Russia 10 | Netmail: 2:5020/828 11 | Email: kirill@temnenkov.com -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/event/AuthPassEvent.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.event; 2 | 3 | import jnode.event.IEvent; 4 | import org.apache.commons.lang.StringUtils; 5 | 6 | public class AuthPassEvent implements IEvent { 7 | 8 | @Override 9 | public String getEvent() { 10 | return StringUtils.EMPTY; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/event/PostEndEvent.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.event; 2 | 3 | import jnode.event.IEvent; 4 | import org.apache.commons.lang.StringUtils; 5 | 6 | public class PostEndEvent implements IEvent { 7 | 8 | @Override 9 | public String getEvent() { 10 | return StringUtils.EMPTY; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/event/PostStartEvent.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.event; 2 | 3 | import jnode.event.IEvent; 4 | import org.apache.commons.lang.StringUtils; 5 | 6 | public class PostStartEvent implements IEvent { 7 | 8 | @Override 9 | public String getEvent() { 10 | return StringUtils.EMPTY; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/jscript/JScriptConsole.java: -------------------------------------------------------------------------------- 1 | package jnode.jscript; 2 | 3 | public class JScriptConsole { 4 | 5 | private final StringBuilder sb = new StringBuilder(); 6 | 7 | public void log(Object a){ 8 | sb.append(String.valueOf(a)); 9 | } 10 | 11 | public String out(){ 12 | return sb.toString(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/dto/Mail.java: -------------------------------------------------------------------------------- 1 | package jnode.dto; 2 | 3 | import java.util.Date; 4 | 5 | public interface Mail { 6 | void setFromName(String fromName); 7 | 8 | void setToName(String toName); 9 | 10 | void setFromFTN(String fromFTN); 11 | 12 | void setSubject(String subject); 13 | 14 | void setText(String text); 15 | 16 | void setDate(Date date); 17 | } 18 | -------------------------------------------------------------------------------- /jnode-nntp/src/test/java/org/jnode/nntp/NntpCheck.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp; 2 | 3 | import jnode.module.JnodeModuleException; 4 | 5 | public class NntpCheck { 6 | 7 | public static void main(String[] args) { 8 | try { 9 | NntpModule module = new NntpModule("nntp_module.conf"); 10 | module.start(); 11 | } catch (JnodeModuleException e) { 12 | e.printStackTrace(); 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /jnode-httpd-module/resources/www/parts/requestlink.html: -------------------------------------------------------------------------------- 1 |
2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 11 | 12 |
FTN-адрес
Хост:Порт:
13 | 14 |
-------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/processor/QuitProcessor.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.processor; 2 | 3 | 4 | import org.jnode.nntp.Processor; 5 | import org.jnode.nntp.exception.EndOfSessionException; 6 | import org.jnode.nntp.model.Auth; 7 | 8 | import java.util.Collection; 9 | 10 | public class QuitProcessor implements Processor { 11 | 12 | @Override 13 | public Collection process(Collection params, Long id, Long selectedArticleId, Auth auth) { 14 | throw new EndOfSessionException(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /jnode-httpd-module/resources/www/parts/secure_menu.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
    15 | 16 |
-------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/Constants.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp; 2 | 3 | public class Constants { 4 | public static final Long NETMAIL_NEWSGROUP_ID = -1l; 5 | public static final String NETMAIL_NEWSGROUP_NAME = "NETMAIL"; 6 | 7 | public static final String FROM = "from"; 8 | public static final String NEWSGROUPS = "newsgroups"; 9 | public static final String SUBJECT = "subject"; 10 | public static final String ORGANIZATION = "organization"; 11 | public static final String TO = "to"; 12 | public static final String DATE = "date"; 13 | } 14 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/event/AuthUserEvent.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.event; 2 | 3 | import jnode.event.IEvent; 4 | import org.apache.commons.lang.StringUtils; 5 | import org.jnode.nntp.model.Auth; 6 | 7 | public class AuthUserEvent implements IEvent { 8 | 9 | private Auth auth; 10 | 11 | public AuthUserEvent(Auth auth) { 12 | this.auth = auth; 13 | } 14 | 15 | public Auth getAuth() { 16 | return auth; 17 | } 18 | 19 | @Override 20 | public String getEvent() { 21 | return StringUtils.EMPTY; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/processor/ModeReaderProcessor.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.processor; 2 | 3 | import org.jnode.nntp.Processor; 4 | import org.jnode.nntp.model.Auth; 5 | import org.jnode.nntp.model.NntpResponse; 6 | 7 | import java.util.Arrays; 8 | import java.util.Collection; 9 | 10 | public class ModeReaderProcessor implements Processor { 11 | 12 | @Override 13 | public Collection process(Collection params, Long id, Long selectedArticleId, Auth auth) { 14 | return Arrays.asList(NntpResponse.ModeReader.POSTING_ALLOWED); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/model/NntpEntity.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.model; 2 | 3 | import java.util.Date; 4 | 5 | public abstract class NntpEntity { 6 | 7 | private Long id; 8 | private Date createdDate; 9 | 10 | public Long getId() { 11 | return id; 12 | } 13 | 14 | public void setId(Long id) { 15 | this.id = id; 16 | } 17 | 18 | public Date getCreatedDate() { 19 | return createdDate; 20 | } 21 | 22 | public void setCreatedDate(Date createdDate) { 23 | this.createdDate = createdDate; 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /centos/policy_module/jnode.fc: -------------------------------------------------------------------------------- 1 | /opt/jnode(/.*)? gen_context(system_u:object_r:jnode_conf_t) 2 | /opt/jnode/jar(/.*) gen_context(system_u:object_r:jnode_conf_t) 3 | /opt/jnode/fileechoes(/.*)? gen_context(system_u:object_r:jnode_cache_t) 4 | /opt/jnode/point(/.*)? gen_context(system_u:object_r:jnode_cache_t) 5 | /opt/jnode/point/.*\.cfg gen_context(system_u:object_r:jnode_conf_t) 6 | /opt/jnode/(inbound|temp)(/.*)? gen_context(system_u:object_r:jnode_tmp_t) 7 | /opt/jnode/jnode.run -- gen_context(system_u:object_r:jnode_exec_t) 8 | /var/log/jnode(/.*)? gen_context(system_u:object_r:jnode_log_t) 9 | 10 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/event/ArticleSelectedEvent.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.event; 2 | 3 | import jnode.event.IEvent; 4 | import org.apache.commons.lang.StringUtils; 5 | 6 | public class ArticleSelectedEvent implements IEvent { 7 | 8 | private Long selectedArticleId; 9 | 10 | public ArticleSelectedEvent(Long selectedArticleId) { 11 | this.selectedArticleId = selectedArticleId; 12 | } 13 | 14 | public Long getSelectedArticleId() { 15 | return selectedArticleId; 16 | } 17 | 18 | @Override 19 | public String getEvent() { 20 | return StringUtils.EMPTY; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/event/GroupSelectedEvent.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.event; 2 | 3 | import jnode.event.IEvent; 4 | import org.apache.commons.lang.StringUtils; 5 | import org.jnode.nntp.model.NewsGroup; 6 | 7 | public class GroupSelectedEvent implements IEvent { 8 | 9 | private NewsGroup selectedGroup; 10 | 11 | public GroupSelectedEvent(NewsGroup selectedGroup) { 12 | this.selectedGroup = selectedGroup; 13 | } 14 | 15 | public NewsGroup getSelectedGroup() { 16 | return selectedGroup; 17 | } 18 | 19 | @Override 20 | public String getEvent() { 21 | return StringUtils.EMPTY; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /jnode-core/test/java/jnode/jscript/JscriptExecutorTest.java: -------------------------------------------------------------------------------- 1 | package jnode.jscript; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | import javax.script.Bindings; 7 | import javax.script.SimpleBindings; 8 | 9 | public class JscriptExecutorTest { 10 | 11 | @Test 12 | public void testExecScript() throws Exception { 13 | 14 | Bindings bindings = new SimpleBindings(); 15 | final JScriptConsole jScriptConsole = new JScriptConsole(); 16 | bindings.put("console", jScriptConsole); 17 | 18 | JscriptExecutor.execScript("var a = 42 + 'ggg'; console.log(a);", bindings); 19 | Assert.assertEquals("42ggg", jScriptConsole.out()); 20 | } 21 | 22 | } -------------------------------------------------------------------------------- /jnode-nntp/src/test/java/org/jnode/nntp/processor/PostProcessorTest.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.processor; 2 | 3 | import org.apache.commons.lang.StringUtils; 4 | import org.junit.Test; 5 | 6 | public class PostProcessorTest { 7 | 8 | @Test 9 | public void testExtractNameEmail1() { 10 | 11 | String s = "Alex Okunevich "; 12 | 13 | int ind1 = StringUtils.indexOf(s, "<"); 14 | int ind2 = StringUtils.indexOf(s, ">"); 15 | 16 | String name = StringUtils.substring(s, 0, ind1); 17 | String email = StringUtils.substring(s, ind1 + 1, ind2); 18 | 19 | 20 | System.out.println(name); 21 | System.out.println(email); 22 | 23 | } 24 | 25 | } 26 | -------------------------------------------------------------------------------- /docs/bin/run.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | ROOT="`dirname $(readlink -f $0)`/../" 3 | PIDFILE="$ROOT/jnode.pid"; 4 | JAR="$ROOT/lib" 5 | 6 | cd $ROOT 7 | if [ "$1" == "" ]; then 8 | echo "Usage: $0 (stop|start|restart|build)" 9 | fi 10 | case "$1" in 11 | start) 12 | if [ -f $PIDFILE ]; then 13 | echo "jNode already running..." 14 | exit 15 | fi 16 | for I in $JAR/*.jar; do A="$A:$I"; done 17 | nohup java -Xmx300m -server -cp "$A" jnode.main.Main jnode.conf & 18 | echo -ne $! > $PIDFILE 19 | ;; 20 | stop) 21 | if [ -f $PIDFILE ]; then 22 | kill `cat $PIDFILE` 23 | rm -f $PIDFILE 24 | fi 25 | ;; 26 | restart) 27 | $0 stop 28 | $0 start 29 | ;; 30 | *) 31 | echo "Usage: $0 (stop|start|restart)" 32 | exit 0; 33 | ;; 34 | esac 35 | 36 | -------------------------------------------------------------------------------- /jnode-httpd-module/resources/www/parts/requestpoint.html: -------------------------------------------------------------------------------- 1 | 2 |
3 | 4 | 5 | 6 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 |
Выберите пойнтовый адрес 7 | . 9 |
Имя:
Фамилия:
Email:
24 | 25 |
-------------------------------------------------------------------------------- /jnode-httpd-module/resources/www/confirmlink.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Запрос линка 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
Request Id
Request Key
19 | 20 |
21 |
22 | Powered by jNode 23 | 24 | -------------------------------------------------------------------------------- /jnode-dumb-module/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | jnode 6 | jnode 7 | 1.0 8 | 9 | jnode-dumb-module 10 | 0.1 11 | jnode-dumb-module 12 | Dumb module 13 | 14 | 15 | jnode 16 | jnode-core 17 | provided 18 | 1.5 19 | 20 | 21 | 22 | src 23 | 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | **jNode** is a complex portable application, providing all necessary functions (mailer, tosser, tracker) for a FTN system. 2 | 3 | It's written in Java (version 1.8 recommended) and distributed under the terms of Apache License 2.0. 4 | 5 | Features of the current version: 6 | - sending and receiving bundles using binkp/1.1-compatible protocol 7 | - keeping all the data (links, messages, subscriptions etc.) in the SQL database 8 | - on-the-fly bundle creation 9 | - multithreading 10 | - netmail routing and tracking 11 | - robots 12 | - fileareas support 13 | - simple AreaFix (`+echo`, `-echo`, `%rescan`, `%list`, `%query`, `%help`) 14 | - simple FileFix (`+fecho`, `-fecho`, `%list`, `%query`, `%help`) 15 | 16 | jNode uses the [ORMLite](http://ormlite.com) library for SQL database access, thus supporting DB2, Derby, H2, hSQL, mySQL, Netezza, Oracle, PostgreSQL, SQLite, MS SQL Server. 17 | 18 | -------------------------------------------------------------------------------- /jnode-pointchecker-module/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | jnode 6 | jnode 7 | 1.0 8 | 9 | jnode-pointchecker-module 10 | 2.0 11 | jnode-pointchecker-module 12 | Module for pointkeepers 13 | 14 | 15 | jnode 16 | jnode-core 17 | provided 18 | 1.5 19 | 20 | 21 | 22 | src 23 | 24 | 25 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/jscript/CoreHelper.java: -------------------------------------------------------------------------------- 1 | package jnode.jscript; 2 | 3 | import jnode.logger.Logger; 4 | 5 | public class CoreHelper extends IJscriptHelper{ 6 | 7 | private final Logger logger = Logger.getLogger(getClass()); 8 | 9 | public Class getClassByName(String name) { 10 | try { 11 | return Class.forName(name); 12 | } catch (ClassNotFoundException e) { 13 | logger.l4(String.format("get bad class %s from jscript", name)); 14 | return null; 15 | } 16 | } 17 | 18 | 19 | @Override 20 | public Version getVersion() { 21 | return new Version() { 22 | @Override 23 | public int getMajor() { 24 | return 1; 25 | } 26 | 27 | @Override 28 | public int getMinor() { 29 | return 0; 30 | } 31 | }; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/exception/EndOfSessionException.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.exception; 2 | 3 | public class EndOfSessionException extends RuntimeException { 4 | private static final long serialVersionUID = 1L; 5 | 6 | public EndOfSessionException() { 7 | super(); 8 | // TODO Auto-generated constructor stub 9 | } 10 | 11 | public EndOfSessionException(String arg0, Throwable arg1, boolean arg2, 12 | boolean arg3) { 13 | super(arg0, arg1, arg2, arg3); 14 | // TODO Auto-generated constructor stub 15 | } 16 | 17 | public EndOfSessionException(String arg0, Throwable arg1) { 18 | super(arg0, arg1); 19 | // TODO Auto-generated constructor stub 20 | } 21 | 22 | public EndOfSessionException(String arg0) { 23 | super(arg0); 24 | // TODO Auto-generated constructor stub 25 | } 26 | 27 | public EndOfSessionException(Throwable arg0) { 28 | super(arg0); 29 | // TODO Auto-generated constructor stub 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/DataProvider.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp; 2 | 3 | import jnode.dto.Echoarea; 4 | import jnode.dto.Echomail; 5 | import jnode.dto.Link; 6 | import jnode.dto.Netmail; 7 | import org.jnode.nntp.model.Auth; 8 | import org.jnode.nntp.model.NewsGroup; 9 | import org.jnode.nntp.model.NewsMessage; 10 | 11 | import java.util.Collection; 12 | 13 | public interface DataProvider { 14 | Echoarea echoarea(String echoareaName); 15 | NewsGroup newsGroup(String groupName, Auth auth); 16 | Collection newsGroups(Auth auth); 17 | 18 | Collection messagesByIdRange(String fromId, String toId, long groupId, Auth auth); 19 | 20 | NewsMessage messageById(String id, Long groupId); 21 | NewsMessage messageByMessageId(String messageId); 22 | 23 | NewsGroup netmail(Auth auth); 24 | 25 | Link link(Auth auth, String pass); 26 | 27 | void post(Netmail netmail); 28 | void post(Auth auth, Echomail netmail); 29 | } 30 | -------------------------------------------------------------------------------- /jnode-xmpp-module/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 4.0.0 6 | 7 | jnode 8 | jnode 9 | 1.0 10 | 11 | jnode-xmpp 12 | 0.1 13 | jnode-xmpp 14 | 15 | 16 | org.igniterealtime.smack 17 | smack 18 | 3.2.1 19 | 20 | 21 | jnode 22 | jnode-core 23 | provided 24 | 1.5 25 | 26 | 27 | 28 | src 29 | 30 | 31 | -------------------------------------------------------------------------------- /README.ru.md: -------------------------------------------------------------------------------- 1 | **jNode** — это комплексное кроссплатформенное приложение, заменяющее собой комплект узлового софта (мейлер, тоссер и трекер) для ip-only узлов. 2 | 3 | Приложение полностью написано на языке Java (1.7) и распространяется по лицензии Apache License 2.0. 4 | 5 | В текущей версии уже реализованы следующие возможности: 6 | - Получение и отправка бандлов по binkp/1.1-совместимому протоколу 7 | - Хранение всех данных (линки, арии, подписки итд) в базе данных 8 | - Создание бандлов в момент соединения 9 | - Многопоточность 10 | - Роутинг нетмейла и rewrite-процессор (по аналогии с FTrack) 11 | - Поддержка файлэх 12 | - Управление роботами 13 | - Простейший робот AreaFix (подписка, отписка, рескан, `%LIST` и `%HELP`) 14 | - Простейший робот FileFix (подписка, отписка, `%LIST` и `%HELP`) 15 | 16 | Приложение построено с использованием библиотеки [ORMLite](http://ormlite.com), поэтому поддерживаются следующие СУБД: DB2, Derby, H2, hSQL, mySQL, Netezza, Oracle, PostgreSQL, SQLite, MS SQL Server. 17 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/exception/NntpException.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.exception; 2 | 3 | public class NntpException extends RuntimeException { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = 1L; 9 | 10 | public NntpException() { 11 | super(); 12 | // TODO Auto-generated constructor stub 13 | } 14 | 15 | public NntpException(String message, Throwable cause, 16 | boolean enableSuppression, boolean writableStackTrace) { 17 | super(message, cause, enableSuppression, writableStackTrace); 18 | // TODO Auto-generated constructor stub 19 | } 20 | 21 | public NntpException(String message, Throwable cause) { 22 | super(message, cause); 23 | // TODO Auto-generated constructor stub 24 | } 25 | 26 | public NntpException(String message) { 27 | super(message); 28 | // TODO Auto-generated constructor stub 29 | } 30 | 31 | public NntpException(Throwable cause) { 32 | super(cause); 33 | // TODO Auto-generated constructor stub 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | jNode FTN Platform ( https://github.com/kreon/jnode ) 2 | This software was originally developed by Ivan Agarkov 3 | 4 | Copyright 2010-2014 Ivan Agarkov 5 | Copyright 2013-2014 Kirill Temnenkov 6 | 7 | This software uses binkp/1.1 protocol which was originally developed by Dima Maloff 8 | 9 | This software includes ORMLite Framework ( http://ormlite.com ) 10 | This software includes Spark Micro Web Framework ( http://www.sparkjava.com ) 11 | and SLF4J ( http://www.slf4j.org ) in jnode-httpd-module and related packages. 12 | This software includes Java Mail API licensed by Oracle ( http://www.oracle.com ) 13 | in jnode-mail-module and related packages. 14 | This software includes JDOM ( http://www.jdom.org/ ) and ROME ( https://github.com/rometools/rome ) 15 | in jnode-rss-module and related packages. 16 | This software includes SMACK API ( http://www.igniterealtime.org/projects/smack/ ) 17 | in jnode-xmpp-module and related packages. 18 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/model/Auth.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.model; 2 | 3 | public class Auth { 4 | private Long linkId; 5 | private String user; 6 | private String address; 7 | private String ftnAddress; 8 | 9 | public Auth(String user, String address, String ftnAddress) { 10 | this.user = user; 11 | this.address = address; 12 | this.ftnAddress = ftnAddress; 13 | } 14 | 15 | public Long getLinkId() { 16 | return linkId; 17 | } 18 | 19 | public void setLinkId(Long linkId) { 20 | this.linkId = linkId; 21 | } 22 | 23 | public String getFtnAddress() { 24 | return ftnAddress; 25 | } 26 | 27 | public String getUser() { 28 | return user; 29 | } 30 | 31 | public String getAddress() { 32 | return address; 33 | } 34 | 35 | public void reset() { 36 | this.linkId = null; 37 | this.user = null; 38 | this.address = null; 39 | this.ftnAddress = null; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/event/IEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.event; 22 | 23 | public interface IEvent { 24 | public String getEvent(); 25 | } 26 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/event/IEventHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.event; 22 | 23 | public interface IEventHandler { 24 | void handle(IEvent event); 25 | } 26 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/exception/UnknownCommandException.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.exception; 2 | 3 | public class UnknownCommandException extends RuntimeException { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = 1L; 9 | 10 | public UnknownCommandException() { 11 | super(); 12 | // TODO Auto-generated constructor stub 13 | } 14 | 15 | public UnknownCommandException(String message, Throwable cause, 16 | boolean enableSuppression, boolean writableStackTrace) { 17 | super(message, cause, enableSuppression, writableStackTrace); 18 | // TODO Auto-generated constructor stub 19 | } 20 | 21 | public UnknownCommandException(String message, Throwable cause) { 22 | super(message, cause); 23 | // TODO Auto-generated constructor stub 24 | } 25 | 26 | public UnknownCommandException(String message) { 27 | super(message); 28 | // TODO Auto-generated constructor stub 29 | } 30 | 31 | public UnknownCommandException(Throwable cause) { 32 | super(cause); 33 | // TODO Auto-generated constructor stub 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /docs/INSTALL.ru.txt: -------------------------------------------------------------------------------- 1 | 1. Отредактировать etc/jnode.xxx.conf 2 | 3 | 2. Отредактировать mail_module.conf если хотите чтоб работала почта и регистрация пойнтов. 4 | 5 | 3. Запустить bin/run.sh дл *nix и mac, bin/run.bat для *win 6 | 7 | 4. Во время первого запуска jNode создаст базу и заполнит её. Не пропустите информацию о техническом пойнте. 8 | Пример вывода: 9 | 18-01-2014 17:45:29 [00000001] InstallUtil [+] owner point account created 10 | 18-01-2014 17:45:29 [00000001] InstallUtil 11 | FTN: 2:9999/9999.1 12 | Aka: Rodriguez bender 13 | Password: 7e3fb3d2 14 | 15 | 5. jNode это серверное ПО, не предназначенное для непосредственного редактирования почты через UI. 16 | Сконфигурируйте пойнт-систему с данными, полученными в пункте 3. 17 | 18 | 6. После коннекта в нетмыло упадет письмо с логином и паролем для админки. В консоли они будут продублированы. 19 | Обычно админка находится по адресу http://127.0.0.1:8080/secure/index.html 20 | 21 | 7. Зайдите в админку и настройте узел. Линки, эхи, роутинг итд. 22 | 23 | 8. Удачи! :-) 24 | И не забывайте обновлять софт. 25 | 26 | -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/util/JSONConverter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.httpd.util; 22 | 23 | public interface JSONConverter { 24 | public String convert(T object); 25 | } 26 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/exception/ProcessorNotFoundException.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.exception; 2 | 3 | public class ProcessorNotFoundException extends RuntimeException { 4 | 5 | /** 6 | * 7 | */ 8 | private static final long serialVersionUID = 1L; 9 | 10 | public ProcessorNotFoundException() { 11 | super(); 12 | // TODO Auto-generated constructor stub 13 | } 14 | 15 | public ProcessorNotFoundException(String message, Throwable cause, 16 | boolean enableSuppression, boolean writableStackTrace) { 17 | super(message, cause, enableSuppression, writableStackTrace); 18 | // TODO Auto-generated constructor stub 19 | } 20 | 21 | public ProcessorNotFoundException(String message, Throwable cause) { 22 | super(message, cause); 23 | // TODO Auto-generated constructor stub 24 | } 25 | 26 | public ProcessorNotFoundException(String message) { 27 | super(message); 28 | // TODO Auto-generated constructor stub 29 | } 30 | 31 | public ProcessorNotFoundException(Throwable cause) { 32 | super(cause); 33 | // TODO Auto-generated constructor stub 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /jnode-xmpp-module/src/org/jnode/xmpp/commands/CommandProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.xmpp.commands; 22 | 23 | public interface CommandProcessor { 24 | public String process(String command); 25 | } 26 | -------------------------------------------------------------------------------- /docs/INSTALL.en.txt: -------------------------------------------------------------------------------- 1 | 1. Open etc/jnode.xxx.conf and change your configuration as described. 2 | 3 | 2. Configure your mail settings for mail sending function & points autoregistration 4 | 5 | 3. Run bin/run.sh if you are running on Linux/FreeBSD/OS X or bin\run.bat if on Windows. 6 | 7 | 4. At the first run, jNode will add some entries to database. Look for messages and don't miss your technical point info! 8 | For example: 9 | 18-01-2014 17:45:29 [00000001] InstallUtil [+] owner point account created 10 | 18-01-2014 17:45:29 [00000001] InstallUtil 11 | FTN: 2:9999/9999.1 12 | Aka: Rodriguez bender 13 | Password: 7e3fb3d2 14 | 15 | 5. Use data you got in previous step to config your point system. It's easy! 16 | Keep in mind that jNode is a server-side software and it don't provides any UI for message handling. 17 | 18 | 6. You will find a netmail to your technical point with account to use web control panel. Also you will see it in console output. 19 | Usualy admin panel is located at http://127.0.0.1:8080/secure/index.html 20 | 21 | 7. Log in and configure your node. 22 | 23 | 8. Enjoy and keep you software updated. 24 | 25 | 26 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/robot/IRobot.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.robot; 22 | 23 | import jnode.ftn.types.FtnMessage; 24 | 25 | /** 26 | * 27 | * @author kreon 28 | * 29 | */ 30 | public interface IRobot { 31 | public void execute(FtnMessage fmsg) throws Exception; 32 | } 33 | -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/dto/EchoareaCSV.java: -------------------------------------------------------------------------------- 1 | package org.jnode.httpd.dto; 2 | 3 | import com.j256.ormlite.field.DatabaseField; 4 | import com.j256.ormlite.table.DatabaseTable; 5 | 6 | @DatabaseTable(tableName = "httpd_echoarea_csv") 7 | public class EchoareaCSV { 8 | @DatabaseField(columnName = "name", id = true) 9 | private String name; 10 | @DatabaseField(columnName = "description") 11 | private String description; 12 | @DatabaseField(columnName = "num") 13 | private Long num; 14 | @DatabaseField(columnName = "latest") 15 | private Long latest; 16 | 17 | public String getName() { 18 | return name; 19 | } 20 | 21 | public void setName(String name) { 22 | this.name = name; 23 | } 24 | 25 | public String getDescription() { 26 | return description; 27 | } 28 | 29 | public void setDescription(String description) { 30 | this.description = description; 31 | } 32 | 33 | public Long getNum() { 34 | return num; 35 | } 36 | 37 | public void setNum(Long num) { 38 | this.num = num; 39 | } 40 | 41 | public Long getLatest() { 42 | return latest; 43 | } 44 | 45 | public void setLatest(Long latest) { 46 | this.latest = latest; 47 | } 48 | 49 | } -------------------------------------------------------------------------------- /jnode-core/src/jnode/stat/IStatPoster.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.stat; 22 | 23 | import jnode.stat.threads.StatPoster; 24 | 25 | public interface IStatPoster { 26 | public void init(StatPoster poster); 27 | 28 | public String getSubject(); 29 | 30 | public String getText(); 31 | } 32 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/ProcessorResolver.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp; 2 | 3 | import com.google.common.collect.Maps; 4 | import org.jnode.nntp.model.NntpCommand; 5 | import org.jnode.nntp.processor.*; 6 | 7 | import java.util.Map; 8 | 9 | public class ProcessorResolver { 10 | 11 | private static final Map map = Maps.newHashMap(); 12 | 13 | static { 14 | map.put(NntpCommand.MODE_READER, new ModeReaderProcessor()); 15 | map.put(NntpCommand.LIST, new ListProcessor()); 16 | map.put(NntpCommand.GROUP, new GroupProcessor()); 17 | map.put(NntpCommand.XOVER, new XoverProcessor()); 18 | map.put(NntpCommand.HEAD, new HeadProcessor()); 19 | map.put(NntpCommand.ARTICLE, new ArticleProcessor()); 20 | map.put(NntpCommand.QUIT, new QuitProcessor()); 21 | map.put(NntpCommand.AUTHINFO_USER, new AuthInfoUserProcessor()); 22 | map.put(NntpCommand.AUTHINFO_PASS, new AuthInfoPassProcessor()); 23 | map.put(NntpCommand.POST, new PostProcessor()); 24 | } 25 | 26 | public static Processor processor(NntpCommand command) { 27 | return map.get(command); 28 | } 29 | 30 | } 31 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/model/NewsGroup.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.model; 2 | 3 | public class NewsGroup extends NntpEntity { 4 | 5 | private String name; 6 | private int numberOfArticles; 7 | private Long reportedLowWatermark; 8 | private Long reportedHighWatermark; 9 | 10 | public String getName() { 11 | return name; 12 | } 13 | 14 | public void setName(String name) { 15 | this.name = name; 16 | } 17 | 18 | public int getNumberOfArticles() { 19 | return numberOfArticles; 20 | } 21 | 22 | public void setNumberOfArticles(int numberOfArticles) { 23 | this.numberOfArticles = numberOfArticles; 24 | } 25 | 26 | public Long getReportedLowWatermark() { 27 | return reportedLowWatermark; 28 | } 29 | 30 | public void setReportedLowWatermark(Long reportedLowWatermark) { 31 | this.reportedLowWatermark = reportedLowWatermark; 32 | } 33 | 34 | public Long getReportedHighWatermark() { 35 | return reportedHighWatermark; 36 | } 37 | 38 | public void setReportedHighWatermark(Long reportedHighWatermark) { 39 | this.reportedHighWatermark = reportedHighWatermark; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /jnode-xmpp-module/src/org/jnode/xmpp/commands/DummyCommandProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.xmpp.commands; 22 | 23 | /** 24 | * Пустой "процессор" для еще несделанных фич 25 | * 26 | * @author kreon 27 | * 28 | */ 29 | public class DummyCommandProcessor implements CommandProcessor { 30 | 31 | @Override 32 | public String process(String command) { 33 | return "Not realized yet"; 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /jnode-nntp/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | jnode 6 | jnode 7 | 1.0 8 | 9 | 4.0.0 10 | 11 | jnode-nntp 12 | 0.8a 13 | 14 | 15 | 16 | jnode 17 | jnode-core 18 | 1.5 19 | 20 | 21 | junit 22 | junit 23 | 4.7 24 | test 25 | 26 | 27 | com.google.guava 28 | guava 29 | 14.0.1 30 | 31 | 32 | commons-lang 33 | commons-lang 34 | 2.4 35 | 36 | 37 | commons-io 38 | commons-io 39 | 2.4 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /centos/jnode.run: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | java -Xmx600m -server -cp "/opt/jnode/jar/activation-1.1.jar:/opt/jnode/jar/commons-io-2.4.jar:/opt/jnode/jar/commons-lang-2.4.jar:/opt/jnode/jar/guava-14.0.1.jar:/opt/jnode/jar/h2-1.3.174.jar:/opt/jnode/jar/javax.mail-1.5.1.jar:/opt/jnode/jar/javax.servlet-3.0.0.v201112011016.jar:/opt/jnode/jar/jdom-1.1.3.jar:/opt/jnode/jar/jetty-http-9.0.2.v20130417.jar:/opt/jnode/jar/jetty-io-9.0.2.v20130417.jar:/opt/jnode/jar/jetty-security-9.0.2.v20130417.jar:/opt/jnode/jar/jetty-server-9.0.2.v20130417.jar:/opt/jnode/jar/jetty-servlet-9.0.2.v20130417.jar:/opt/jnode/jar/jetty-util-9.0.2.v20130417.jar:/opt/jnode/jar/jetty-webapp-9.0.2.v20130417.jar:/opt/jnode/jar/jetty-xml-9.0.2.v20130417.jar:/opt/jnode/jar/jnode-core-1.5.jar:/opt/jnode/jar/jnode-dumb-module-0.1.jar:/opt/jnode/jar/jnode-httpd-module-1.1.jar:/opt/jnode/jar/jnode-mail-module-0.9.jar:/opt/jnode/jar/jnode-nntp-0.8a.jar:/opt/jnode/jar/jnode-pointchecker-module-2.0.jar:/opt/jnode/jar/jnode-rss-1.2.jar:/opt/jnode/jar/jnode-xmpp-0.1.jar:/opt/jnode/jar/mysql-connector-java-5.1.28-bin.jar:/opt/jnode/jar/ormlite-core-4.48.jar:/opt/jnode/jar/ormlite-jdbc-4.48.jar:/opt/jnode/jar/postgresql-9.2-1003-jdbc4.jar:/opt/jnode/jar/rome-1.0.jar:/opt/jnode/jar/slf4j-api-1.7.2.jar:/opt/jnode/jar/slf4j-simple-1.7.5.jar:/opt/jnode/jar/smack-3.2.1.jar:/opt/jnode/jar/spark-core-1.1.1.jar" jnode.main.Main /opt/jnode/jnode.conf 3 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/event/NewNetmailEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.event; 22 | 23 | import jnode.dto.Netmail; 24 | 25 | public class NewNetmailEvent implements IEvent { 26 | private final Netmail netmail; 27 | 28 | public Netmail getNetmail() { 29 | return netmail; 30 | } 31 | 32 | public NewNetmailEvent(Netmail netmail) { 33 | super(); 34 | this.netmail = netmail; 35 | } 36 | 37 | @Override 38 | public String getEvent() { 39 | return ""; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/event/NewEchomailEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.event; 22 | 23 | import jnode.dto.Echomail; 24 | 25 | public class NewEchomailEvent implements IEvent { 26 | private final Echomail echomail; 27 | 28 | public NewEchomailEvent(Echomail echomail) { 29 | super(); 30 | this.echomail = echomail; 31 | } 32 | 33 | public Echomail getEchomail() { 34 | return echomail; 35 | } 36 | 37 | @Override 38 | public String getEvent() { 39 | return ""; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/event/NewFilemailEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.event; 22 | 23 | import jnode.dto.Filemail; 24 | 25 | public class NewFilemailEvent implements IEvent { 26 | private final Filemail filemail; 27 | 28 | @Override 29 | public String getEvent() { 30 | return ""; 31 | } 32 | 33 | public Filemail getFilemail() { 34 | return filemail; 35 | } 36 | 37 | public NewFilemailEvent(Filemail filemail) { 38 | super(); 39 | this.filemail = filemail; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/processor/AuthInfoUserProcessor.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.processor; 2 | 3 | import com.google.common.collect.Lists; 4 | import jnode.event.Notifier; 5 | import org.apache.commons.lang.StringUtils; 6 | import org.jnode.nntp.Processor; 7 | import org.jnode.nntp.event.AuthUserEvent; 8 | import org.jnode.nntp.exception.UnknownCommandException; 9 | import org.jnode.nntp.model.Auth; 10 | import org.jnode.nntp.model.NntpResponse; 11 | import org.jnode.nntp.util.Converter; 12 | 13 | import java.util.Collection; 14 | 15 | public class AuthInfoUserProcessor implements Processor { 16 | 17 | 18 | @Override 19 | public Collection process(Collection params, Long selectedGroupId, Long selectedArticleId, Auth auth) { 20 | if (params == null || params.size() != 1) { 21 | throw new UnknownCommandException(); 22 | } 23 | 24 | String user = params.iterator().next(); 25 | 26 | String username = StringUtils.substring(user, 0, StringUtils.indexOf(user, "@")); 27 | String ftnAddress = Converter.convertEmailToFtn(user); 28 | 29 | Notifier.INSTANSE.notify(new AuthUserEvent(new Auth(user, username, ftnAddress))); 30 | 31 | Collection response = Lists.newLinkedList(); 32 | response.add(NntpResponse.AuthInfo.PASSWORD_REQUIRED); 33 | return response; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/event/NewEchoareaEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.event; 22 | 23 | import jnode.dto.Link; 24 | 25 | public class NewEchoareaEvent implements IEvent { 26 | private final String text; 27 | 28 | public NewEchoareaEvent(String name, Link link) { 29 | text = "Echoarea " + name + " created by " 30 | + ((link == null) ? "local system" : link.getLinkAddress()) 31 | + "\n"; 32 | } 33 | 34 | @Override 35 | public String getEvent() { 36 | return text; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/event/NewFileareaEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.event; 22 | 23 | import jnode.dto.Link; 24 | 25 | public class NewFileareaEvent implements IEvent { 26 | private final String text; 27 | 28 | public NewFileareaEvent(String name, Link link) { 29 | text = "Filearea " + name + " created by " 30 | + ((link == null) ? "local system" : link.getLinkAddress()) 31 | + "\n"; 32 | } 33 | 34 | @Override 35 | public String getEvent() { 36 | return text; 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /jnode-httpd-module/resources/www/requestpointresult.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Запрос пойнта 4 | 5 | 6 | 7 | 8 |
9 |
10 | Назад 11 | 38 |
39 | Powered by jNode 40 | 41 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/model/NewsMessage.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.model; 2 | 3 | public class NewsMessage extends NntpEntity { 4 | 5 | private String groupName; 6 | private String from; 7 | private String subject; 8 | private String body; 9 | private String path; 10 | private String messageId; 11 | 12 | public String getMessageId() { 13 | return messageId; 14 | } 15 | 16 | public void setMessageId(String messageId) { 17 | this.messageId = messageId; 18 | } 19 | 20 | public String getPath() { 21 | return path; 22 | } 23 | 24 | public void setPath(String path) { 25 | this.path = path; 26 | } 27 | 28 | public String getFrom() { 29 | return from; 30 | } 31 | 32 | public void setFrom(String from) { 33 | this.from = from; 34 | } 35 | 36 | public String getSubject() { 37 | return subject; 38 | } 39 | 40 | public void setSubject(String subject) { 41 | this.subject = subject; 42 | } 43 | 44 | public String getGroupName() { 45 | return groupName; 46 | } 47 | 48 | public void setGroupName(String groupName) { 49 | this.groupName = groupName; 50 | } 51 | 52 | public String getBody() { 53 | return body; 54 | } 55 | 56 | public void setBody(String body) { 57 | this.body = body; 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/util/Converter.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.util; 2 | 3 | import org.apache.commons.lang.StringUtils; 4 | 5 | public class Converter { 6 | 7 | /** 8 | * User example: jim.ayson@p300.f2.n750.z6.fidonet.org 9 | * 10 | * @param email email. 11 | * @return ftn address like 6:450/2.300 12 | */ 13 | public static String convertEmailToFtn(String email) { 14 | StringBuilder ftnAddress = new StringBuilder(); 15 | 16 | String[] ftnParts = StringUtils.split(StringUtils.substring(email, StringUtils.indexOf(email, "@") + 1), "."); 17 | // -2 because skip fidonet.org 18 | // -3 because start with 0 19 | for (int index = ftnParts.length - 3; index >= 0; index--) { 20 | String part = ftnParts[index]; 21 | if (StringUtils.contains(part, "z")) { 22 | // ignore 23 | } 24 | if (StringUtils.contains(part, "n")) { 25 | ftnAddress.append(":"); 26 | } 27 | if (StringUtils.contains(part, "f")) { 28 | ftnAddress.append("/"); 29 | } 30 | if (StringUtils.contains(part, "p")) { 31 | ftnAddress.append("."); 32 | } 33 | 34 | ftnAddress.append(StringUtils.substring(ftnParts[index], 1)); 35 | } 36 | 37 | return ftnAddress.toString(); 38 | 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/processor/AuthInfoPassProcessor.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.processor; 2 | 3 | import com.google.common.collect.Lists; 4 | import jnode.dto.Link; 5 | import org.jnode.nntp.DataProvider; 6 | import org.jnode.nntp.DataProviderImpl; 7 | import org.jnode.nntp.Processor; 8 | import org.jnode.nntp.exception.UnknownCommandException; 9 | import org.jnode.nntp.model.Auth; 10 | import org.jnode.nntp.model.NntpResponse; 11 | 12 | import java.util.Collection; 13 | 14 | public class AuthInfoPassProcessor implements Processor { 15 | 16 | private DataProvider dataProvider = new DataProviderImpl(); 17 | 18 | @Override 19 | public Collection process(Collection params, Long selectedGroupId, Long selectedArticleId, Auth auth) { 20 | 21 | if (params == null || params.size() != 1) { 22 | throw new UnknownCommandException(); 23 | } 24 | 25 | String pass = params.iterator().next(); 26 | 27 | Link link = dataProvider.link(auth, pass); 28 | 29 | Collection response = Lists.newLinkedList(); 30 | 31 | if (link == null) { 32 | response.add(NntpResponse.AuthInfo.AUTHENTIFICATION_FAILED_OR_REJECTED); 33 | auth.reset(); 34 | } else { 35 | auth.setLinkId(link.getId()); 36 | response.add(NntpResponse.AuthInfo.AUTHENTIFICATION_ACCEPTED); 37 | } 38 | 39 | return response; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/main/threads/TimerPoll.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.main.threads; 22 | 23 | import java.util.TimerTask; 24 | 25 | import jnode.dto.Link; 26 | import jnode.dto.LinkOption; 27 | import jnode.ftn.FtnTools; 28 | import jnode.orm.ORMManager; 29 | 30 | public class TimerPoll extends TimerTask { 31 | 32 | @Override 33 | public void run() { 34 | for (Link l : ORMManager.get(Link.class).getAll()) { 35 | if (FtnTools.getOptionBooleanDefTrue(l, 36 | LinkOption.BOOLEAN_POLL_BY_TIMEOT)) { 37 | PollQueue.getSelf().add(l); 38 | } 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/jscript/IJscriptHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.jscript; 22 | 23 | public abstract class IJscriptHelper { 24 | public abstract class Version { 25 | public abstract int getMajor(); 26 | 27 | public abstract int getMinor(); 28 | 29 | @Override 30 | public String toString() { 31 | return String.format("v.%d.%d", getMajor(), getMinor()); 32 | } 33 | } 34 | 35 | public abstract Version getVersion(); 36 | 37 | public String toString() { 38 | return String.format("%s %s", getClass().getSimpleName(), getVersion() 39 | .toString()); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/protocol/binkp/types/BinkpCommand.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.protocol.binkp.types; 22 | 23 | /** 24 | * 25 | * @author kreon 26 | * 27 | */ 28 | public enum BinkpCommand { 29 | M_NUL(0), M_ADR(1), M_PWD(2), M_FILE(3), M_OK(4), M_EOB(5), M_GOT(6), M_ERR(7), M_BSY(8), M_GET(9), M_SKIP(10), M_PROCESS_FILE( 30 | 99); 31 | private final int cmd; 32 | 33 | private BinkpCommand(int cmd) { 34 | this.cmd = cmd; 35 | } 36 | 37 | public int getCmd() { 38 | return cmd; 39 | } 40 | 41 | @Override 42 | public String toString() { 43 | return String.format("%s", this.name()); 44 | } 45 | 46 | } 47 | -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/filters/CharsetFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.httpd.filters; 22 | 23 | import spark.Filter; 24 | import spark.Request; 25 | import spark.Response; 26 | 27 | public class CharsetFilter extends Filter { 28 | public CharsetFilter() { 29 | super(); 30 | } 31 | 32 | @Override 33 | public void handle(Request request, Response response) { 34 | if (request.pathInfo().endsWith(".html")) { 35 | response.type("text/html; charset=utf-8"); 36 | response.header("Cache-Control", 37 | "no-cache, no-store, must-revalidate"); 38 | response.header("Pragma", "no-cache"); 39 | response.header("Expires", "0"); 40 | } 41 | } 42 | 43 | } 44 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/model/NntpCommand.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.model; 2 | 3 | import java.util.Collection; 4 | 5 | public enum NntpCommand { 6 | ARTICLE("ARTICLE"), 7 | AUTHINFO_USER("AUTHINFO user"), 8 | AUTHINFO_PASS("AUTHINFO pass"), 9 | BODY, 10 | CAPABILITIES, 11 | DATE, 12 | GROUP("GROUP"), 13 | HDR, 14 | HEAD("HEAD"), 15 | HELP, 16 | IHAVE, 17 | LAST, 18 | LIST("LIST"), 19 | ACTIVE_TIMES, 20 | LIST_ACTIVE, 21 | LIST_DISTRIB_PATS, 22 | LIST_HEADERS, 23 | LIST_NEWSGROUPS, 24 | LIST_OVERVIEW_FMT, 25 | LISTGROUP, 26 | MODE_READER("MODE READER"), 27 | NEWGROUPS, 28 | NEWNEWS, 29 | NEXT, 30 | OVER, 31 | XOVER("XOVER"), 32 | POST("POST"), 33 | QUIT("QUIT"), 34 | STAT; 35 | 36 | private String command; 37 | private Collection params; 38 | 39 | NntpCommand(String command) { 40 | this.command = command; 41 | } 42 | 43 | NntpCommand() { 44 | } 45 | 46 | public String getCommand() { 47 | return command; 48 | } 49 | 50 | public Collection getParams() { 51 | return params; 52 | } 53 | 54 | public void setParams(Collection params) { 55 | this.params = params; 56 | } 57 | 58 | public static NntpCommand find(String command) { 59 | for (NntpCommand nntpCommand : NntpCommand.values()) { 60 | if (command.equalsIgnoreCase(nntpCommand.getCommand())) { 61 | return nntpCommand; 62 | } 63 | } 64 | return null; 65 | } 66 | 67 | } 68 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/install/DefaultVersion.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.install; 22 | 23 | import java.util.Date; 24 | 25 | import jnode.dto.Version; 26 | 27 | public class DefaultVersion extends Version { 28 | private static DefaultVersion self; 29 | 30 | public static Version getSelf() { 31 | if (self == null) { 32 | synchronized (DefaultVersion.class) { 33 | self = new DefaultVersion(); 34 | } 35 | } 36 | return self; 37 | } 38 | 39 | private DefaultVersion() { 40 | setMajorVersion(1L); 41 | setMinorVersion(5L); 42 | setInstalledAt(new Date()); 43 | } 44 | 45 | @Override 46 | public String toString() { 47 | return String.format("%d.%d", getMajorVersion(), getMinorVersion()); 48 | } 49 | 50 | } 51 | -------------------------------------------------------------------------------- /jnode-xmpp-module/src/org/jnode/xmpp/commands/HelpCommandProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.xmpp.commands; 22 | 23 | public class HelpCommandProcessor implements CommandProcessor { 24 | private final static String HELP = "LIST [limit=N]\n" 25 | + "EDIT \n" 26 | + "REMOVE \n" 27 | + "NEW \n" 28 | + "QUIT [key=*]\n"; 29 | 30 | @Override 31 | public String process(String command) { 32 | return HELP; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/ftn/exception/LastMessageException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.ftn.exception; 22 | 23 | public class LastMessageException extends Exception { 24 | private static final long serialVersionUID = 1L; 25 | 26 | public LastMessageException() { 27 | super(); 28 | // TODO Auto-generated constructor stub 29 | } 30 | 31 | 32 | public LastMessageException(String message, Throwable cause) { 33 | super(message, cause); 34 | // TODO Auto-generated constructor stub 35 | } 36 | 37 | public LastMessageException(String message) { 38 | super(message); 39 | // TODO Auto-generated constructor stub 40 | } 41 | 42 | public LastMessageException(Throwable cause) { 43 | super(cause); 44 | // TODO Auto-generated constructor stub 45 | } 46 | 47 | } 48 | -------------------------------------------------------------------------------- /jnode-core/test/java/jnode/ftn/types/Ftn2DTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.ftn.types; 22 | 23 | import junit.framework.TestCase; 24 | import org.junit.Test; 25 | 26 | /** 27 | * @author Kirill Temnenkov (ktemnenkov@intervale.ru) 28 | */ 29 | public class Ftn2DTest { 30 | @Test 31 | public void testFromString() throws Exception { 32 | TestCase.assertEquals(new Ftn2D(5020, 828), Ftn2D.fromString("5020", "828")); 33 | } 34 | 35 | @Test 36 | public void testFromString2() throws Exception { 37 | TestCase.assertEquals(new Ftn2D(5020, 828), Ftn2D.fromString("05020", "0828")); 38 | } 39 | 40 | @Test(expected = IllegalArgumentException.class) 41 | public void testFromBadString() throws Exception { 42 | Ftn2D.fromString("828", ""); 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/dto/ScriptHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.dto; 22 | 23 | import com.j256.ormlite.field.DatabaseField; 24 | import com.j256.ormlite.table.DatabaseTable; 25 | 26 | /** 27 | * Хелперы - для внешних модулей 28 | * 29 | * @author kreon 30 | * 31 | */ 32 | @DatabaseTable(tableName = "scripthelpers") 33 | public class ScriptHelper { 34 | @DatabaseField(id = true, columnName = "helper") 35 | private String id; 36 | @DatabaseField(columnName = "className", canBeNull = false) 37 | private String className; 38 | 39 | public String getId() { 40 | return id; 41 | } 42 | 43 | public void setId(String id) { 44 | this.id = id; 45 | } 46 | 47 | public String getClassName() { 48 | return className; 49 | } 50 | 51 | public void setClassName(String className) { 52 | this.className = className; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/dto/Robot.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.dto; 22 | 23 | import com.j256.ormlite.field.DatabaseField; 24 | import com.j256.ormlite.table.DatabaseTable; 25 | 26 | /** 27 | * Можно внешних роботов вешать если что - расширяемый интерфейс же ;) 28 | * 29 | * @author kreon 30 | * 31 | */ 32 | @DatabaseTable(tableName = "robots") 33 | public class Robot { 34 | @DatabaseField(id = true, columnName = "robot") 35 | private String robot; 36 | @DatabaseField(columnName = "className", canBeNull = false) 37 | private String className; 38 | 39 | public String getRobot() { 40 | return robot; 41 | } 42 | 43 | public void setRobot(String robot) { 44 | this.robot = robot; 45 | } 46 | 47 | public String getClassName() { 48 | return className; 49 | } 50 | 51 | public void setClassName(String className) { 52 | this.className = className; 53 | } 54 | 55 | } 56 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/NntpModule.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp; 2 | 3 | import jnode.event.IEvent; 4 | import jnode.logger.Logger; 5 | import jnode.module.JnodeModule; 6 | import jnode.module.JnodeModuleException; 7 | 8 | import java.io.IOException; 9 | import java.net.ServerSocket; 10 | import java.net.Socket; 11 | 12 | /** 13 | * RFC 2980 - Common NNTP 14 | * Extensions
15 | * RFC 3977 - Network News Transfer 16 | * Protocol (NNTP)
17 | * RFC 6048 - Network News Transfer 18 | * Protocol (NNTP) Additions to LIST Command
19 | */ 20 | public class NntpModule extends JnodeModule { 21 | 22 | private Logger logger = Logger.getLogger(NntpModule.class); 23 | 24 | private static final String DEFAULT_PORT = "1119"; 25 | private static final String PORT_PROPERTY = "nntp.port"; 26 | 27 | public NntpModule(String configFile) throws JnodeModuleException { 28 | super(configFile); 29 | } 30 | 31 | @Override 32 | public void start() { 33 | String port = properties.getProperty(PORT_PROPERTY, DEFAULT_PORT); 34 | logger.l4("Using the following port for NNTP: " + port); 35 | try (ServerSocket serverSocket = new ServerSocket(Integer.valueOf(port))) { 36 | while (!Thread.currentThread().isInterrupted()) { 37 | 38 | Socket socket = serverSocket.accept(); 39 | 40 | logger.l4("New client accepted."); 41 | new Thread(new NntpClient(socket)).start(); 42 | } 43 | 44 | } catch (IOException e) { 45 | Thread.currentThread().interrupt(); 46 | logger.l1("NNTP module can't be initialised.", e); 47 | } 48 | } 49 | 50 | @Override 51 | public void handle(IEvent event) { 52 | 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/processor/ListProcessor.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.processor; 2 | 3 | import org.jnode.nntp.Constants; 4 | import org.jnode.nntp.DataProvider; 5 | import org.jnode.nntp.DataProviderImpl; 6 | import org.jnode.nntp.Processor; 7 | import org.jnode.nntp.model.Auth; 8 | import org.jnode.nntp.model.NewsGroup; 9 | import org.jnode.nntp.model.NntpResponse; 10 | 11 | import java.util.Collection; 12 | import java.util.LinkedList; 13 | 14 | public class ListProcessor extends BaseProcessor implements Processor { 15 | 16 | private DataProvider dataProvider = new DataProviderImpl(); 17 | 18 | @Override 19 | public Collection process(Collection params, Long id, Long selectedArticleId, Auth auth) { 20 | 21 | Collection response = new LinkedList<>(); 22 | response.add(NntpResponse.List.LIST_OF_NEWSGROUPS); 23 | 24 | if (isAuthorized(auth)) { 25 | addNewsGroupToList(response, dataProvider.newsGroup(Constants.NETMAIL_NEWSGROUP_NAME, auth)); 26 | } 27 | 28 | for (NewsGroup newsGroup : dataProvider.newsGroups(auth)) { 29 | addNewsGroupToList(response, newsGroup); 30 | } 31 | 32 | response.add(NntpResponse.END); 33 | 34 | return response; 35 | } 36 | 37 | private void addNewsGroupToList(Collection response, NewsGroup newsGroup) { 38 | /* 39 | http://tools.ietf.org/html/rfc3977#section-7.6.3 40 | "y" Posting is permitted. 41 | "n" Posting is not permitted. 42 | "m" Postings will be forwarded to the newsgroup moderator. 43 | */ 44 | response.add(newsGroup.getName() + " " + newsGroup.getReportedHighWatermark() + " " + newsGroup.getReportedLowWatermark() + " " + "y"); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/routes/JsRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.httpd.routes; 22 | 23 | import spark.Request; 24 | import spark.Response; 25 | import spark.Route; 26 | 27 | public abstract class JsRoute extends Route { 28 | 29 | protected JsRoute(String path) { 30 | super(path); 31 | } 32 | 33 | public JsRoute(String path, String acceptType) { 34 | super(path, acceptType); 35 | } 36 | 37 | @Override 38 | public final Object handle(Request req, Response resp) { 39 | StringBuilder sb = new StringBuilder(); 40 | String cb = req.queryParams("cb"); 41 | if (cb != null) { 42 | sb.append(cb + "("); 43 | } 44 | sb.append(_handle(req, resp)); 45 | if (cb != null) { 46 | sb.append(")"); 47 | } 48 | resp.type("text/javascript"); 49 | return sb.toString(); 50 | } 51 | 52 | protected abstract Object _handle(Request req, Response resp); 53 | 54 | } 55 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/ndl/NodelistIndex.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.ndl; 22 | 23 | import java.io.Serializable; 24 | 25 | import jnode.ftn.types.FtnAddress; 26 | 27 | class NodelistIndex implements Serializable { 28 | private static final long serialVersionUID = 1L; 29 | private FtnNdlAddress[] nodelist; 30 | private Long timestamp; 31 | 32 | public FtnNdlAddress exists(FtnAddress address) { 33 | FtnAddress addr = address.clone(); 34 | addr.setPoint(0); 35 | for (FtnNdlAddress a : nodelist) { 36 | if (a.equals(addr)) { 37 | return a; 38 | } 39 | } 40 | return null; 41 | } 42 | 43 | public NodelistIndex() { 44 | 45 | } 46 | 47 | public NodelistIndex(FtnNdlAddress[] nodelist, Long timestamp) { 48 | super(); 49 | this.nodelist = nodelist; 50 | this.timestamp = timestamp; 51 | } 52 | 53 | public Long getTimestamp() { 54 | return timestamp; 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/protocol/binkp/exceprion/ConnectionEndException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.protocol.binkp.exceprion; 22 | 23 | public class ConnectionEndException extends RuntimeException { 24 | 25 | /** 26 | * 27 | */ 28 | private static final long serialVersionUID = 1L; 29 | 30 | public ConnectionEndException() { 31 | } 32 | 33 | public ConnectionEndException(String message) { 34 | super(message); 35 | } 36 | 37 | public ConnectionEndException(Throwable cause) { 38 | super(cause); 39 | } 40 | 41 | public ConnectionEndException(String message, Throwable cause) { 42 | super(message, cause); 43 | } 44 | 45 | public ConnectionEndException(String message, Throwable cause, 46 | boolean enableSuppression, boolean writableStackTrace) { 47 | super(message, cause, enableSuppression, writableStackTrace); 48 | // TODO Auto-generated constructor stub 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /jnode-dumb-module/src/org/jnode/dumb/DumbModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.dumb; 22 | 23 | import jnode.event.IEvent; 24 | import jnode.logger.Logger; 25 | import jnode.module.JnodeModule; 26 | import jnode.module.JnodeModuleException; 27 | 28 | public class DumbModule extends JnodeModule { 29 | public DumbModule(String configFile) throws JnodeModuleException { 30 | super(configFile); 31 | } 32 | 33 | private static final Logger logger = Logger.getLogger(DumbModule.class); 34 | 35 | @Override 36 | public void handle(IEvent event) { 37 | 38 | } 39 | 40 | @Override 41 | public void start() { 42 | long delay = new Long(properties.getProperty("delay")); 43 | synchronized (this) { 44 | while (true) { 45 | try { 46 | Thread.sleep(delay); 47 | } catch (InterruptedException e) { 48 | } 49 | logger.l1("Dumb module still alive"); 50 | } 51 | } 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/routes/get/BecomeLinkRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.httpd.routes.get; 22 | 23 | import org.jnode.httpd.util.HTML; 24 | 25 | import spark.Request; 26 | import spark.Response; 27 | import spark.Route; 28 | 29 | public class BecomeLinkRoute extends Route { 30 | private static String request = null; 31 | private boolean enabled; 32 | 33 | public BecomeLinkRoute(boolean enabled) { 34 | super("/requestlink.html"); 35 | this.enabled = enabled; 36 | if (enabled) { 37 | if (request == null) { 38 | request = HTML.getContents("/parts/requestlink.html"); 39 | } 40 | } 41 | } 42 | 43 | @Override 44 | public Object handle(Request arg0, Response arg1) { 45 | if (!enabled) { 46 | return HTML 47 | .start(false) 48 | .append("К сожалению, запрос линков отключен сисопом") 49 | .footer().get(); 50 | } 51 | return HTML.start(false).append(request).footer().get(); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /jnode-httpd-module/resources/www/requestlinkresult.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Запрос линка 4 | 5 | 6 | 7 | 8 |
9 |
10 | Назад 11 | 50 |
51 | Powered by jNode 52 | 53 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/dto/FilemailAwaiting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.dto; 22 | 23 | import com.j256.ormlite.field.DatabaseField; 24 | import com.j256.ormlite.table.DatabaseTable; 25 | 26 | @DatabaseTable(tableName = "filemailawaiting") 27 | public class FilemailAwaiting { 28 | @DatabaseField(columnName = "link_id", foreign = true, foreignAutoRefresh = true) 29 | private Link link; 30 | @DatabaseField(columnName = "filemail_id", foreign = true, foreignAutoRefresh = true) 31 | private Filemail mail; 32 | 33 | public Link getLink() { 34 | return link; 35 | } 36 | 37 | public void setLink(Link link) { 38 | this.link = link; 39 | } 40 | 41 | public Filemail getMail() { 42 | return mail; 43 | } 44 | 45 | public void setMail(Filemail mail) { 46 | this.mail = mail; 47 | } 48 | 49 | public FilemailAwaiting() { 50 | super(); 51 | } 52 | 53 | public FilemailAwaiting(Link link, Filemail mail) { 54 | super(); 55 | this.link = link; 56 | this.mail = mail; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/module/JnodeModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.module; 22 | 23 | import jnode.event.IEventHandler; 24 | 25 | import java.io.File; 26 | import java.io.FileInputStream; 27 | import java.io.IOException; 28 | import java.util.Properties; 29 | 30 | /** 31 | * @author kreon 32 | */ 33 | public abstract class JnodeModule implements IEventHandler { 34 | protected Properties properties; 35 | 36 | public JnodeModule(String configFile) throws JnodeModuleException { 37 | File config = new File(configFile); 38 | if (!(config.exists() && config.canRead())) { 39 | throw new JnodeModuleException("Config file " + configFile + " unavailable"); 40 | } 41 | properties = new Properties(); 42 | try { 43 | properties.load(new FileInputStream(config)); 44 | } catch (IOException e) { 45 | throw new JnodeModuleException("Failed to load properties", e); 46 | } 47 | } 48 | 49 | public abstract void start(); 50 | } 51 | -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/dto/WebAdmin.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.httpd.dto; 22 | 23 | import com.j256.ormlite.field.DatabaseField; 24 | import com.j256.ormlite.table.DatabaseTable; 25 | 26 | @DatabaseTable(tableName="httpd_webadmin") 27 | public class WebAdmin { 28 | @DatabaseField(generatedId = true, columnName = "id") 29 | private Long id; 30 | @DatabaseField(columnName = "username", unique = true, canBeNull = false) 31 | private String username; 32 | @DatabaseField(columnName = "password", canBeNull = false) 33 | private String password; 34 | 35 | public Long getId() { 36 | return id; 37 | } 38 | 39 | public void setId(Long id) { 40 | this.id = id; 41 | } 42 | 43 | public String getUsername() { 44 | return username; 45 | } 46 | 47 | public void setUsername(String username) { 48 | this.username = username; 49 | } 50 | 51 | public String getPassword() { 52 | return password; 53 | } 54 | 55 | public void setPassword(String password) { 56 | this.password = password; 57 | } 58 | 59 | } 60 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/jscript/WriteStatToEchoareaHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.jscript; 22 | 23 | import jnode.dto.Echoarea; 24 | import jnode.ftn.FtnTools; 25 | import jnode.logger.Logger; 26 | import jnode.stat.ConnectionStat; 27 | 28 | public class WriteStatToEchoareaHelper extends IJscriptHelper { 29 | 30 | @SuppressWarnings("unused") 31 | private static final Logger logger = Logger 32 | .getLogger(WriteStatToEchoareaHelper.class); 33 | 34 | public void writeStatToEchoarea(String echoArea, String subject, 35 | String statfilename, boolean reset) { 36 | Echoarea area = FtnTools.getAreaByName(echoArea, null); 37 | String content = ConnectionStat.getText(statfilename, reset); 38 | 39 | FtnTools.writeEchomail(area, subject, content); 40 | 41 | } 42 | 43 | @Override 44 | public Version getVersion() { 45 | return new Version() { 46 | 47 | @Override 48 | public int getMinor() { 49 | return 1; 50 | } 51 | 52 | @Override 53 | public int getMajor() { 54 | return 0; 55 | } 56 | }; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/store/XMLSerializer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.store; 22 | 23 | import java.beans.XMLDecoder; 24 | import java.beans.XMLEncoder; 25 | import java.io.*; 26 | 27 | /** 28 | * @author Manjago (kirill@temnenkov.com) 29 | */ 30 | public final class XMLSerializer { 31 | 32 | 33 | private XMLSerializer() { 34 | } 35 | 36 | public static void write(Object f, String filename) throws FileNotFoundException { 37 | XMLEncoder encoder = 38 | new XMLEncoder( 39 | new BufferedOutputStream( 40 | new FileOutputStream(filename))); 41 | encoder.writeObject(f); 42 | encoder.close(); 43 | } 44 | 45 | public static Object read(String filename) throws FileNotFoundException { 46 | XMLDecoder decoder = 47 | new XMLDecoder(new BufferedInputStream( 48 | new FileInputStream(filename))); 49 | Object o = decoder.readObject(); 50 | decoder.close(); 51 | return o; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/main/threads/TosserQueue.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.main.threads; 22 | 23 | import java.util.List; 24 | 25 | import jnode.dto.Link; 26 | import jnode.ftn.tosser.FtnTosser; 27 | import jnode.ftn.types.FtnAddress; 28 | import jnode.protocol.io.Message; 29 | 30 | public class TosserQueue { 31 | private FtnTosser tosser; 32 | 33 | private TosserQueue() { 34 | tosser = new FtnTosser(); 35 | } 36 | 37 | private static TosserQueue self; 38 | 39 | public synchronized static TosserQueue getInstanse() { 40 | if (self == null) { 41 | self = new TosserQueue(); 42 | } 43 | return self; 44 | } 45 | 46 | public void toss() { 47 | if (!tosser.isRunning()) { 48 | synchronized (tosser) { 49 | tosser.tossInboundDirectory(); 50 | tosser.end(); 51 | } 52 | } 53 | } 54 | 55 | public List getMessages(Link link) { 56 | return tosser.getMessages2(new FtnAddress(link.getLinkAddress())); 57 | } 58 | 59 | public List getMessages(FtnAddress address) { 60 | return tosser.getMessages2(address); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/module/JnodeModuleException.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.module; 22 | 23 | /** 24 | * 25 | * @author kreon 26 | * 27 | */ 28 | public class JnodeModuleException extends Exception { 29 | private static final long serialVersionUID = 1L; 30 | 31 | public JnodeModuleException() { 32 | super(); 33 | // TODO Auto-generated constructor stub 34 | } 35 | 36 | public JnodeModuleException(String message, Throwable cause, 37 | boolean enableSuppression, boolean writableStackTrace) { 38 | super(message, cause, enableSuppression, writableStackTrace); 39 | // TODO Auto-generated constructor stub 40 | } 41 | 42 | public JnodeModuleException(String message, Throwable cause) { 43 | super(message, cause); 44 | // TODO Auto-generated constructor stub 45 | } 46 | 47 | public JnodeModuleException(String message) { 48 | super(message); 49 | // TODO Auto-generated constructor stub 50 | } 51 | 52 | public JnodeModuleException(Throwable cause) { 53 | super(cause); 54 | // TODO Auto-generated constructor stub 55 | } 56 | 57 | } 58 | -------------------------------------------------------------------------------- /jnode-httpd-module/resources/www/js/jnode.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * @author kreon 4 | * 5 | * Some functions were taken from stackoverflow.com 6 | */ 7 | 8 | 9 | function _fill(name, val) { 10 | var _var = document.getElementById(name); 11 | if (_var) { 12 | if (_var.innerHTML) { // add 13 | _var.innerHTML += val; 14 | } else { 15 | _var.innerHTML = val; 16 | } 17 | } 18 | } 19 | 20 | function _clear(name) { 21 | var _var = document.getElementById(name); 22 | if (_var) { 23 | if (_var.innerHTML) { // add 24 | _var.innerHTML = ""; 25 | } 26 | } 27 | } 28 | 29 | function _value(name, value) { 30 | var _var = document.getElementById(name); 31 | if (_var) { 32 | _var.value = value; 33 | } 34 | } 35 | 36 | function _var(name) { 37 | var _var = document.getElementById(name); 38 | if (_var) { 39 | return _var.value; 40 | } else { 41 | return null; 42 | } 43 | } 44 | 45 | function _getXmlHttp() { 46 | var xmlhttp; 47 | try { 48 | xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 49 | } catch (e) { 50 | try { 51 | xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 52 | } catch (E) { 53 | xmlhttp = false; 54 | } 55 | } 56 | if (!xmlhttp && typeof XMLHttpRequest != 'undefined') { 57 | xmlhttp = new XMLHttpRequest(); 58 | } 59 | return xmlhttp; 60 | } 61 | 62 | function _get(url) { 63 | var xmlhttp = _getXmlHttp() 64 | xmlhttp.open('GET', url, false); 65 | xmlhttp.send(null); 66 | if (xmlhttp.status == 200) { 67 | return xmlhttp.responseText; 68 | } else { 69 | return ""; 70 | } 71 | } 72 | function _jrun(url, callback) { 73 | url += ((url.indexOf("?") >= 0) ? "&cb=" : "?cb=") + callback; 74 | eval(_get(url)); 75 | } 76 | 77 | function _getParameterByName(name) { 78 | name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]"); 79 | var regex = new RegExp("[\\?&#]" + name + "=([^&#]*)"), results = regex 80 | .exec(document.location.href); 81 | return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, 82 | " ")); 83 | } -------------------------------------------------------------------------------- /jnode-core/src/jnode/dto/FileSubscription.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.dto; 22 | 23 | import com.j256.ormlite.field.DatabaseField; 24 | import com.j256.ormlite.table.DatabaseTable; 25 | 26 | @DatabaseTable(tableName = "filesubscription") 27 | public class FileSubscription { 28 | @DatabaseField(foreign = true, columnName = "link_id") 29 | private Link link; 30 | @DatabaseField(foreign = true, columnName = "filearea_id") 31 | private Filearea area; 32 | 33 | public Link getLink() { 34 | return link; 35 | } 36 | 37 | public void setLink(Link link) { 38 | this.link = link; 39 | } 40 | 41 | public Filearea getArea() { 42 | return area; 43 | } 44 | 45 | public void setArea(Filearea area) { 46 | this.area = area; 47 | } 48 | 49 | @Override 50 | public String toString() { 51 | final StringBuilder sb = new StringBuilder("FileSubscription{"); 52 | sb.append("link=").append(link); 53 | sb.append(", area=").append(area); 54 | sb.append('}'); 55 | return sb.toString(); 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/main/threads/ThreadPool.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.main.threads; 22 | 23 | import java.util.concurrent.LinkedBlockingQueue; 24 | import java.util.concurrent.ThreadPoolExecutor; 25 | import java.util.concurrent.TimeUnit; 26 | 27 | import jnode.logger.Logger; 28 | 29 | public class ThreadPool { 30 | private static ThreadPool self; 31 | private static final Logger logger = Logger.getLogger(ThreadPool.class); 32 | private ThreadPoolExecutor executor; 33 | 34 | public ThreadPool(int numThreads) { 35 | executor = new ThreadPoolExecutor(numThreads, (int) (numThreads * 1.5), 36 | 30, TimeUnit.SECONDS, new LinkedBlockingQueue()); 37 | 38 | logger.l3("Thread pool (" + numThreads + " threads) started"); 39 | self = this; 40 | } 41 | 42 | public static void execute(Runnable r) { 43 | if (self != null) { 44 | self.executor.execute(r); 45 | } 46 | } 47 | 48 | public static boolean isBusy() { 49 | if (self != null) { 50 | return self.executor.getQueue().size() > self.executor 51 | .getMaximumPoolSize(); 52 | } 53 | return true; 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /jnode-xmpp-module/src/org/jnode/xmpp/XMPPModule.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.xmpp; 22 | 23 | import jnode.event.IEvent; 24 | import jnode.logger.Logger; 25 | import jnode.module.JnodeModule; 26 | import jnode.module.JnodeModuleException; 27 | 28 | public class XMPPModule extends JnodeModule { 29 | private final XMPPClient client; 30 | private static final Logger logger = Logger.getLogger(XMPPModule.class); 31 | 32 | public XMPPModule(String configFile) throws JnodeModuleException { 33 | super(configFile); 34 | client = new XMPPClient(properties); 35 | if (!client.testConnection()) { 36 | throw new JnodeModuleException("Invalid XMPP configuration"); 37 | } 38 | } 39 | 40 | @Override 41 | public void handle(IEvent event) { 42 | // TODO Auto-generated method stub 43 | 44 | } 45 | 46 | @Override 47 | public void start() { 48 | synchronized (client) { 49 | while (true) { 50 | logger.l3("Running XMPP client..."); 51 | client.run(); 52 | try { 53 | client.wait(); 54 | } catch (InterruptedException e) { 55 | } 56 | } 57 | } 58 | } 59 | 60 | } 61 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/dto/Subscription.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.dto; 22 | 23 | import com.j256.ormlite.field.DatabaseField; 24 | import com.j256.ormlite.table.DatabaseTable; 25 | 26 | /** 27 | * @author kreon 28 | */ 29 | @DatabaseTable(tableName = "subscription") 30 | public class Subscription { 31 | @DatabaseField(columnName = "link_id", foreign = true, uniqueIndexName = "subs_idx") 32 | private Link link; 33 | @DatabaseField(columnName = "echoarea_id", foreign = true, uniqueIndexName = "subs_idx") 34 | private Echoarea area; 35 | 36 | public Link getLink() { 37 | return link; 38 | } 39 | 40 | public void setLink(Link link) { 41 | this.link = link; 42 | } 43 | 44 | public Echoarea getArea() { 45 | return area; 46 | } 47 | 48 | public void setArea(Echoarea area) { 49 | this.area = area; 50 | } 51 | 52 | @Override 53 | public String toString() { 54 | final StringBuilder sb = new StringBuilder("Subscription{"); 55 | sb.append("link=").append(link); 56 | sb.append(", area=").append(area); 57 | sb.append('}'); 58 | return sb.toString(); 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/install/support/LinkOption_1_1.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.install.support; 22 | 23 | import jnode.dto.Link; 24 | 25 | import com.j256.ormlite.field.DataType; 26 | import com.j256.ormlite.field.DatabaseField; 27 | import com.j256.ormlite.table.DatabaseTable; 28 | 29 | @DatabaseTable(tableName = "linkoptions") 30 | public class LinkOption_1_1 { 31 | @DatabaseField(columnName = "link_id", foreign = true, canBeNull = false, uniqueIndexName = "lopt_idx") 32 | private Link link; 33 | @DatabaseField(columnName = "name", canBeNull = false, uniqueIndexName = "lopt_idx") 34 | private String option; 35 | @DatabaseField(columnName = "value", canBeNull = false, dataType = DataType.LONG_STRING) 36 | private String value; 37 | 38 | public Link getLink() { 39 | return link; 40 | } 41 | 42 | public void setLink(Link link) { 43 | this.link = link; 44 | } 45 | 46 | public String getOption() { 47 | return option; 48 | } 49 | 50 | public void setOption(String option) { 51 | this.option = option; 52 | } 53 | 54 | public String getValue() { 55 | return value; 56 | } 57 | 58 | public void setValue(String value) { 59 | this.value = value; 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /jnode-core/test/java/jnode/ftn/types/FtnAddressTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.ftn.types; 22 | 23 | import junit.framework.TestCase; 24 | import org.junit.Test; 25 | 26 | /** 27 | * @author Kirill Temnenkov (ktemnenkov@intervale.ru) 28 | */ 29 | public class FtnAddressTest { 30 | @Test 31 | public void testToString() throws Exception { 32 | FtnAddress ftnAddress = new FtnAddress(2, 5020, 828, 17 ); 33 | TestCase.assertEquals("2:5020/828.17", ftnAddress.toString()); 34 | } 35 | 36 | @Test 37 | public void testToString2() throws Exception { 38 | FtnAddress ftnAddress = new FtnAddress(2, 5020, 828, 0 ); 39 | TestCase.assertEquals("2:5020/828", ftnAddress.toString()); 40 | } 41 | 42 | @Test 43 | public void testFromString() throws Exception { 44 | FtnAddress ftnAddress = new FtnAddress("2:5020/828.17"); 45 | TestCase.assertEquals("2:5020/828.17", ftnAddress.toString()); 46 | } 47 | 48 | @Test 49 | public void testFromString2() throws Exception { 50 | FtnAddress ftnAddress = new FtnAddress("2:5020/828"); 51 | TestCase.assertEquals("2:5020/828", ftnAddress.toString()); 52 | } 53 | 54 | } 55 | -------------------------------------------------------------------------------- /jnode-core/test/java/jnode/ndl/NodelistIndexTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.ndl; 22 | 23 | import java.util.Date; 24 | 25 | import jnode.ftn.types.FtnAddress; 26 | import junit.framework.TestCase; 27 | 28 | import org.junit.Test; 29 | 30 | public class NodelistIndexTest { 31 | 32 | @Test 33 | public void testNodelist() { 34 | NodelistIndex idx = NodelistScanner.getInstance().createIndex( 35 | NodelistIndexTest.class.getResourceAsStream("nodelist"), 36 | new Date().getTime()); 37 | 38 | FtnAddress a = new FtnAddress("2:5020/848"); 39 | FtnNdlAddress ndl = idx.exists(a); 40 | int binkpPort = ndl.getBinkpPort(); 41 | String hostname = ndl.getInetHost(); 42 | 43 | TestCase.assertNotNull(ndl); 44 | TestCase.assertNotNull(idx); 45 | TestCase.assertEquals(24554, binkpPort); 46 | TestCase.assertEquals("fidonode.in", hostname); 47 | 48 | a = new FtnAddress("2:5020/2141"); 49 | ndl = idx.exists(a); 50 | binkpPort = ndl.getBinkpPort(); 51 | hostname = ndl.getInetHost(); 52 | 53 | TestCase.assertNotNull(ndl); 54 | TestCase.assertNotNull(idx); 55 | TestCase.assertEquals(24555, binkpPort); 56 | TestCase.assertEquals("vp.propush.ru", hostname); 57 | 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/install/support/Dupe_1_4.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.install.support; 22 | 23 | import jnode.dto.Echoarea; 24 | 25 | import com.j256.ormlite.field.DatabaseField; 26 | import com.j256.ormlite.table.DatabaseTable; 27 | 28 | /** 29 | * @author kreon 30 | */ 31 | @DatabaseTable(tableName = "dupes") 32 | public class Dupe_1_4 { 33 | @DatabaseField(columnName = "msgid", index = true) 34 | private String msgid; 35 | @DatabaseField(columnName = "echoarea_id", foreign = true) 36 | private Echoarea echoarea; 37 | 38 | public String getMsgid() { 39 | return msgid; 40 | } 41 | 42 | public void setMsgid(String msgid) { 43 | this.msgid = msgid; 44 | } 45 | 46 | public Echoarea getEchoarea() { 47 | return echoarea; 48 | } 49 | 50 | public void setEchoarea(Echoarea echoarea) { 51 | this.echoarea = echoarea; 52 | } 53 | 54 | @Override 55 | public String toString() { 56 | final StringBuilder sb = new StringBuilder("Dupe{"); 57 | sb.append("msgid='").append(msgid).append('\''); 58 | sb.append(", echoarea=").append(echoarea); 59 | sb.append('}'); 60 | return sb.toString(); 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/dto/FileForLink.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.dto; 22 | 23 | import com.j256.ormlite.field.DataType; 24 | import com.j256.ormlite.field.DatabaseField; 25 | import com.j256.ormlite.table.DatabaseTable; 26 | 27 | @DatabaseTable(tableName = "filesforlink") 28 | public class FileForLink { 29 | @DatabaseField(foreign = true, columnName = "link_id", uniqueIndexName = "idnameidx") 30 | private Link link; 31 | @DatabaseField(uniqueIndexName = "idnameidx", dataType = DataType.STRING, width = 255) 32 | private String filename; 33 | 34 | public Link getLink() { 35 | return link; 36 | } 37 | 38 | public void setLink(Link link) { 39 | this.link = link; 40 | } 41 | 42 | public String getFilename() { 43 | return filename; 44 | } 45 | 46 | public void setFilename(String filename) { 47 | this.filename = filename; 48 | } 49 | 50 | @Override 51 | public String toString() { 52 | final StringBuilder sb = new StringBuilder("FileForLink{"); 53 | sb.append("link=").append(link); 54 | sb.append(", filename='").append(filename).append('\''); 55 | sb.append('}'); 56 | return sb.toString(); 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/event/SharedModuleEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.event; 22 | 23 | import java.util.HashMap; 24 | import java.util.Map; 25 | 26 | public class SharedModuleEvent implements IEvent { 27 | private String to; 28 | private String from; 29 | private Map params; 30 | 31 | public SharedModuleEvent(String to, Object... args) { 32 | try { 33 | throw new Exception(); 34 | } catch (Exception e) { 35 | from = e.getStackTrace()[1].getClassName(); 36 | } 37 | this.to = to; 38 | this.params = new HashMap(); 39 | if (args.length % 2 == 0) { 40 | for (int i = 0; i < args.length; i += 2) { 41 | Object var = args[i]; 42 | Object value = args[i + 1]; 43 | params.put(var.toString(), value); 44 | } 45 | } 46 | } 47 | 48 | @Override 49 | public String getEvent() { 50 | return ""; 51 | } 52 | 53 | public String to() { 54 | return to; 55 | } 56 | 57 | public Map params() { 58 | return params; 59 | } 60 | 61 | public String from() { 62 | return from; 63 | } 64 | 65 | @Override 66 | public String toString() { 67 | return String.format("SharedModulesEvent{%s->%s, %d}", from, to, 68 | params.size()); 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/routes/get/LinkoptionsRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.httpd.routes.get; 22 | 23 | import java.util.List; 24 | 25 | import jnode.dto.Link; 26 | import jnode.dto.LinkOption; 27 | import jnode.orm.ORMManager; 28 | 29 | import org.jnode.httpd.routes.JsRoute; 30 | import org.jnode.httpd.util.JSONUtil; 31 | 32 | import spark.Request; 33 | import spark.Response; 34 | 35 | public class LinkoptionsRoute extends JsRoute { 36 | 37 | public LinkoptionsRoute() { 38 | super("/secure/linkoptions"); 39 | } 40 | 41 | public LinkoptionsRoute(String path, String acceptType) { 42 | super(path, acceptType); 43 | } 44 | 45 | @Override 46 | public Object _handle(Request req, Response resp) { 47 | StringBuilder sb = new StringBuilder(); 48 | String id = req.queryParams("id"); 49 | if (id != null) { 50 | try { 51 | Long lid = Long.valueOf(id); 52 | Link link = ORMManager.get(Link.class).getById(lid); 53 | if (link != null) { 54 | List options = ORMManager.get(LinkOption.class) 55 | .getAnd("link_id", "=", link); 56 | sb.append(JSONUtil.value(options)); 57 | } 58 | } catch (RuntimeException e) { 59 | } 60 | } 61 | return sb.toString(); 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /centos/policy_module/jnode.te: -------------------------------------------------------------------------------- 1 | # (C) Ivan Agarkov, 2017 2 | policy_module(jnode, 1.0.3) 3 | gen_require(` 4 | type http_port_t; 5 | ') 6 | # domain file type 7 | type jnode_t; 8 | type jnode_exec_t; 9 | init_daemon_domain(jnode_t, jnode_exec_t) 10 | application_domain(jnode_t, jnode_exec_t) 11 | corecmd_exec_bin(jnode_t) 12 | libs_use_ld_so(jnode_t) 13 | kernel_read_system_state(jnode_t) 14 | allow jnode_t self:process { execmem }; 15 | files_rw_generic_tmp_dir(jnode_t) 16 | sysnet_read_config(jnode_t) 17 | dev_read_rand(jnode_t) 18 | fs_getattr_xattr_fs(jnode_t) 19 | sysnet_dns_name_resolve(jnode_t) 20 | # network type 21 | type binkp_port_t; 22 | corenet_port(binkp_port_t) 23 | # config type 24 | type jnode_conf_t; 25 | files_config_file(jnode_conf_t) 26 | allow jnode_t jnode_conf_t:dir list_dir_perms; 27 | allow jnode_t jnode_conf_t:file read_file_perms; 28 | # cache type 29 | type jnode_cache_t; 30 | files_type(jnode_cache_t) 31 | allow jnode_t jnode_cache_t:dir { add_entry_dir_perms create_dir_perms list_dir_perms }; 32 | allow jnode_t jnode_cache_t:file { append_file_perms create_file_perms rw_file_perms }; 33 | # log type 34 | type jnode_log_t; 35 | logging_log_file(jnode_log_t) 36 | logging_search_logs(jnode_t) 37 | logging_log_filetrans(jnode_t, jnode_log_t, file) 38 | allow jnode_t jnode_log_t:file { write append_file_perms create_file_perms }; 39 | allow jnode_t jnode_log_t:dir { add_entry_dir_perms }; 40 | # tmp 41 | type jnode_tmp_t; 42 | files_tmp_file(jnode_tmp_t) 43 | allow jnode_t jnode_tmp_t:dir manage_dir_perms; 44 | allow jnode_t jnode_tmp_t:file manage_file_perms; 45 | allow jnode_t tmp_t:dir { add_entry_dir_perms create }; 46 | files_poly_member_tmp(jnode_t, jnode_tmp_t) 47 | type_member jnode_t tmp_t:file jnode_tmp_t; 48 | # allow networking 49 | allow jnode_t self:tcp_socket create_stream_socket_perms; 50 | allow jnode_t self:udp_socket create_socket_perms; 51 | allow jnode_t binkp_port_t:tcp_socket { name_bind name_connect }; 52 | allow jnode_t http_port_t:tcp_socket name_bind; 53 | corenet_tcp_bind_generic_node(jnode_t) 54 | # allow connect to postgresql 55 | postgresql_stream_connect(jnode_t) 56 | corenet_tcp_connect_postgresql_port(jnode_t) 57 | -------------------------------------------------------------------------------- /jnode-nntp/src/main/java/org/jnode/nntp/processor/GroupProcessor.java: -------------------------------------------------------------------------------- 1 | package org.jnode.nntp.processor; 2 | 3 | import jnode.event.Notifier; 4 | import org.apache.commons.lang.StringUtils; 5 | import org.jnode.nntp.DataProvider; 6 | import org.jnode.nntp.DataProviderImpl; 7 | import org.jnode.nntp.Processor; 8 | import org.jnode.nntp.event.GroupSelectedEvent; 9 | import org.jnode.nntp.model.Auth; 10 | import org.jnode.nntp.model.NewsGroup; 11 | import org.jnode.nntp.model.NntpResponse; 12 | 13 | import java.util.Collection; 14 | import java.util.LinkedList; 15 | 16 | public class GroupProcessor implements Processor { 17 | 18 | private DataProvider dataProvider = new DataProviderImpl(); 19 | 20 | @Override 21 | public Collection process(Collection params, Long id, Long selectedArticleId, Auth auth) { 22 | 23 | String groupName = params.iterator().next(); 24 | NewsGroup group = dataProvider.newsGroup(groupName, auth); 25 | if (group == null) { 26 | return responseNotFound(); 27 | } 28 | 29 | Notifier.INSTANSE.notify(new GroupSelectedEvent(group)); 30 | 31 | return responseGroup(groupName, group); 32 | } 33 | 34 | private Collection responseNotFound() { 35 | Collection response = new LinkedList<>(); 36 | response.add(NntpResponse.Group.NO_SUCH_NEWSGROUP); 37 | return response; 38 | } 39 | 40 | private Collection responseGroup(String groupName, NewsGroup group) { 41 | Collection response = new LinkedList<>(); 42 | 43 | String resposeCode = NntpResponse.Group.GROUP_SUCCESSFULLY_SELECTED; 44 | resposeCode = StringUtils.replace(resposeCode, "{number}", Long.toString(group.getNumberOfArticles())); 45 | resposeCode = StringUtils.replace(resposeCode, "{low}", Long.toString(group.getReportedLowWatermark())); 46 | resposeCode = StringUtils.replace(resposeCode, "{high}", Long.toString(group.getReportedHighWatermark())); 47 | resposeCode = StringUtils.replace(resposeCode, "{group}", groupName); 48 | 49 | response.add(resposeCode); 50 | 51 | return response; 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/routes/get/UsersRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.httpd.routes.get; 22 | 23 | import java.util.List; 24 | 25 | import jnode.orm.ORMManager; 26 | 27 | import org.jnode.httpd.dto.WebAdmin; 28 | import org.jnode.httpd.util.HTML; 29 | 30 | import spark.Request; 31 | import spark.Response; 32 | import spark.Route; 33 | 34 | public class UsersRoute extends Route { 35 | private static String request = null; 36 | 37 | public UsersRoute() { 38 | super("/secure/users.html"); 39 | if (request == null) { 40 | request = HTML.getContents("/parts/users.html"); 41 | } 42 | } 43 | 44 | @Override 45 | public Object handle(Request req, Response resp) { 46 | List admins = ORMManager.get(WebAdmin.class).getAll(); 47 | StringBuilder sb = new StringBuilder(); 48 | for (WebAdmin admin : admins) { 49 | sb.append(String 50 | .format("%s" 51 | + "Пароль " 52 | + "Удалить ", 53 | admin.getUsername(), admin.getId(), admin.getId())); 54 | } 55 | 56 | return HTML.start(true).append(String.format(request, sb.toString())) 57 | .footer().get(); 58 | } 59 | } 60 | -------------------------------------------------------------------------------- /jnode-xmpp-module/src/org/jnode/xmpp/commands/QuitCommandProcessor.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.xmpp.commands; 22 | 23 | import java.util.regex.Matcher; 24 | import java.util.regex.Pattern; 25 | 26 | public class QuitCommandProcessor implements CommandProcessor { 27 | private String key = generateKey(); 28 | private static final Pattern pQuit = Pattern.compile("QUIT[ ]+key=(.*)"); 29 | @Override 30 | public String process(String command) { 31 | 32 | Matcher m = pQuit.matcher(command); 33 | if(m.matches()) { 34 | if(key.equals(m.group(1))) { 35 | System.exit(0); 36 | return null; 37 | } else { 38 | return "Invalid key. Type QUIT to regenerate key"; 39 | } 40 | } else { 41 | key = generateKey(); 42 | return "Are you sure? reply QUIT key="+key+" to real exit"; 43 | } 44 | } 45 | 46 | private String generateKey() { 47 | char[] key = new char[48]; 48 | for (int i = 0; i < key.length; i++) { 49 | key[i] = (char) ((booleanRandom()) ? intRandom('a', 'z') 50 | : intRandom('A', 'Z')); 51 | } 52 | return new String(key); 53 | } 54 | 55 | private boolean booleanRandom() { 56 | return Math.random() > 0.5; 57 | } 58 | 59 | private int intRandom(int min, int max) { 60 | return (int) (min + (Math.random() * (double) (max - min))); 61 | } 62 | 63 | } 64 | -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/routes/get/HealthRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.httpd.routes.get; 22 | 23 | import org.jnode.httpd.util.HTML; 24 | 25 | import spark.Request; 26 | import spark.Response; 27 | import spark.Route; 28 | 29 | public class HealthRoute extends Route { 30 | private final String FORMAT_TABLE = "%s
"; 31 | private final String FORMAT_TR = "%s%s"; 32 | 33 | public HealthRoute() { 34 | super("/secure/index.html"); 35 | } 36 | 37 | @Override 38 | public Object handle(Request req, Response resp) { 39 | Runtime runtime = Runtime.getRuntime(); 40 | int free = Math.round(runtime.freeMemory() / (1024 * 1024)); 41 | int max = Math.round(runtime.maxMemory() / (1024 * 1024)); 42 | int total = Math.round(runtime.totalMemory() / (1024 * 1024)); 43 | String text = String.format( 44 | FORMAT_TABLE, 45 | String.format(FORMAT_TR, "Количество ядер", 46 | "" + runtime.availableProcessors()) 47 | + String.format(FORMAT_TR, "Количество потоков", 48 | Thread.activeCount()) 49 | + String.format(FORMAT_TR, "Использования памяти", 50 | "Доступно: " + max + "Мб / Использовано: " 51 | + (total - free) + " Мб")); 52 | return HTML.start(true).append(text).footer().get(); 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/routes/get/BecomePointRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.httpd.routes.get; 22 | 23 | import jnode.ftn.types.FtnAddress; 24 | import jnode.main.MainHandler; 25 | 26 | import org.jnode.httpd.util.HTML; 27 | 28 | import spark.Request; 29 | import spark.Response; 30 | import spark.Route; 31 | 32 | public class BecomePointRoute extends Route { 33 | private static String requestPoint = null; 34 | private boolean enabled; 35 | 36 | public BecomePointRoute(boolean enabled) { 37 | super("/requestpoint.html"); 38 | this.enabled = enabled; 39 | if (enabled) { 40 | if (requestPoint == null) { 41 | requestPoint = HTML.getContents("/parts/requestpoint.html"); 42 | } 43 | } 44 | } 45 | 46 | @Override 47 | public Object handle(Request arg0, Response arg1) { 48 | if (!enabled) { 49 | return HTML 50 | .start(false) 51 | .append("К сожалению, запрос пойнта отключен сисопом") 52 | .footer().get(); 53 | } 54 | StringBuilder sb = new StringBuilder(); 55 | for (FtnAddress a : MainHandler.getCurrentInstance().getInfo() 56 | .getAddressList()) { 57 | sb.append(""); 58 | } 59 | return HTML.start(false) 60 | .append(String.format(requestPoint, sb.toString())).footer() 61 | .get(); 62 | } 63 | 64 | } 65 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/dto/Jscript.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.dto; 22 | 23 | import com.j256.ormlite.field.DataType; 24 | import com.j256.ormlite.field.DatabaseField; 25 | import com.j256.ormlite.table.DatabaseTable; 26 | 27 | /** 28 | * javascript for API Java Scripting 29 | * 30 | * @author Manjago 31 | * 32 | */ 33 | @DatabaseTable(tableName = "jscripts") 34 | public class Jscript { 35 | @DatabaseField(columnName = "id", generatedId = true) 36 | private Long id; 37 | @DatabaseField(columnName = "content", dataType = DataType.LONG_STRING) 38 | private String content; 39 | 40 | public Long getId() { 41 | return id; 42 | } 43 | public void setId(Long id) { 44 | this.id = id; 45 | } 46 | public String getContent() { 47 | return content; 48 | } 49 | public void setContent(String content) { 50 | this.content = content; 51 | } 52 | @Override 53 | public String toString() { 54 | StringBuilder builder = new StringBuilder(); 55 | builder.append("Jscript ["); 56 | if (id != null) { 57 | builder.append("id="); 58 | builder.append(id); 59 | builder.append(", "); 60 | } 61 | if (content != null) { 62 | builder.append("content="); 63 | builder.append(content); 64 | } 65 | builder.append("]"); 66 | return builder.toString(); 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/dto/PointRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.httpd.dto; 22 | 23 | import java.util.UUID; 24 | 25 | import com.j256.ormlite.field.DatabaseField; 26 | import com.j256.ormlite.table.DatabaseTable; 27 | 28 | @DatabaseTable(tableName = "httpd_pointrequest") 29 | public class PointRequest { 30 | @DatabaseField(id = true) 31 | private String id = UUID.randomUUID().toString(); 32 | @DatabaseField 33 | private String addr; 34 | @DatabaseField 35 | private String name; 36 | @DatabaseField 37 | private String email; 38 | @DatabaseField 39 | private String password; 40 | 41 | public String getId() { 42 | return id; 43 | } 44 | 45 | public void setId(String id) { 46 | this.id = id; 47 | } 48 | 49 | public String getAddr() { 50 | return addr; 51 | } 52 | 53 | public void setAddr(String addr) { 54 | this.addr = addr; 55 | } 56 | 57 | public String getName() { 58 | return name; 59 | } 60 | 61 | public void setName(String name) { 62 | this.name = name; 63 | } 64 | 65 | public String getEmail() { 66 | return email; 67 | } 68 | 69 | public void setEmail(String email) { 70 | this.email = email; 71 | } 72 | 73 | public String getPassword() { 74 | return password; 75 | } 76 | 77 | public void setPassword(String password) { 78 | this.password = password; 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/event/Notifier.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.event; 22 | 23 | import java.util.ArrayList; 24 | import java.util.List; 25 | import java.util.concurrent.ConcurrentHashMap; 26 | 27 | public enum Notifier { 28 | INSTANSE; 29 | private final ConcurrentHashMap, List> notifyMap; 30 | 31 | private Notifier() { 32 | notifyMap = new ConcurrentHashMap<>(); 33 | } 34 | 35 | public void register(Class clazz, IEventHandler handler) { 36 | if (clazz != null && handler != null) { 37 | List list = notifyMap.get(clazz); 38 | if (list == null) { 39 | list = new ArrayList<>(); 40 | } 41 | list.add(handler); 42 | notifyMap.put(clazz, list); 43 | } 44 | } 45 | 46 | public void unregister(Class clazz, IEventHandler handler) { 47 | if (clazz != null && handler != null) { 48 | List list = notifyMap.get(clazz); 49 | if (list != null) { 50 | list.remove(handler); 51 | notifyMap.put(clazz, list); 52 | } 53 | } 54 | } 55 | 56 | public void notify(IEvent event) { 57 | List list = notifyMap.get(event.getClass()); 58 | if (list != null) { 59 | for (IEventHandler handler : list) { 60 | if (handler != null) { 61 | handler.handle(event); 62 | } 63 | } 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/dto/EchomailAwaiting.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.dto; 22 | 23 | import com.j256.ormlite.field.DatabaseField; 24 | import com.j256.ormlite.table.DatabaseTable; 25 | 26 | @DatabaseTable(tableName = "echomailawait") 27 | public class EchomailAwaiting { 28 | @DatabaseField(foreign = true, columnName = "link_id") 29 | private Link link; 30 | @DatabaseField(foreign = true, foreignAutoRefresh = true, columnName = "echomail_id") 31 | private Echomail mail; 32 | 33 | public EchomailAwaiting() { 34 | super(); 35 | } 36 | 37 | public EchomailAwaiting(Link link, Echomail mail) { 38 | super(); 39 | this.link = link; 40 | this.mail = mail; 41 | } 42 | 43 | public Link getLink() { 44 | return link; 45 | } 46 | 47 | public void setLink(Link link) { 48 | this.link = link; 49 | } 50 | 51 | public Echomail getMail() { 52 | return mail; 53 | } 54 | 55 | public void setMail(Echomail mail) { 56 | this.mail = mail; 57 | } 58 | 59 | @Override 60 | public String toString() { 61 | final StringBuilder sb = new StringBuilder("EchomailAwaiting{"); 62 | sb.append("link=").append(link); 63 | sb.append(", mail=").append(mail); 64 | sb.append('}'); 65 | return sb.toString(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /jnode-xmpp-module/src/org/jnode/xmpp/ControlTools.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.xmpp; 22 | 23 | import java.util.HashMap; 24 | 25 | import org.jnode.xmpp.commands.CommandProcessor; 26 | import org.jnode.xmpp.commands.DummyCommandProcessor; 27 | import org.jnode.xmpp.commands.HelpCommandProcessor; 28 | import org.jnode.xmpp.commands.ListCommandProcessor; 29 | import org.jnode.xmpp.commands.QuitCommandProcessor; 30 | 31 | /** 32 | * Управление командами 33 | * 34 | * @author kreon 35 | * 36 | */ 37 | public class ControlTools { 38 | private static final HashMap commandTable = createCommandTable(); 39 | 40 | private static HashMap createCommandTable() { 41 | HashMap table = new HashMap<>(); 42 | // TODO: реализовать 43 | table.put("HELP", new HelpCommandProcessor()); 44 | table.put("QUIT", new QuitCommandProcessor()); 45 | table.put("LIST", new ListCommandProcessor()); 46 | table.put("NEW", new DummyCommandProcessor()); 47 | table.put("REMOVE", new DummyCommandProcessor()); 48 | table.put("EDIT", new DummyCommandProcessor()); 49 | return table; 50 | } 51 | 52 | public static String processCommand(String command) { 53 | for (String key : commandTable.keySet()) { 54 | if (command.toUpperCase().startsWith(key)) { 55 | return commandTable.get(key).process(command); 56 | } 57 | } 58 | return "Unknown command. Type HELP for command list"; 59 | } 60 | } 61 | -------------------------------------------------------------------------------- /jnode-httpd-module/resources/www/parts/users.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | %s 7 | 8 |
9 |
11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 |
Новый пользователь
Имя пользователя
Пароль
Подтверждение
28 | 29 |
30 | 31 |
32 | 34 |
35 |
36 | 37 |
38 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/jscript/WriteFileToEchoareaHelper.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.jscript; 22 | 23 | import java.io.IOException; 24 | import java.text.MessageFormat; 25 | 26 | import jnode.core.FileUtils; 27 | import jnode.dto.Echoarea; 28 | import jnode.ftn.FtnTools; 29 | import jnode.logger.Logger; 30 | 31 | public class WriteFileToEchoareaHelper extends IJscriptHelper { 32 | 33 | private static final Logger logger = Logger 34 | .getLogger(WriteFileToEchoareaHelper.class); 35 | 36 | public void writeFileToEchoarea(String echoArea, String subject, 37 | String filename) { 38 | String content; 39 | try { 40 | content = FileUtils.readFile(filename); 41 | } catch (IOException e) { 42 | logger.l2(MessageFormat.format("fail read file {0}", filename), e); 43 | return; 44 | } 45 | writeStringToEchoarea(echoArea, subject, content); 46 | } 47 | 48 | public void writeStringToEchoarea(String echoArea, String subject, 49 | String content){ 50 | Echoarea area = FtnTools.getAreaByName(echoArea, null); 51 | FtnTools.writeEchomail(area, subject, content); 52 | } 53 | 54 | @Override 55 | public Version getVersion() { 56 | return new Version() { 57 | 58 | @Override 59 | public int getMinor() { 60 | return 2; 61 | } 62 | 63 | @Override 64 | public int getMajor() { 65 | return 1; 66 | } 67 | }; 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/routes/get/EchoareaCSVRoute.java: -------------------------------------------------------------------------------- 1 | package org.jnode.httpd.routes.get; 2 | 3 | import java.sql.SQLException; 4 | import java.util.Date; 5 | import java.util.List; 6 | 7 | import org.jnode.httpd.dto.EchoareaCSV; 8 | 9 | import com.j256.ormlite.dao.GenericRawResults; 10 | 11 | import jnode.dto.Echoarea; 12 | import jnode.logger.Logger; 13 | import jnode.orm.ORMManager; 14 | import spark.Request; 15 | import spark.Response; 16 | import spark.Route; 17 | 18 | public class EchoareaCSVRoute extends Route { 19 | private static final long MAX_CACHE_TIME = 3600000; 20 | private long latest = 0; 21 | 22 | public EchoareaCSVRoute() { 23 | super("/echoarea.csv"); 24 | } 25 | 26 | @Override 27 | public Object handle(Request req, Response resp) { 28 | resp.type("text/plain; charset=utf-8"); 29 | long now = new Date().getTime(); 30 | StringBuilder sb = new StringBuilder(); 31 | if (now - latest > MAX_CACHE_TIME) { 32 | try { 33 | ORMManager.get(EchoareaCSV.class).executeRaw( 34 | "DELETE FROM httpd_echoarea_csv;"); 35 | GenericRawResults results = ORMManager 36 | .get(Echoarea.class) 37 | .getRaw("SELECT e.name,e.description,(SELECT count(id) FROM echomail " 38 | + "WHERE echoarea_id=e.id) AS num,(SELECT max(date) FROM echomail " 39 | + "WHERE echoarea_id=e.id) AS latest FROM echoarea e ORDER BY e.name;"); 40 | latest = now; 41 | for (String[] row : results.getResults()) { 42 | EchoareaCSV csv = new EchoareaCSV(); 43 | csv.setName(row[0]); 44 | csv.setDescription(row[1]); 45 | csv.setNum(new Long(row[2])); 46 | csv.setLatest(new Long(row[3])/1000L); 47 | ORMManager.get(EchoareaCSV.class).save(csv); 48 | sb.append(csv.getName() + "," + csv.getLatest() + "," 49 | + csv.getNum() + "," + csv.getDescription() 50 | + "\r\n"); 51 | } 52 | } catch (SQLException e) { 53 | Logger.getLogger(EchoareaCSVRoute.class) 54 | .l1("Echoarea Error", e); 55 | return "error,0,0,SQLError\r\n"; 56 | } 57 | } else { 58 | List list = ORMManager.get(EchoareaCSV.class) 59 | .getOrderAnd("name", true); 60 | for (EchoareaCSV csv : list) { 61 | sb.append(csv.getName() + "," + csv.getLatest() + "," 62 | + csv.getNum() + "," + csv.getDescription() + "\r\n"); 63 | } 64 | } 65 | return sb.toString(); 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /jnode-core/test/java/jnode/robot/ScriptFixTest.java: -------------------------------------------------------------------------------- 1 | package jnode.robot; 2 | 3 | import org.junit.Assert; 4 | import org.junit.Test; 5 | 6 | public class ScriptFixTest { 7 | 8 | @Test 9 | public void testExtractScriptId() throws Exception { 10 | final long scriptId = ScriptFix.extractScriptId("%RUN 34"); 11 | Assert.assertEquals(34L, scriptId); 12 | } 13 | 14 | @Test 15 | public void testExtractBadScriptId() throws Exception { 16 | Assert.assertNull(ScriptFix.extractScriptId("%RUN 34g")); 17 | } 18 | 19 | @Test 20 | public void testExtractBadCommandScriptId() throws Exception { 21 | Assert.assertNull(ScriptFix.extractScriptId("%RUN2 34")); 22 | } 23 | 24 | @Test 25 | public void testExtractScript() throws Exception { 26 | String text = "lalal \n\r bla-bla \t haha"; 27 | Assert.assertEquals(text, ScriptFix.extractScript("{" + text + "}")); 28 | } 29 | 30 | @Test 31 | public void testMarginedExtractScript() throws Exception { 32 | String text = "lalal \n\r bla-bla \t haha"; 33 | Assert.assertEquals(text, ScriptFix.extractScript("sdfdsf {" + text + "} dasf adf \n gg \n")); 34 | } 35 | 36 | @Test 37 | public void testBadExtractScript() throws Exception { 38 | String text = "lalal \n\r bla-bla \t haha"; 39 | Assert.assertNull(ScriptFix.extractScript("{" + text)); 40 | } 41 | 42 | @Test 43 | public void testConsole() throws Exception { 44 | Assert.assertEquals("42FIFO", ScriptFix.executeScriptWithConsole("var a = 42 + 'FIFO'; console.log(a);", true)); 45 | } 46 | 47 | @Test 48 | public void testExtractRealScript() throws Exception { 49 | String realScript = "[\u0001MSGID: 2:5020/828.17 5368d8ed\n" + 50 | "\u0001PID: GED+W32 1.1.5-040321\n" + 51 | "\u0001CHRS: CP866 2\n" + 52 | "{\n" + 53 | "console.log('ffff');\n" + 54 | "}\n" + 55 | "\n" + 56 | "--- 26CDDD30B63806A25C6FD3AB22BB423C8B45A86B\n" + 57 | " * Origin: kirill@temnenkov.com (2:5020/828.17)\n" + 58 | "\u0001Via 2:5020/828.17 @20140506.124330.UTC hpt/w32-mvcdll 1.4.0-sta 29-12-03\n" + 59 | "]"; 60 | Assert.assertEquals("\nconsole.log('ffff');\n", ScriptFix.extractScript(realScript)); 61 | } 62 | 63 | } -------------------------------------------------------------------------------- /jnode-httpd-module/resources/www/css/jnode.css: -------------------------------------------------------------------------------- 1 | table.info th { 2 | border: 1px solid black; 3 | color: #f0f0f0; 4 | font-weight: bold; 5 | background-color: #606060; 6 | } 7 | 8 | table.info td { 9 | border: 1px solid black; 10 | color: #000000; 11 | font-style: italic; 12 | background-color: #c0c0c0; 13 | } 14 | 15 | table.info { 16 | width: 500px; 17 | } 18 | 19 | span.info { 20 | font-size-adjust: +5; 21 | font-weight: bold; 22 | text-align: justify; 23 | } 24 | 25 | .center { 26 | margin-left: auto; 27 | margin-right: auto; 28 | text-align: center; 29 | } 30 | 31 | ul.css-menu-1 { 32 | list-style: none 33 | } 34 | 35 | ul.css-menu-1 li { 36 | display: inline 37 | } 38 | 39 | ul.css-menu-1 li a { 40 | font-family: Tahoma, Geneva, sans-serif; 41 | text-decoration: none; 42 | background: #404040; 43 | font-weight: bold; 44 | color: #f0f0f0; 45 | padding: 6px 10px 6px 10px 46 | } 47 | 48 | ul.css-menu-1 li a:hover { 49 | padding: 6px 10px 6px 10px; 50 | font-weight: bold; 51 | background: #707070; 52 | color: #a0a0a0; 53 | } 54 | 55 | ul.css-menu-1 li a.selected { 56 | background: #555555 57 | } 58 | 59 | a.css-link-1 { 60 | font-weight: normal; 61 | font-style: normal; 62 | text-decoration: none; 63 | background: #d0d0d0; 64 | font-weight: bold; 65 | color: #000000; 66 | border: 1px solid black; 67 | } 68 | 69 | } 70 | table.links { 71 | width: 800px; 72 | } 73 | 74 | table.links th { 75 | border: 1px solid black; 76 | color: #f0f0f0; 77 | font-weight: bold; 78 | background-color: #606060; 79 | } 80 | 81 | table.links td { 82 | border: 1px solid black; 83 | color: #000000; 84 | font-style: italic; 85 | background-color: #c0c0c0; 86 | } 87 | 88 | table.links td input { 89 | border: 1px solid black; 90 | color: #000000; 91 | font-weight: bold; 92 | background-color: #d0d0d0; 93 | } 94 | 95 | .button { 96 | border: 1px solid black; 97 | color: #000000; 98 | font-weight: bold; 99 | background-color: #d0d0d0; 100 | } 101 | 102 | table.menu { 103 | 104 | } 105 | 106 | table.menu th { 107 | border: 1px solid black; 108 | color: #f0f0f0; 109 | font-weight: bold; 110 | background-color: #606060; 111 | padding: 6px 10px 6px 10px; 112 | } 113 | 114 | table.menu th a { 115 | text-decoration: none; 116 | font-weight: bold; 117 | color: #f0f0f0; 118 | } -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/dto/LinkRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.httpd.dto; 22 | 23 | import java.util.UUID; 24 | 25 | import com.j256.ormlite.field.DatabaseField; 26 | import com.j256.ormlite.table.DatabaseTable; 27 | 28 | @DatabaseTable(tableName = "httpd_link_request") 29 | public class LinkRequest { 30 | @DatabaseField(id = true) 31 | private String id = UUID.randomUUID().toString(); 32 | @DatabaseField 33 | private String name; 34 | @DatabaseField 35 | private String address; 36 | @DatabaseField 37 | private String host; 38 | @DatabaseField 39 | private Integer port; 40 | @DatabaseField 41 | private String akey; 42 | 43 | public String getId() { 44 | return id; 45 | } 46 | 47 | public void setId(String id) { 48 | this.id = id; 49 | } 50 | 51 | public String getName() { 52 | return name; 53 | } 54 | 55 | public void setName(String name) { 56 | this.name = name; 57 | } 58 | 59 | public String getAddress() { 60 | return address; 61 | } 62 | 63 | public void setAddress(String address) { 64 | this.address = address; 65 | } 66 | 67 | public String getHost() { 68 | return host; 69 | } 70 | 71 | public void setHost(String host) { 72 | this.host = host; 73 | } 74 | 75 | public Integer getPort() { 76 | return port; 77 | } 78 | 79 | public void setPort(Integer port) { 80 | this.port = port; 81 | } 82 | 83 | public String getAkey() { 84 | return akey; 85 | } 86 | 87 | public void setAkey(String akey) { 88 | this.akey = akey; 89 | } 90 | 91 | } 92 | -------------------------------------------------------------------------------- /jnode-assembly/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | jnode 6 | jnode 7 | 1.0 8 | 9 | 4.0.0 10 | 11 | jnode-assembly 12 | pom 13 | jnode-assembly 14 | jnode assembly module 15 | 1.5 16 | 17 | 18 | 19 | 20 | org.codehaus.mojo 21 | buildnumber-maven-plugin 22 | 1.2 23 | 24 | 25 | validate 26 | 27 | create 28 | 29 | 30 | 31 | 32 | 8 33 | 34 | 35 | 36 | maven-assembly-plugin 37 | 2.4 38 | 39 | 40 | stable 41 | package 42 | 43 | single 44 | 45 | 46 | ${project.build.directory}/dist 47 | false 48 | jnode-${project.version} 49 | 50 | distribution-stable.xml 51 | 52 | 53 | 54 | 55 | dev 56 | package 57 | 58 | single 59 | 60 | 61 | ${project.build.directory}/dist 62 | false 63 | jnode-${project.version} 64 | 65 | distribution-dev.xml 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | -------------------------------------------------------------------------------- /docs/configs/jnode.nix.conf: -------------------------------------------------------------------------------- 1 | # Node config v. 1.0 2 | 3 | # Node's name 4 | info.stationname = Sample Node 5 | 6 | # Node's locatiom 7 | info.location = The City Of Country 8 | 9 | # Your name 10 | info.sysop = Rodriguez bender 11 | 12 | # Nodelists flags 13 | info.ndl = 115200,TCP,BINKP 14 | 15 | # Your node's FTN address 16 | info.address = 2:9999/9999 17 | 18 | # JDBC URL - see JDBC documentation 19 | # We have mySQL, postgreSQL and h2 drivers set 20 | jdbc.url = jdbc:h2:../etc/jnode 21 | 22 | #jdbc.url = jdbc:mysql://localhost/jnode 23 | #jdbc.url = jdbc:postgresql://localhost/jnode 24 | 25 | jdbc.user = jnode 26 | jdbc.pass = jnode 27 | 28 | # binkp protocol settings 29 | 30 | # run server 31 | binkp.server = true 32 | # run client ( poll ) 33 | binkp.client = true 34 | 35 | # address to listen 36 | # change to 0.0.0.0 to listen everywhere 37 | binkp.bind = 0.0.0.0 38 | 39 | # Listen port for binkp protocol 40 | binkp.port = 24554 41 | 42 | # The folder for incoming files 43 | binkp.inbound = ../inbound 44 | 45 | # protocol setting 46 | binkp.timeout = 90 47 | binkp.size = 1000 48 | binkp.temp = ../tmp 49 | 50 | # First poll delay 51 | poll.delay = 600 52 | # Next polls delay 53 | poll.period = 600 54 | # Log level, 5->1 55 | log.level = 4 56 | 57 | # path to latest nodelist (r/o) 58 | nodelist.path = ../nodelist/nodelist 59 | # path to nodelist index (r/w) 60 | nodelist.index = ../nodelist/nodelist.idx 61 | # Uncomment this if you want turn off fileechoes 62 | fileecho.enable = true 63 | # Fileecho base dir 64 | fileecho.path = ../files 65 | 66 | # Uncomment to enable posting statistics 67 | stat.enable = true 68 | # Echoarea in which posters write statistics 69 | stat.area = node.stat 70 | # Uncomment to enable user scripts running on schedule 71 | jscript.enable = 1 72 | 73 | # do not edit if you don't know what is it 74 | modules = org.jnode.httpd.HttpdModule:../etc/httpd_module.conf,org.jnode.mail.MailModule:../etc/mail_module.conf 75 | 76 | # Uncomment to enable redirect log to file(s) 77 | # filenames - yy-MM-dd-HH-mm-ss.log, where yy-MM-dd-HH-mm-ss is cut timestamp 78 | # for example - /opt/jnode/logs/jnode-14-02-05-21-17-21.log 79 | #log.file = /opt/jnode/logs/jnode- 80 | # Uncomment to enable ziping log file(s) 81 | # destination filenames - yy-MM-dd-HH-mm-ss.log, where yy-MM-dd-HH-mm-ss is cut timestamp 82 | # for example - /opt/jnode/logs/arc/jnode-14-02-05-21-17-21.log 83 | #log.zippath = /opt/jnode/logs/arc/jnode- 84 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/main/threads/NetmailFallback.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.main.threads; 22 | 23 | import java.util.Date; 24 | import java.util.List; 25 | import java.util.TimerTask; 26 | 27 | import jnode.dto.Link; 28 | import jnode.dto.Netmail; 29 | import jnode.ftn.FtnTools; 30 | import jnode.ftn.types.FtnAddress; 31 | import jnode.ftn.types.FtnMessage; 32 | import jnode.logger.Logger; 33 | import jnode.orm.ORMManager; 34 | 35 | /** 36 | * Поиск лучшего роутинга для нетмейла 37 | * 38 | * @author kreon 39 | * 40 | */ 41 | public class NetmailFallback extends TimerTask { 42 | private static final Logger logger = Logger 43 | .getLogger(NetmailFallback.class); 44 | 45 | @Override 46 | public void run() { 47 | Date date = new Date(new Date().getTime() - 3600000L); // 1 hour ago 48 | List expiredNetmail = ORMManager.get(Netmail.class).getAnd( 49 | "last_modified", "<", date, "send", "=", false); 50 | if (expiredNetmail.isEmpty()) { 51 | return; 52 | } 53 | for (Netmail netmail : expiredNetmail) { 54 | 55 | FtnMessage msg = FtnTools.netmailToFtnMessage(netmail); 56 | msg.setToAddr(new FtnAddress(netmail.getToFTN())); 57 | Link routeVia = FtnTools.getRoutingFallback(msg, 58 | netmail.getRouteVia()); 59 | if (routeVia != null) { 60 | netmail.setRouteVia(routeVia); 61 | logger.l3("Netmail #" + netmail.getId() + " re-routed via " 62 | + routeVia.getLinkAddress()); 63 | } 64 | netmail.setLastModified(new Date()); 65 | ORMManager.get(Netmail.class).update(netmail); 66 | } 67 | } 68 | 69 | } 70 | -------------------------------------------------------------------------------- /docs/configs/jnode.win.conf: -------------------------------------------------------------------------------- 1 | # Node config v. 1.0 2 | 3 | # Node's name 4 | info.stationname = Sample Node 5 | 6 | # Node's locatiom 7 | info.location = The City Of Country 8 | 9 | # Your name 10 | info.sysop = Rodriguez bender 11 | 12 | # Nodelists flags 13 | info.ndl = 115200,TCP,BINKP 14 | 15 | # Your node's FTN address 16 | info.address = 2:9999/9999 17 | 18 | # JDBC URL - see JDBC documentation 19 | # We have mySQL, postgreSQL and h2 drivers set 20 | jdbc.url = jdbc:h2:..\\etc\\jnode 21 | 22 | #jdbc.url = jdbc:mysql://localhost/jnode 23 | #jdbc.url = jdbc:postgresql://localhost/jnode 24 | 25 | jdbc.user = jnode 26 | jdbc.pass = jnode 27 | 28 | # binkp protocol settings 29 | 30 | # run server 31 | binkp.server = true 32 | # run client ( poll ) 33 | binkp.client = true 34 | 35 | # address to listen 36 | # change to 0.0.0.0 to listen everywhere 37 | binkp.bind = 0.0.0.0 38 | 39 | # Listen port for binkp protocol 40 | binkp.port = 24554 41 | 42 | # The folder for incoming files 43 | binkp.inbound = ..\\inbound 44 | 45 | # protocol setting 46 | binkp.timeout = 90 47 | binkp.size = 1000 48 | binkp.temp = ..\\tmp 49 | 50 | # First poll delay 51 | poll.delay = 600 52 | # Next polls delay 53 | poll.period = 600 54 | # Log level, 5->1 55 | log.level = 4 56 | 57 | # path to latest nodelist (r\\o) 58 | nodelist.path = ..\\nodelist\\nodelist 59 | # path to nodelist index (r\\w) 60 | nodelist.index = ..\\nodelist\\nodelist.idx 61 | # Uncomment this if you want turn off fileechoes 62 | fileecho.enable = true 63 | # Fileecho base dir 64 | fileecho.path = ..\\files 65 | 66 | # Uncomment to enable posting statistics 67 | stat.enable = true 68 | # Echoarea in which posters write statistics 69 | stat.area = node.stat 70 | # Uncomment to enable user scripts running on schedule 71 | jscript.enable = 1 72 | 73 | # do not edit if you don't know what is it 74 | modules = org.jnode.httpd.HttpdModule:..\\etc\\httpd_module.conf,org.jnode.mail.MailModule:..\\etc\\mail_module.conf 75 | 76 | # Uncomment to enable redirect log to file(s) 77 | # filenames - yy-MM-dd-HH-mm-ss.log, where yy-MM-dd-HH-mm-ss is cut timestamp 78 | # for example - /opt/jnode/logs/jnode-14-02-05-21-17-21.log 79 | #log.file = /opt/jnode/logs/jnode- 80 | # Uncomment to enable ziping log file(s) 81 | # destination filenames - yy-MM-dd-HH-mm-ss.log, where yy-MM-dd-HH-mm-ss is cut timestamp 82 | # for example - /opt/jnode/logs/arc/jnode-14-02-05-21-17-21.log 83 | #log.zippath = /opt/jnode/logs/arc/jnode- 84 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/main/threads/HealthReporter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.main.threads; 22 | 23 | import jnode.core.SysInfo; 24 | import jnode.logger.Logger; 25 | 26 | import java.text.MessageFormat; 27 | import java.util.TimerTask; 28 | 29 | /** 30 | * @author Manjago (kirill@temnenkov.com) 31 | */ 32 | public class HealthReporter extends TimerTask { 33 | 34 | private final Logger logger = Logger 35 | .getLogger(getClass()); 36 | 37 | @Override 38 | public void run() { 39 | 40 | try{ 41 | StringBuilder sb = new StringBuilder(); 42 | 43 | SysInfo.OpenFilesInfo openFilesInfo = SysInfo.openFilesInfo(); 44 | if (openFilesInfo != null) { 45 | sb.append(MessageFormat.format("open files = {0,number,#########}/{1,number,##########}; ", openFilesInfo.getOpenFiles(), openFilesInfo.getMaxOpenFiles())); 46 | } 47 | 48 | SysInfo.MemoryInfo memoryInfo = SysInfo.memoryInfo(); 49 | sb.append(MessageFormat.format("memory usage: max = {0,number,#########} MB, total = {1,number,#########} MB, free = {2,number,#########} MB; ", 50 | memoryInfo.getMax(), memoryInfo.getTotal(), memoryInfo.getFree())); 51 | 52 | SysInfo.ThreadInfo threadInfo = SysInfo.threadInfo(); 53 | sb.append(MessageFormat.format("running threads {0,number,#########}", threadInfo.getRunningThreads())); 54 | 55 | logger.l5(sb.toString()); 56 | } catch(Exception consumed){ 57 | logger.l4("got exception, continue working...", consumed); 58 | } 59 | 60 | } 61 | 62 | } 63 | -------------------------------------------------------------------------------- /jnode-httpd-module/resources/www/parts/route.html: -------------------------------------------------------------------------------- 1 | Новый маршрут 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | %s 17 | 18 | 19 |
20 | 21 |
22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 47 | 48 |
Новый маршрут
ПриоритетАдрес отправителяИмя отправителя
Адрес получателяИмя получателяТема
Целевой узел
49 | 50 |
51 | 74 | 75 |
76 | 77 |
78 | 79 | -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/routes/post/LinkoptionRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.httpd.routes.post; 22 | 23 | import jnode.dto.Link; 24 | import jnode.dto.LinkOption; 25 | import jnode.orm.ORMManager; 26 | import spark.Request; 27 | import spark.Response; 28 | import spark.Route; 29 | 30 | public class LinkoptionRoute extends Route { 31 | 32 | public LinkoptionRoute() { 33 | super("/secure/linkoption"); 34 | } 35 | 36 | @Override 37 | public Object handle(Request req, Response resp) { 38 | String id = req.queryParams("_id"); 39 | if (id != null) { 40 | try { 41 | Long lid = Long.valueOf(id); 42 | Link link = ORMManager.get(Link.class).getById(lid); 43 | if (link != null) { 44 | for (String name : req.queryParams()) { 45 | if (name.startsWith("_")) { 46 | continue; 47 | } 48 | LinkOption option = ORMManager.get(LinkOption.class) 49 | .getFirstAnd("link_id", "=", link, "name", "=", 50 | name); 51 | String value = req.queryParams(name); 52 | if (value != null && value.length() > 0) { 53 | if (option == null) { 54 | option = new LinkOption(); 55 | option.setLink(link); 56 | option.setOption(name); 57 | } 58 | option.setValue(value); 59 | ORMManager.get(LinkOption.class).saveOrUpdate( 60 | option); 61 | } else { 62 | if (option != null) { 63 | ORMManager.get(LinkOption.class).delete(option); 64 | } 65 | } 66 | } 67 | } 68 | } catch (RuntimeException e) { 69 | } 70 | } 71 | resp.header("Location", "/secure/links.html"); 72 | halt(302); 73 | return null; 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/protocol/binkp/BinkpConnectorRegistry.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.protocol.binkp; 22 | 23 | import java.util.Collection; 24 | import java.util.Collections; 25 | import java.util.HashMap; 26 | 27 | import jnode.protocol.binkp.connector.BinkpAbstractConnector; 28 | import jnode.protocol.binkp.connector.BinkpAsyncConnector; 29 | import jnode.protocol.binkp.connector.BinkpPipeConnector; 30 | import jnode.protocol.binkp.connector.BinkpSyncConnector; 31 | 32 | /** 33 | * Хранит в себе разные коннекторы - для модульности 34 | * 35 | * @author kreon 36 | * 37 | */ 38 | public class BinkpConnectorRegistry { 39 | private static final BinkpConnectorRegistry self = new BinkpConnectorRegistry(); 40 | 41 | public static BinkpConnectorRegistry getSelf() { 42 | return self; 43 | } 44 | 45 | private HashMap> connectorMap; 46 | 47 | private BinkpConnectorRegistry() { 48 | connectorMap = new HashMap<>(); 49 | connectorMap.put("async:", BinkpAsyncConnector.class); 50 | connectorMap.put("sync:", BinkpSyncConnector.class); 51 | connectorMap.put("pipe:", BinkpPipeConnector.class); 52 | connectorMap.put("|", BinkpPipeConnector.class); 53 | } 54 | 55 | public synchronized void add(String key, 56 | Class clazz) { 57 | if (!connectorMap.containsKey(key)) { 58 | connectorMap.put(key, clazz); 59 | } 60 | } 61 | 62 | public Collection getKeys() { 63 | return Collections.unmodifiableCollection(connectorMap.keySet()); 64 | } 65 | 66 | public Class getConnector(String key) { 67 | return connectorMap.get(key); 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/event/ConnectionEndEvent.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.event; 22 | 23 | import jnode.ftn.types.FtnAddress; 24 | 25 | public class ConnectionEndEvent implements IEvent { 26 | private int bytesReceived; 27 | private int bytesSended; 28 | private FtnAddress address; 29 | private boolean incoming; 30 | private boolean success; 31 | 32 | @Override 33 | public String getEvent() { 34 | return ""; 35 | } 36 | 37 | public ConnectionEndEvent() { 38 | super(); 39 | } 40 | 41 | public ConnectionEndEvent(FtnAddress address, boolean incoming, 42 | boolean success, int bytesReceived, int bytesSended) { 43 | super(); 44 | this.bytesReceived = bytesReceived; 45 | this.bytesSended = bytesSended; 46 | this.address = address; 47 | this.incoming = incoming; 48 | this.success = success; 49 | } 50 | 51 | public ConnectionEndEvent(boolean incoming, boolean success) { 52 | super(); 53 | this.incoming = incoming; 54 | this.success = success; 55 | bytesReceived = 0; 56 | bytesSended = 0; 57 | address = null; 58 | } 59 | 60 | public int getBytesReceived() { 61 | return bytesReceived; 62 | } 63 | 64 | public int getBytesSended() { 65 | return bytesSended; 66 | } 67 | 68 | public FtnAddress getAddress() { 69 | return address; 70 | } 71 | 72 | public boolean isIncoming() { 73 | return incoming; 74 | } 75 | 76 | public boolean isSuccess() { 77 | return success; 78 | } 79 | 80 | @Override 81 | public String toString() { 82 | return "ConnectionEndEvent [bytesReceived=" + bytesReceived 83 | + ", bytesSended=" + bytesSended + ", address=" + address 84 | + ", incoming=" + incoming + ", success=" + success + "]"; 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /jnode-httpd-module/resources/www/parts/echoes.html: -------------------------------------------------------------------------------- 1 | New area 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | %s 13 | 14 | 15 |
16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
Имя
Описание
Уровень доступа ( чтение )
Уровень доступа ( запись )
Уровень доступа ( группа )
41 | 42 |
43 | 81 | 82 |
83 | 84 |
85 | 86 | -------------------------------------------------------------------------------- /jnode-httpd-module/resources/www/parts/fechoes.html: -------------------------------------------------------------------------------- 1 | 2 | New area 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | %s 14 | 15 |
16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 |
Имя
Описание
Уровень доступа ( чтение )
Уровень доступа ( запись )
Уровень доступа ( группа )
41 | 42 |
43 | 81 | 82 |
83 | 84 |
85 | 86 | -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/filters/SecureFilter.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.httpd.filters; 22 | 23 | import java.util.HashMap; 24 | 25 | import jnode.ftn.FtnTools; 26 | import jnode.orm.ORMManager; 27 | 28 | import org.jnode.httpd.dto.WebAdmin; 29 | import org.jnode.httpd.util.Base64Util; 30 | 31 | import spark.Filter; 32 | import spark.Request; 33 | import spark.Response; 34 | 35 | public class SecureFilter extends Filter { 36 | private HashMap cache = new HashMap<>(); 37 | 38 | public SecureFilter() { 39 | super(); 40 | } 41 | 42 | public SecureFilter(String path, String acceptType) { 43 | super(path, acceptType); 44 | } 45 | 46 | public SecureFilter(String path) { 47 | super(path); 48 | } 49 | 50 | @Override 51 | public void handle(Request req, Response resp) { 52 | boolean authenticated = false; 53 | String authBase64 = req.headers("Authorization"); 54 | if (authBase64 != null) { 55 | Boolean test = cache.get(authBase64); 56 | if (test != null && test) { 57 | authenticated = true; 58 | } else { 59 | try { 60 | String authText = new String(Base64Util.decode(authBase64 61 | .split(" ")[1])); 62 | String[] creds = authText.split(":"); 63 | WebAdmin admin = ORMManager.get(WebAdmin.class) 64 | .getFirstAnd("username", "=", creds[0]); 65 | if (admin != null) { 66 | String password = FtnTools.md5(creds[1]); 67 | if (password.equals(admin.getPassword())) { 68 | authenticated = true; 69 | cache.put(authBase64, authenticated); 70 | } 71 | } 72 | } catch (RuntimeException e) { 73 | } 74 | } 75 | } 76 | if (!authenticated) { 77 | resp.header("WWW-Authenticate", 78 | "Basic realm=\"Secure area for operators only\""); 79 | halt(401); 80 | } 81 | } 82 | 83 | } 84 | -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/routes/get/RewritesRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.httpd.routes.get; 22 | 23 | import java.util.List; 24 | 25 | import jnode.dto.Rewrite; 26 | import jnode.orm.ORMManager; 27 | 28 | import org.jnode.httpd.util.HTML; 29 | 30 | import spark.Request; 31 | import spark.Response; 32 | 33 | public class RewritesRoute extends spark.Route { 34 | private static String rewrites = null; 35 | 36 | public RewritesRoute() { 37 | super("/secure/rewrite.html"); 38 | if (rewrites == null) { 39 | rewrites = HTML.getContents("/parts/rewrite.html"); 40 | } 41 | } 42 | 43 | @Override 44 | public Object handle(Request req, Response resp) { 45 | List rewrites = ORMManager.get(Rewrite.class).getOrderAnd( 46 | "nice", true); 47 | StringBuilder sb = new StringBuilder(); 48 | for (Rewrite r : rewrites) { 49 | sb.append(String 50 | .format("" 51 | + "%d" 52 | + "%s/%b" 53 | + "%s -> %s" 54 | + "%s -> %s" 55 | + "%s -> %s" 56 | + "%s -> %s" 57 | + "%s -> %s" 58 | + "Удалить" 59 | + "", r.getNice(), r.getType().name(), 60 | r.isLast(), 61 | 62 | r.getOrig_from_addr(), r.getNew_from_addr(), 63 | r.getOrig_from_name(), r.getNew_from_name(), 64 | r.getOrig_to_addr(), r.getNew_to_addr(), 65 | r.getOrig_to_name(), r.getNew_to_name(), 66 | r.getOrig_subject(), r.getNew_subject(), r.getId())); 67 | } 68 | return HTML.start(true) 69 | .append(String.format(RewritesRoute.rewrites, sb.toString())) 70 | .footer().get(); 71 | } 72 | 73 | } 74 | -------------------------------------------------------------------------------- /jnode-core/src/jnode/stat/FileareaStat.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package jnode.stat; 22 | 23 | import java.util.Date; 24 | 25 | import jnode.dto.Echoarea; 26 | import jnode.dto.Filemail; 27 | import jnode.event.IEvent; 28 | import jnode.event.IEventHandler; 29 | import jnode.event.NewFileareaEvent; 30 | import jnode.event.Notifier; 31 | import jnode.ftn.FtnTools; 32 | import jnode.orm.ORMManager; 33 | import jnode.stat.threads.StatPoster; 34 | 35 | public class FileareaStat implements IStatPoster, IEventHandler { 36 | private StatPoster poster; 37 | 38 | public FileareaStat() { 39 | Notifier.INSTANSE.register(NewFileareaEvent.class, this); 40 | } 41 | 42 | @Override 43 | public String getSubject() { 44 | return "New files last 24h"; 45 | } 46 | 47 | @Override 48 | public String getText() { 49 | StringBuilder b = new StringBuilder(); 50 | String filearea = ""; 51 | Date d = new Date(new Date().getTime() - (24 * 3600 * 1000)); 52 | for (Filemail m : ORMManager.get(Filemail.class).getOrderAnd( 53 | "filearea_id", true, "created", ">", d)) { 54 | if (!filearea.equalsIgnoreCase(m.getFilearea().getName())) { 55 | filearea = m.getFilearea().getName().toUpperCase(); 56 | b.append(" > " + filearea + " - " 57 | + m.getFilearea().getDescription() + "\n"); 58 | } 59 | b.append(" " + m.getFilename() + " - " + m.getFiledesc() + "\n"); 60 | } 61 | return b.toString(); 62 | } 63 | 64 | @Override 65 | public void handle(IEvent event) { 66 | if (event instanceof NewFileareaEvent) { 67 | Echoarea area = FtnTools.getAreaByName(poster.getTechEchoarea(), 68 | null); 69 | FtnTools.writeEchomail(area, "New filearea created", 70 | event.getEvent()); 71 | } 72 | 73 | } 74 | 75 | @Override 76 | public void init(StatPoster poster) { 77 | this.poster = poster; 78 | 79 | } 80 | 81 | } 82 | -------------------------------------------------------------------------------- /jnode-httpd-module/src/org/jnode/httpd/routes/get/RoutingsRoute.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the jNode FTN Platform Develpoment Team (jNode Team) 3 | * under one or more contributor license agreements. 4 | * See the NOTICE file distributed with this work for 5 | * additional information regarding copyright ownership. 6 | * The jNode Team licenses this file to you under the 7 | * Apache License, Version 2.0 (the "License"); 8 | * you may not use this file except in compliance 9 | * with the License. You may obtain a copy of the License at 10 | * 11 | * http://www.apache.org/licenses/LICENSE-2.0 12 | * 13 | * Unless required by applicable law or agreed to in writing, 14 | * software distributed under the License is distributed on an 15 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 | * KIND, either express or implied. See the License for the 17 | * specific language governing permissions and limitations 18 | * under the License. 19 | */ 20 | 21 | package org.jnode.httpd.routes.get; 22 | 23 | import java.util.List; 24 | 25 | import jnode.dto.Link; 26 | import jnode.dto.Route; 27 | import jnode.orm.ORMManager; 28 | 29 | import org.jnode.httpd.util.HTML; 30 | 31 | import spark.Request; 32 | import spark.Response; 33 | 34 | public class RoutingsRoute extends spark.Route { 35 | private static String routings = null; 36 | 37 | public RoutingsRoute() { 38 | super("/secure/route.html"); 39 | if (routings == null) { 40 | routings = HTML.getContents("/parts/route.html"); 41 | } 42 | } 43 | 44 | @Override 45 | public Object handle(Request req, Response resp) { 46 | List routes = ORMManager.get(Route.class).getOrderAnd("nice", 47 | true); 48 | StringBuilder sb = new StringBuilder(); 49 | for (Route r : routes) { 50 | Link l = ORMManager.get(Link.class) 51 | .getById(r.getRouteVia().getId()); 52 | sb.append(String 53 | .format("%d%s%s%s%s%s%sУдалить", 54 | r.getNice(), r.getFromAddr(), r.getFromName(), 55 | r.getToAddr(), r.getToName(), r.getSubject(), 56 | (l != null) ? l.getLinkAddress() : "NULL", 57 | r.getId())); 58 | } 59 | StringBuilder sb2 = new StringBuilder(); 60 | for (Link l : ORMManager.get(Link.class).getAll()) { 61 | if (l.getLinkAddress().matches( 62 | "^[1-7]:[0-9]{1,5}\\/[0-9]{1,5}(\\.0)?$")) { 63 | sb2.append(""); 65 | } 66 | } 67 | return HTML.start(true) 68 | .append(String.format(routings, sb.toString(), sb2.toString())) 69 | .footer().get(); 70 | } 71 | 72 | } 73 | -------------------------------------------------------------------------------- /jnode-mail-module/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | jnode 6 | jnode 7 | 1.0 8 | 9 | jnode-mail-module 10 | 0.9 11 | jnode-mail-module 12 | Module to send emails 13 | 14 | 15 | jnode 16 | jnode-core 17 | provided 18 | 1.5 19 | 20 | 21 | com.sun.mail 22 | javax.mail 23 | 1.5.1 24 | 25 | 26 | 27 | 28 | 29 | org.apache.maven.plugins 30 | maven-dependency-plugin 31 | 32 | 33 | copy 34 | package 35 | 36 | copy-dependencies 37 | 38 | 39 | 40 | ${project.build.directory}/lib 41 | 42 | runtime 43 | 44 | 45 | 46 | 47 | 48 | src 49 | 50 | 51 | 53 | 54 | org.eclipse.m2e 55 | lifecycle-mapping 56 | 1.0.0 57 | 58 | 59 | 60 | 61 | 62 | 63 | org.apache.maven.plugins 64 | 65 | 66 | maven-dependency-plugin 67 | 68 | [2.1,) 69 | 70 | copy-dependencies 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | --------------------------------------------------------------------------------