Skip to content

Commit

Permalink
- Some docs
Browse files Browse the repository at this point in the history
- Connect to localhost:9000 with gpcloud=emulator
  • Loading branch information
dbarashev committed Nov 7, 2023
1 parent b69b232 commit 5b1bb85
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 6 deletions.
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,12 @@ Visit http://ganttproject.biz to learn more.

## License
GanttProject is free and open-source software, distributed under GNU General Public License v3.

## Check out, build and run

Clone the repository using `git clone https://github.com/bardsoftware/ganttproject.git` and checkout the submodules
with `git submodule update` from the repository root.

You can build and run the core part of GanttProject, with no export/import features, using `gradle run`.

If you want to build the complete app, use `gradle runapp` or `gradle distbin && cd ganttproject-builder/dist-bin && ./ganttproject` (on Linux and macOS)
13 changes: 12 additions & 1 deletion cloud.ganttproject.colloboque/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,15 @@ It should print to the console something like
14:49:38.771 DEBUG [Startup @ main] - Starting dev Colloboque server on port 9000
14:49:38.883 DEBUG [Startup @ main] - Connected to the database. PostgreSQL 15.3 (Debian 15.3-1.pgdg120+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 12.2.0-14) 12.2.0, 64-bit
<=
```
```

## Building and running the client

Please refer to [GanttProject Docs](../README.md) for instructions on building and running GanttProject.
For Colloboque development purposes, running GanttProject with `gradle run` is okay: it will try to connect to
Colloboque server running on `localhost:9000` and will open a test document with a single task.

It is expected that two GanttProject instances will send their updates to the server, will receive the updates
from the server and immediately apply them. At the moment, the following update types are supported:

- adding a new task
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ class DevServerMain : CliktCommand() {
}

class ColloboqueHttpServer(port: Int, private val colloboqueServer: ColloboqueServer) : NanoHTTPD("localhost", port) {
override fun serve(session: IHTTPSession): Response =
when (session.uri) {
override fun serve(session: IHTTPSession): Response {
LOG.debug("${session.uri}")
return when (session.uri) {
"/init" -> {
session.parameters["projectRefid"]?.firstOrNull()?.let {
val projectXml =
Expand All @@ -83,25 +84,28 @@ class ColloboqueHttpServer(port: Int, private val colloboqueServer: ColloboqueSe
newFixedLengthResponse("Ok")
} ?: newFixedLengthResponse(Status.BAD_REQUEST, NanoHTTPD.MIME_PLAINTEXT, "projectRefid is missing")
}

"/" -> newFixedLengthResponse("Hello")
"/p/read" -> {
session.parameters["projectRefid"]?.firstOrNull()?.let {
val baseTxnId = colloboqueServer.getBaseTxnId(it) ?: run {
colloboqueServer.init(it, PROJECT_XML_TEMPLATE)
}

newFixedLengthResponse(PROJECT_XML_TEMPLATE.toBase64()).also {response ->
newFixedLengthResponse(PROJECT_XML_TEMPLATE.toBase64()).also { response ->
response.addHeader("ETag", "-1")
response.addHeader("Digest", CRC32().let {hash ->
response.addHeader("Digest", CRC32().let { hash ->
hash.update(PROJECT_XML_TEMPLATE.toByteArray())
hash.value.toString()
})
response.addHeader("BaseTxnId", baseTxnId)
}
} ?: newFixedLengthResponse(Status.BAD_REQUEST, NanoHTTPD.MIME_PLAINTEXT, "projectRefid is missing")
}

else -> newFixedLengthResponse(Status.NOT_FOUND, MIME_PLAINTEXT, "Not Found")
}
}
}

class ColloboqueWebSocketServer(port: Int, private val colloboqueServer: ColloboqueServer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ val GPCLOUD_PORT = when (cloudEnvironment) {
GPCloudEnv.LOCAL -> 80
else -> 443
}
val GPCLOUD_ORIGIN = "$GPCLOUD_SCHEME://$GPCLOUD_HOST" + if (cloudEnvironment == GPCloudEnv.LOCAL) ":$GPCLOUD_PORT" else ""
val GPCLOUD_ORIGIN = "$GPCLOUD_SCHEME://$GPCLOUD_HOST" + if (cloudEnvironment == GPCloudEnv.EMULATOR) ":$GPCLOUD_PORT" else ""
val GPCLOUD_PROJECT_READ_URL = "$GPCLOUD_ORIGIN/p/read"
val GPCLOUD_SIGNIN_URL = "$GPCLOUD_ORIGIN/__/auth/desktop"
val GPCLOUD_SIGNUP_URL = "$GPCLOUD_ORIGIN/__/auth/handler"
Expand Down

0 comments on commit 5b1bb85

Please sign in to comment.