Skip to content

Commit

Permalink
[Fix] Files not found in deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
Raffy23 committed Sep 11, 2017
1 parent 6a8e94f commit bc5afee
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ follow theses steps:

- Execute following commands to Build the Javascript Client: `managerJS/fullOptJS`
- Copy `boinc-webmanager-opt.js` and `boinc-webmanager-jsdepts.min.js` into the `jvm/src/main/resources/web-root/` Folder
- Run sbt in Project folder and execute `assembly`, this wil build a Fat-Jar in the following Folder: `jvm/target/scala-1.12/`
- *(Optional) gzip the `*.js` Files to lower the amount of bytes which are transferred*
- Run sbt in Project folder and execute `managerJVM/assembly`, this wil build a Fat-Jar in the following Folder: `jvm/target/scala-1.12/`

## Installation
1. Extract the .zip or .tar.gz File to any Directory which is writable for the Application
Expand All @@ -36,7 +37,7 @@ Sample application.conf:
boinc-default-port: 31416
# True if the WebServer should run in development mode
development: false
# development: false
# Basic Settings of the Server
server {
Expand All @@ -52,7 +53,7 @@ server {
secret: "<some-long-secret>"
# The Path where the Files are served (Only needed in development mode)
#webroot: "./web/"
# webroot: "./web/"
# Certificate settings:
ssl {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ object WebResourcesRoute {
link( rel := "stylesheet", `type` := "text/css", href := "/files/css/font-awesome.min.css"),
link( rel := "stylesheet", `type` := "text/css", href := "/files/css/nprogress.css"),

script( `type` := "text/javascript", src := "/files/boinc-webmanager-jsdeps.js")
script( `type` := "text/javascript", src := "/files/app-jsdeps.js")
),

body(
div( id := "app-container",
p("Boinc Webmanager is loading ...")
),

script( `type` := "text/javascript", src := "/files/boinc-webmanager-fastopt.js"),
script( `type` := "text/javascript", src := "/files/app.js"),
script( `type` := "text/javascript", "Main.launch()" )
)
).render
Expand All @@ -61,6 +61,10 @@ object WebResourcesRoute {
// Normal index Page which is served
case GET -> Root => indexPage

case request@GET -> Root / "files" / "app.js" => completeWithGipFile(appJS, request)

case request@GET -> Root / "files" / "app-jsdeps.js" => completeWithGipFile(appDeptJS, request)

// Static File content from Web root
case request@GET -> "files" /: file => completeWithGipFile(file.toList.mkString("/"), request)

Expand All @@ -71,6 +75,13 @@ object WebResourcesRoute {
case _ => NotFound(/* TODO: Implement Default 404-Page */)
}

private def appJS(implicit config: Config): String =
if (config.development.getOrElse(false)) "boinc-webmanager-fastopt.js"
else "boinc-webmanager-opt.js"

private def appDeptJS(implicit config: Config): String =
if (config.development.getOrElse(false)) "boinc-webmanager-jsdeps.js"
else "boinc-webmanager-jsdeps.min.js"

private def fromResource(file: String, request: Request) =
StaticFile.fromResource("/web-root/" + file, Some(request))
Expand Down

0 comments on commit bc5afee

Please sign in to comment.