Skip to content

Configurations

BX Zhang edited this page Mar 2, 2025 · 6 revisions

Server-side Configs

Configuration file is located at config/world-comment.json. An example of its contents:

{
  "imageUploadConfig": [
    {
      "service": "lsky",
      "apiUrl": "https://example.com/api/v1/upload",
      "apiToken": "810|YjsnP1yjSnPIYjsnP1yjSnPIYjsnP1yjSnPI",
      "albumId": 1919
    },
    {
      "service": "local"
    }
  ]
}

All fields are optional, just omit the ones you don't need.

Setting up Image Hosting

  • imageUploadConfig: Image upload configuration. Optional. A list describing the image hosting services to use.
    When multiple entries are specified, they are tried one by one by the client.
    If not specified, images will be stored inside your save folder by default.
    • "service": "local"
      Store the images directly on the server, into your save folder to be precise.
      Sending pictures over Minecraft game connection will take up some bandwidth, but should be usually not a bit deal. Use external hosting when profiling shows this is causing issues.
    • "service": "smms"
      Uploading to https://smms.app . Sign up an account there to obtain an API key.
      • "apiUrl": Base URL of the API. Optional. Defaults to "https://smms.app/api/v2/upload".
      • "apiToken": Your API key.
    • "service": "imgloc"
      Uploading to https://imgloc.com . Sign up an account there to obtain an API key. This hosting provider seems unreliable.
      • "apiUrl": Base URL of the API. Optional. Defaults to "https://imgloc.com/api/1/upload".
      • "apiToken": Your API key.
    • "service": "lsky"
      Uploading to a self-hosted Lsky Pro instance (https://github.com/lsky-org/lsky-pro). See their documentation for installation and API key configs.
      • "apiUrl": Base URL of the API, to the /upload endpoint. Should be similar to "https://xxxxxx.xxx/api/v1/upload".
      • "apiToken": Your API key. Should be similar to "1|XxxxxxXxxxxxXxx".
      • "albumId": The ID of the album to put the image into. Optional.

Marker Comment Types Permission

  • allowMarkerUsage:
    By default, WorldComment allows choosing between 4 "feeling" comment types and 4 "marker" comment types.
    The later four "marker" comment types are shown regardless of whether the player selected "Hide Comments".
    • op: Only allow operators (players with perm level 3, to be precise) to send marker comments.
    • creative: Only allow players currently in creative mode to send marker comments. This is the default setting.
    • all: Everyone can send marker comments.

(Advanced) Redis Synchronization

{
  ...

  "syncRole": "host",
  "redisUrl": "redis://localhost:6379"
}
  • syncRole: For syncing comments between multiple servers over Redis. Created for Teacon 2023 where they have a distributed configuration with lots of servers load-balanced through Bungeecord.
    • host: This server is the host, where comments are stored.
    • subordinate: This server does not store comments in its save file, but instead syncs them from and to the host.
  • redisUrl: The URL of the Redis server (in Lettuce way) to use for syncing comments.

(Advanced) HTTP Webhook Uplink

{
  ...
  
  "uplinkUrl": "https://example.domain/teacon2023/subnoteica_uplink.php",
  "uplinkAuthKey": "xxxxxxxxx"
}
  • uplinkUrl: The URL of the uplink script to use for syncing comments to a web server, in a webhook-ish fashion. If syncRole is used, each comment would be only sent once by the host server.
    This is used for syncing comments to a web server, so that they can be displayed on a website.
    The script will receive POST requests with a body like this:
      {
        "id": 1166045306574225400,
        "timestamp": 1698077265000,
        "level": "minecraft:overworld",
        "location": [0, 0, 0],
        "initiator": "00000000-0000-0000-0000-000000000000",
        "initiatorName": "",
        "messageType": 1,
        "message": "希望国产社区越来越好!!!!!!!!",
        "image": {
          "url": "",
          "thumb": ""
        },
        "like": 0,
        "deleted": false
      }
    The request will have an Authorization header with a value like NEX-HMAC-SHA1 Signature=xxxxxxxx, with the value being the SHA1 HMAC of the request body with the uplinkAuthKey as the key, encoded in Base64.
  • uplinkAuthKey: The key to use for the HMAC signature of the uplink request. This is used to prevent unauthorized access to the uplink script.

Environment variables

Alternatively, all config items can also be set with environment variables. For instance, imageUploadConfig can be set with SUBNOTEICA_IMAGE_UPLOAD_CONFIG. This can be useful if you are spinning up servers with Kubernetes.