From 297035f19d2b30d448a6a88fa6ae078b79d0b4fb Mon Sep 17 00:00:00 2001 From: Piston Date: Wed, 9 Mar 2016 19:17:39 +0300 Subject: [PATCH] bug fixes --- frontend/files/favicon.ico | Bin 4286 -> 67646 bytes .../frontend/NanoboardController.scala | 2 +- .../components/PngGenerationPanel.scala | 3 +- .../frontend/components/ThreadContainer.scala | 26 ++++++++++-------- library/src/main/resources/reference.conf | 3 +- src/main/resources/reference.conf | 13 ++++++++- .../com/karasiq/nanoboard/server/Main.scala | 16 ++++++----- .../server/NanoboardMessageStream.scala | 4 +-- 8 files changed, 42 insertions(+), 25 deletions(-) diff --git a/frontend/files/favicon.ico b/frontend/files/favicon.ico index cc34b57b1f3005bfb887a7d7fd6bc4a75bef7cd2..5a0a5ea44bac9dd53abc674dc07b2de6e37c2411 100644 GIT binary patch literal 67646 zcmeI53$RsX701s7^^ieV%gD00kT@|t%_(a_JjQ5RQw9t@)C402dTIE~7o3ZvkyfMD z=u}9&L=BBBgRIO8X%b4BSTi|RM@2vb1x29{ZomIIXYX&H&3&DF&*tvOTF#HN-{hghnCf~`2Yhf{50>{CD5C@ay8BF8-w}GGa2~uCqBhPZxhe1*nC|iN!Lw*G38JzQ9QZyk-Q(?pRcJJj7QoZv)HybopQ_nht}mtcjKPgK3{mAL!mt8h2(>Sz+3z+Xs_75q}8Fx0wE^kAFQU zJh+1x_@-%}dhNZjUH5iD(|bI7my_;s-_u^7dS?`TZ#aSZ;Ch=*zdwTagUe0-%*DUz z2V{BJ36}HO@_}kdbPgz(_L+@+)skIi`e#;u)f3*FQvLM|`(N-d+zWSs&Up)A9{dPy zsG?~tTLjuh+qQxB)iG3una1;@YDynUVBhpU;|W*+*Mr_~>7CUF;Rw+EY@g^bcVrJPB%3(qcq)#kv=ad%NXd<>uGnSlA!6j(kmBrkdE%a5mfms@smcU)9DJ zW7tmR(rTCiBO$5wP8xmzJP2`&1)bO8^xKSAXwP+UB&5w03%btO4RMKuIBCBMzYK@8 z+dJrB60fF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&Vu#~+Wv^I<*1`Iam1;O|b0)xdJo_xY!_ zc1hjib6f5H`;7mk+V%PHydRX6?e;nUgwI#OUa?ET7pby;F+A_i0@?siwN*B({7a^k bg7YX>^Mx&eDA9IB{MhPtC_6r|1DpRJyN_DJ literal 4286 zcmeH}&5KWA6vv-23lj@UiH&ASBH4IZAQr?FW23Q=jZhQ|QeyB2C@k18b~CnOHEMQB z{s^V4B>n;8^O?Dar*XT#xlgxi7S6BF?>YB8=bZ0-dG1R}L;OZZlmBUYeM%csN?UKLXg{N=_uEK>1ePhnO19O{t#oTh%`3HI(fK{+uGxs2TgwU!R zy)WwGd2E85QnNPiRpOs56{pVH63x73CFu`wJey%R9ERf+`o=baIbmHKzia$DysCJ_ zcndDU`3ikwk0J7|;ai)Z%M#yvZXe{w#b%?KyC1w4OEmMEiAJU7No(_7CH_iUf6Yhx z_iPvIFF*caB(}g_I0mQSBpii3;9UNk>_Yz{J#WHGcn%N1_3pJDhtr_WWpM5Vn0o`P zExG1-jqj*!(AKt7@CNc;CI0{Q-}cP^$?szQNDNbIiR5)|RZfyk?3X8=$ROGX;6CI)BhNknf*e(AKQ6woWr* zYWocs+fCya^4`J|xD8hzzCZPiIcJW!O}%1HZJ#f(-S?>W*gw=)TbqHtk6q2M5u85v zK`k|xn&-o7;<^}gU$i-2vCiXq|JMDU(z>~nh9~*HlZA=ZpHjL@$vhG{??1PTKm4(n PZ!dddla= postsPerPage) { - posts() = opPost ++ Some(post) ++ answers.dropRight(1) + opPost ++ Some(post) ++ answers.dropRight(1) } else { - posts() = opPost ++ Some(post) ++ answers + opPost ++ Some(post) ++ answers } case NanoboardContext.Thread(post.hash, _) ⇒ val (_, answers) = posts.now.partition(_.hash == post.hash) - posts() = post +: answers + post +: answers case _ ⇒ - posts() = posts.now.collect { - case msg @ NanoboardMessageData(_, hash, _, answers) if post.parent.contains(hash) ⇒ - msg.copy(answers = answers + 1) + posts.now + } - case msg ⇒ - msg - } + posts() = newPosts.collect { + case msg @ NanoboardMessageData(_, hash, _, answers) if post.parent.contains(hash) ⇒ + msg.copy(answers = answers + 1) + + case msg ⇒ + msg } } diff --git a/library/src/main/resources/reference.conf b/library/src/main/resources/reference.conf index 720a6c4..97cd016 100644 --- a/library/src/main/resources/reference.conf +++ b/library/src/main/resources/reference.conf @@ -1,5 +1,6 @@ nanoboard { - client-version = "karasiq-nanoboard v1.0.4" + version = 1.0.4 + client-version = karasiq-nanoboard v${nanoboard.version} encryption-key = "nano" bitmessage { chan-address = "BM-2cWzzuoiF7pxchwiF5obVmXaQKFywETu7k" diff --git a/src/main/resources/reference.conf b/src/main/resources/reference.conf index b9e99fa..93f3db5 100644 --- a/src/main/resources/reference.conf +++ b/src/main/resources/reference.conf @@ -1,6 +1,6 @@ nanoboard { external-config-file = nanoboard.conf - max-post-size = 70k + max-post-size = 66k database { url = "jdbc:h2:file:"${user.home}/.nanoboard/index @@ -32,4 +32,15 @@ nanoboard { username = "nanoapi" password = "nano" } +} + +akka.http { + server { + server-header = nanoboard/${nanoboard.version} + idle-timeout = 24h + } + + client { + user-agent-header = "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/44.0.2403.52 Safari/537.36 OPR/31.0.1889.50 (Edition beta)" + } } \ No newline at end of file diff --git a/src/main/scala/com/karasiq/nanoboard/server/Main.scala b/src/main/scala/com/karasiq/nanoboard/server/Main.scala index 07a07c7..0b4e357 100644 --- a/src/main/scala/com/karasiq/nanoboard/server/Main.scala +++ b/src/main/scala/com/karasiq/nanoboard/server/Main.scala @@ -106,13 +106,15 @@ object Main extends App { // Imageboards PNG val messageSource = UrlPngSource.fromConfig(config) val updateInterval = FiniteDuration(config.getDuration("nanoboard.scheduler.update-interval", TimeUnit.MILLISECONDS), TimeUnit.MILLISECONDS) - Source.tick(10 seconds, updateInterval, ()) - .flatMapConcat(_ ⇒ Source.fromPublisher(db.stream(Place.list()))) - .flatMapMerge(8, messageSource.imagesFromPage) - .filterNot(cache.contains) - .alsoTo(Sink.foreach(image ⇒ cache += image)) - .flatMapMerge(8, messageSource.messagesFromImage) - .runWith(dbMessageSink) + + actorSystem.scheduler.schedule(10 seconds, updateInterval) { + Source.fromPublisher(db.stream(Place.list())) + .flatMapMerge(4, messageSource.imagesFromPage) + .filterNot(cache.contains) + .alsoTo(Sink.foreach(image ⇒ cache += image)) + .flatMapMerge(8, messageSource.messagesFromImage) + .runWith(dbMessageSink) + } // REST server val server = NanoboardServer(dispatcher) diff --git a/src/main/scala/com/karasiq/nanoboard/server/NanoboardMessageStream.scala b/src/main/scala/com/karasiq/nanoboard/server/NanoboardMessageStream.scala index 929482c..4fa317b 100644 --- a/src/main/scala/com/karasiq/nanoboard/server/NanoboardMessageStream.scala +++ b/src/main/scala/com/karasiq/nanoboard/server/NanoboardMessageStream.scala @@ -10,9 +10,9 @@ private[server] final class NanoboardMessageStream extends GraphStage[FanInShape val messages: Inlet[NanoboardMessage] = Inlet("MessageStream") val output: Outlet[NanoboardMessage] = Outlet("MessageOutput") - override def shape: FanInShape2[Set[String], NanoboardMessage, NanoboardMessage] = new FanInShape2(input, messages, output) + override def shape = new FanInShape2(input, messages, output) - override def createLogic(inheritedAttributes: Attributes): GraphStageLogic = new GraphStageLogic(shape) { + override def createLogic(inheritedAttributes: Attributes) = new GraphStageLogic(shape) { private var subscription = Set.empty[String] def request(): Unit = {