0.15.0 • Published 1 year ago

@tamedjs/tm-sync v0.15.0

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

TM Sync

The TamedJs tool for syncing TM Drives.

Issues

  • The PEM Library will not work on OpenSSL beyond 1.1.1g.
  • This means when placing on an OS (like Ubuntu past 20.04) you will get newever versions of OpenSSL.
  • Droplets on DigitalOcean can cause issues using npm install where the binary detects root acess. Use yarn global add @tamedjs/tm-sync instead.

Testing System

Below is an example of how to test tm-sync locally running the tmsync command. It requires starting two tm-sync hubs that can communicate with one another.

# Start hub 1, note the testing arguments
tmsync --testing true --testfiles true --user @test1 --port 9000

# Start hub 2 that will connect to hub 1
tmsync --testing true --user @test2 --port 9001 --hubs https://localhost:9000

---

# RESTFUL API Calls

---
# Check the folders for the hub at port 9000
request:
POST https://localhost:9000/_tm/api/tm-sync/scan
{
	"depth": 1,
	"target": "@test1/public/sample"
}
reply:
{
  "code": 200,
  "message": "ok",
  "result": [
    "@test1/public/sample/image.png",
    "@test1/public/sample/test.txt"
  ]
}

---
Send details on file to be synced with other hubs
request:
POST https://localhost:9000/_tm/api/tm-sync/sync
{
	"target": "@test1/public/sample/image.png"
}
reply:
{
    "code": 201,
    "message": "created"
}

---
Check if a path is valid
request:
POST https://localhost:9000/_tm/api/tm-sync/path
  // for dir (NOTE: probably just make this one command...)
  {
    "target": "@test1/public/sample/image.png",
    "isDir": true
  }

  // for files
  {
    "target": "@test1/public/sample/image.png"
  }
reply:
{
  "code": 200,
  "message": "ok"
}

TODO

  • Allow the path checking work the same for a file or directory (remove isDir)
  • Version the api routes
  • Version the payload responses

Resource