Django CMS Application hosted at libre.audio root. https://libre.audio
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

serve.cmd 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. :: This script allows you to serve different TiddlyWiki editions.
  2. ::
  3. :: It respects a TW_SERVE_EDITION_PATH environment variable.
  4. :: If this variable is set it will be used. A command line parameter will overwrite it.
  5. ::
  6. :: Ensure your server tiddlywiki.info configuration contains
  7. :: these plugins, otherwise saving is not possible:
  8. :: - "tiddlywiki/tiddlyweb"
  9. :: - "tiddlywiki/filesystem"
  10. @echo off
  11. echo.
  12. :: Help Wanted!!
  13. :: If you know how to improve -help and -version handling let us know
  14. if "%1" == "--help" call :help
  15. if "%1" == "-h" call :help
  16. if "%1" == "--version" call :version
  17. if "%1" == "-v" call :version
  18. if "%1" == "help" (
  19. call :help
  20. ) else (
  21. call :main %1 %2 %3 %4 %5
  22. )
  23. exit 0
  24. :version
  25. echo TiddlyWiki serve.cmd script version 0.0.2"
  26. echo.
  27. exit 0
  28. goto:eof
  29. :help
  30. echo Serve TiddlyWiki over HTTP
  31. echo.
  32. echo Optional parameters
  33. echo - %%1 .. edition directory .. full or relative path to edition directory
  34. echo - %%2 .. username .. for signing edits - can be empty like this: '""'
  35. echo - %%3 .. password .. can be empty like this: '""'
  36. echo - %%4 .. IP address or HOST .. defaults to localhost
  37. echo - %%5 .. PORT .. defaults to 8080
  38. echo.
  39. echo Example 1 .\serve .\editions\tw5.com-server username
  40. echo Example 2 .\serve .\editions\tw5.com-server '""' '""' localhost 9090
  41. echo .. Example 2 defines: empty username, empty password
  42. echo.
  43. echo Help information
  44. echo -v, --version .. shows the script version
  45. echo -h, --help, help .. shows this help information
  46. echo.
  47. exit 0
  48. goto:eof
  49. :main
  50. if [%1] NEQ [] (
  51. :: if there is a editions parameter .. use it.
  52. set TW_SERVE_EDITION_PATH=%1
  53. ) else (
  54. if [%TW_SERVE_EDITION_PATH%] == [] (
  55. echo Please provide an edition path as your first parameter or
  56. echo define a valid TW_SERVE_EDITION_PATH environment variable.
  57. echo.
  58. echo Using default edition path 'editions\tw5.com-server' because no environment variable is set
  59. echo.
  60. set TW_SERVE_EDITION_PATH= editions\tw5.com-server
  61. )
  62. )
  63. :: The editions path must exist!
  64. if not exist %TW_SERVE_EDITION_PATH%\nul (
  65. echo The Path: "%TW_SERVE_EDITION_PATH%" does not exist
  66. exit 1
  67. )
  68. if [%5] == [] (
  69. echo Using default port 8080
  70. set PORT=8080
  71. ) else (
  72. echo Using port %5
  73. set PORT=%5
  74. )
  75. echo Using edition: %TW_SERVE_EDITION_PATH%
  76. echo.
  77. node .\tiddlywiki.js ^
  78. %TW_SERVE_EDITION_PATH% ^
  79. --verbose ^
  80. --server %PORT% $:/core/save/all text/plain text/html %2 %3 %4^
  81. || exit 1
  82. goto:eof