Skip to content

Commit

Permalink
Version 1.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Karasiq committed Jun 22, 2020
1 parent 71a5f28 commit 69095a6
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 22 deletions.
10 changes: 5 additions & 5 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import sbtcrossproject.CrossPlugin.autoImport.{CrossType, crossProject}

val commonSettings = Seq(
organization := "com.github.karasiq",
version := "1.1.3",
version := "1.2.0",
scalaVersion := "2.12.4",
// crossScalaVersions := Seq("2.11.11", "2.12.4"),
resolvers += Resolver.sonatypeRepo("snapshots"),
licenses := Seq("Apache License, Version 2.0" url("http://opensource.org/licenses/Apache-2.0")),
coverageExcludedPackages := "com.karasiq.shadowcloud.javafx.*;com.karasiq.shadowcloud.desktop.*;com.karasiq.shadowcloud.webapp.*;com.karasiq.shadowcloud.storage.*;com.karasiq.shadowcloud.persistence.*",
//parallelExecution in test := false,
//fork in test := false,
scalacOptions ++= (if (sys.props.get("disable-assertions").exists(_ == "1"))
scalacOptions ++= (if (sys.props.get("disable-assertions").contains("1"))
Seq("-Xelide-below", "OFF", "-Xdisable-assertions")
else
Nil),
Expand All @@ -26,8 +26,8 @@ val commonSettings = Seq(
"-Ywarn-unused:-implicits",
"-Xlint",
"-Ypartial-unification",
//"-opt:l:inline",
//"-opt-inline-from:**"
"-opt:l:inline",
"-opt-inline-from:**"
)
)

Expand Down Expand Up @@ -83,7 +83,7 @@ lazy val dockerSettings = Seq(
val injected = Seq(
Cmd("RUN", "apt update && apt install -y fuse libfuse2 libfuse-dev python3-pip && rm -rf /var/lib/apt/lists/*"), // TODO https://github.com/docker/for-mac/issues/3431
Cmd("RUN", "echo 'user_allow_other' >> /etc/fuse.conf"),
Cmd("RUN", "python3 -m pip install Telethon==0.19.1 cryptg==0.2.post1 Flask==1.1.1")
Cmd("RUN", "python3 -m pip install Telethon==1.14.0 cryptg==0.2.post1 Quart==0.12.0 Hypercorn==0.9.5 lz4==3.1.0 pytz>=2020.1")
)
cmds.takeWhile(!_.makeContent.startsWith("USER 1001:0")) ++ injected ++ cmds.dropWhile(!_.makeContent.startsWith("USER 1001:0"))
},
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=1.3.10
sbt.version=1.3.8
2 changes: 2 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ addSbtPlugin("com.github.karasiq" % "sbt-scalajs-bundler" % "1.2.2")
// addSbtPlugin("pl.project13.sbt" % "sbt-jol" % "0.1.2")

addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.5.1")

libraryDependencies += "org.scala-lang.modules" %% "scala-xml" % "1.3.0"
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package com.karasiq.shadowcloud.storage.telegram

import java.io.{IOException, InputStream}
import java.io.{InputStream, IOException}
import java.nio.file._
import java.nio.file.attribute.BasicFileAttributes

import scala.util.Try

import akka.util.ByteString

import com.karasiq.shadowcloud.model.StorageId
import com.karasiq.shadowcloud.storage.telegram.TelegramStorageConfig.Secrets
import com.karasiq.shadowcloud.ui.UIProvider
Expand All @@ -17,7 +20,10 @@ object TelegramScripts {
extract(baseDir)
writeSecrets(baseDir, secrets)
uiProvider.showNotification(
s"Please run 'sudo pip3 install -r requirements.txt && python3 telegram_create_session.py' in $baseDir, then press OK"
s"""Please run following command in $baseDir, then press OK
|Linux/MacOS: sudo pip3 install -r requirements.txt && python3 telegram_create_session.py
|Windows: pip3 install -r requirements.txt && py telegram_create_session.py
|""".stripMargin
)
val result = readSession(baseDir, secrets.entity)
deleteDir(baseDir)
Expand Down Expand Up @@ -51,29 +57,33 @@ object TelegramScripts {
"telegram_create_session.py"
)
Files.createDirectories(directory)
files.foreach { f =>
files.foreach { f
val stream = getResource(s"tgcloud/$f")
try Files.copy(stream, directory.resolve(f))
finally stream.close()
}
}

def deleteDir(baseDir: Path): Unit = {
if (Files.isDirectory(baseDir))
Files.walkFileTree(
baseDir,
new SimpleFileVisitor[Path] {
override def visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult = {
Files.deleteIfExists(file)
FileVisitResult.CONTINUE
}
def doDelete(): Try[Unit] = Try {
if (Files.isDirectory(baseDir))
Files.walkFileTree(
baseDir,
new SimpleFileVisitor[Path] {
override def visitFile(file: Path, attrs: BasicFileAttributes): FileVisitResult = {
Files.deleteIfExists(file)
FileVisitResult.CONTINUE
}

override def postVisitDirectory(dir: Path, exc: IOException): FileVisitResult = {
Files.deleteIfExists(dir)
FileVisitResult.CONTINUE
override def postVisitDirectory(dir: Path, exc: IOException): FileVisitResult = {
Files.deleteIfExists(dir)
FileVisitResult.CONTINUE
}
}
}
)
)
}

doDelete().failed.foreach(_ sys.addShutdownHook(doDelete()))
}

def getResource(name: String): InputStream = {
Expand Down

0 comments on commit 69095a6

Please sign in to comment.