Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions .github/workflows/check-schema.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Check Config Schema

on:
pull_request:

jobs:
check-schema:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v6

- name: Setup Node.js
uses: actions/setup-node@v6
with:
node-version: '20'

- name: Install dependencies
run: npm ci

- name: Generate JSON Schema from config.d.ts
run: npm run generate-schema

- name: Check for changes
run: |
git diff --exit-code config.schema.json
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ node_modules
/src/assets/emoji_altname_table.json
/src/assets/unicode_emojis.json
/public/new-relic.js
*.schema.json
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,25 @@ traQ allows ease communication among team members by organizing contexts into tr

## Deployment

### Using Docker

When deploying using Docker, you can mount `config.json` externally:

```bash
docker run -d \
-p 80:80 \
-v /path/to/your/config.json:/app/override/config.json \
traq-ui:latest
```

See [`config.json` in the manifest repository](https://github.com/traPtitech/manifest/blob/main/traq/frontend/config.json) for an example.
You can also mount a `config.js` file at `/app/override/config.js` instead for backward compatibility, and it will be automatically converted to `config.js` at runtime.
Please note that if both `config.js` and `config.json` are mounted, `config.js` will be ignored and overwritten by the mapped `config.json`.

Refer to [`config.d.ts`](./config.d.ts) for the TypeScript type definition and [`config.schema.json`](./config.schema.json) for the JSON Schema.

### Other Deployment Methods

If you want to deploy your own instance of traQ, then follow the instructions in backend [deployment.md](https://github.com/traPtitech/traQ/blob/master/docs/deployment.md).

## Development
Expand Down
40 changes: 28 additions & 12 deletions build/docker/startup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,24 @@ echo "Startup: check override files"

ls /app/override/* >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Startup: copy override files"
cp -r -L /app/override/* /usr/share/caddy
echo "Startup: copy override files"
cp -r -L /app/override/* /usr/share/caddy
fi

###
# config.jsonからconfig.jsへの変換
###
if [ -f /app/override/config.json ]; then
if [ -f /app/override/config.js ]; then
echo "WARNING: Both config.json and config.js are mounted at /app/override/"
echo "WARNING: config.js will be ignored and overwritten by the mapped config.json"
fi
echo "Startup: converting config.json to config.js"
{
echo ";(() => { self.traQConfig = "
cat /app/override/config.json
echo " })()"
} > /usr/share/caddy/config.js
fi

###
Expand All @@ -35,17 +51,17 @@ sed -i -e "s/#0D67EA/$THEME_COLOR/g" /usr/share/caddy/index.html
# New Relic 設定
###
if [ -n "$NEW_RELIC_LICENSE_KEY" ] && [ -n "$NEW_RELIC_ACCOUNT_ID" ] && [ -n "$NEW_RELIC_TRUST_KEY" ] && [ -n "$NEW_RELIC_AGENT_ID" ] && [ -n "$NEW_RELIC_APPLICATION_ID" ]; then
echo "Startup: set up New Relic"
sed -i -e "s/LICENSE_KEY_PLACEHOLDER/$NEW_RELIC_LICENSE_KEY/g" /usr/share/caddy/new-relic.js
sed -i -e "s/ACCOUNT_ID_PLACEHOLDER/$NEW_RELIC_ACCOUNT_ID/g" /usr/share/caddy/new-relic.js
sed -i -e "s/TRUST_KEY_PLACEHOLDER/$NEW_RELIC_TRUST_KEY/g" /usr/share/caddy/new-relic.js
sed -i -e "s/AGENT_ID_PLACEHOLDER/$NEW_RELIC_AGENT_ID/g" /usr/share/caddy/new-relic.js
sed -i -e "s/APPLICATION_ID_PLACEHOLDER/$NEW_RELIC_APPLICATION_ID/g" /usr/share/caddy/new-relic.js
CACHE_KEY=$(md5sum /usr/share/caddy/new-relic.js | cut -d ' ' -f 1)
mv /usr/share/caddy/new-relic.js /usr/share/caddy/new-relic-$CACHE_KEY.js
sed -i -e "s/<!-- <script src=\"\/new-relic-{hash}.js\"><\/script> -->/<script src=\"\/new-relic-$CACHE_KEY.js\"><\/script>/" /usr/share/caddy/index.html
echo "Startup: set up New Relic"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

なんか format がかかっちゃってる?理由がなければ戻してほしいかも

sed -i -e "s/LICENSE_KEY_PLACEHOLDER/$NEW_RELIC_LICENSE_KEY/g" /usr/share/caddy/new-relic.js
sed -i -e "s/ACCOUNT_ID_PLACEHOLDER/$NEW_RELIC_ACCOUNT_ID/g" /usr/share/caddy/new-relic.js
sed -i -e "s/TRUST_KEY_PLACEHOLDER/$NEW_RELIC_TRUST_KEY/g" /usr/share/caddy/new-relic.js
sed -i -e "s/AGENT_ID_PLACEHOLDER/$NEW_RELIC_AGENT_ID/g" /usr/share/caddy/new-relic.js
sed -i -e "s/APPLICATION_ID_PLACEHOLDER/$NEW_RELIC_APPLICATION_ID/g" /usr/share/caddy/new-relic.js
CACHE_KEY=$(md5sum /usr/share/caddy/new-relic.js | cut -d ' ' -f 1)
mv /usr/share/caddy/new-relic.js /usr/share/caddy/new-relic-$CACHE_KEY.js
sed -i -e "s/<!-- <script src=\"\/new-relic-{hash}.js\"><\/script> -->/<script src=\"\/new-relic-$CACHE_KEY.js\"><\/script>/" /usr/share/caddy/index.html
else
echo "Startup: New Relic is not configured"
echo "Startup: New Relic is not configured"
fi

###
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions config.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"$schema":"http://json-schema.org/draft-07/schema#","type":"object","properties":{"name":{"type":"string","description":"アプリ名 省略時、空文字列時は`'traQ'`"},"firebase":{"type":"object","properties":{"apiKey":{"type":"string"},"appId":{"type":"string"},"projectId":{"type":"string"},"messagingSenderId":{"type":"string"},"vapidKey":{"type":"string","description":"https://firebase.google.com/docs/cloud-messaging/js/client#configure_web_credentials_with_fcm"}},"required":["apiKey","appId","projectId","messagingSenderId","vapidKey"],"additionalProperties":false,"description":"Firebase用設定 省略時は通知機能を無効化 https://firebase.google.com/docs/web/learn-more#config-object"},"enableQall":{"type":"boolean","description":"Qall機能を有効化するかどうか 省略時は無効化"},"enableSearch":{"type":"boolean","description":"検索機能を有効化するかどうか 省略時は無効化"},"services":{"type":"array","items":{"type":"object","properties":{"label":{"type":"string","description":"表示名"},"iconPath":{"type":"string","description":"`/img/services`からのアイコンへのパス(拡張子含む)"},"appLink":{"type":"string","description":"リンク先"}},"required":["label","iconPath","appLink"],"additionalProperties":false},"description":"アプリ一覧に表示されるサービス 省略時はアプリ一覧ボタンを非表示にする"},"ogpIgnoreHostNames":{"type":"array","items":{"type":"string"},"description":"OGPが表示されないようにするホスト 省略時は、すべてのホストのOGPを表示する"},"wikiPageOrigin":{"type":"string","description":"Wikiのユーザーページへのリンク undefinedにするとリンクが表示されない"},"blogPagePrefix":{"type":"string","description":"ブログの投稿者ページへのリンク undefinedにするとリンクが表示されない"},"auth":{"type":"object","properties":{"resetLink":{"type":"string","description":"ログイン画面での「パスワードを忘れた」のリンクのリンク先"},"changeLink":{"type":"string","description":"設定画面での「パスワードは~から可能です」のリンクのリンク先"},"changeName":{"type":"string","description":"設定画面での「パスワードは~から可能です」の「~」の表示"}},"required":["resetLink","changeLink","changeName"],"additionalProperties":false,"description":"外部認証が有効の場合の設定 省略時は各種リンクが表示されない"},"isRootChannelSelectableAsParentChannel":{"type":"boolean","description":"チャンネル変更権限をもっていないユーザーでも チャンネル作成時に親チャンネルとしてrootを選択可能にする サーバーでははじいていないので、APIをたたけば誰でも可能"},"tooLargeFileMessage":{"type":"string","description":"大きなファイルサイズのファイルを送信した際に表示される補足メッセージ `%s`の部分には「画像」または「ファイル」が入る","default":"大きい%sの共有には別のサービスを利用してください。"},"showWidgetCopyButton":{"type":"boolean","description":"iframe埋め込みウィジェットのコピーボタンの有効化 同じドメインの/widget/以下にtraQ-Widgetがデプロイされていることが前提 省略時は`false`"},"inlineReplyDisableChannels":{"type":"array","items":{"type":"string"},"description":"通知でのインライン返信を無効化するチャンネル 省略時はどのチャンネルも無効化しない","examples":[["#general","#random"]]},"iosPwaInfoLink":{"type":"string","description":"iOSアプリの廃止告知バナーに載せるPWAについてのリンク 省略時はリンクへの誘導テキストが載らない"},"defaultChannelId":{"anyOf":[{"type":"string"},{"type":"array","items":{"type":"string"}}],"description":"デフォルトチャンネルのチャンネル ID 起動時チャンネルが 設定されていない / 見つからない / 解決できない 場合に使用される 配列を与えた場合は先頭から優先して考慮され,最初に見つかったチャンネルが使用される 省略時は fallbackChannelPath にフォールバックする"},"fallbackChannelPath":{"type":"string","description":"どうしてもパスを解決できなかった場合など,最後に使用されるフォールバック (ID ではなくパス) `defaultChannelId` が設定されている場合はそちらが優先される 省略時は空文字列(チャンネルが選択されていない状態)","examples":["general"]},"$schema":{"type":"string"}},"required":["isRootChannelSelectableAsParentChannel"],"additionalProperties":false,"definitions":{}}
145 changes: 142 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
"type-check:test": "tsc --noEmit --project tests/unit/tsconfig.json && tsc --noEmit --project tests/e2e/tsconfig.json",
"gen-fonts": "node build/gen-mplus.js",
"gen-unicode_emojis": "node build/gen-unicode_emojis.js",
"generate-schema": "node scripts/generate-schema.js",
"localhost-certs:gen": "./build/gen-localhost-certs.sh",
"localhost-certs:rem": "rm -rf ./.certs",
"postinstall": "patch-package",
Expand Down Expand Up @@ -103,6 +104,7 @@
"rollup-plugin-brotli": "^3.1.0",
"sass": "^1.97.3",
"start-server-and-test": "^2.1.3",
"ts-json-schema-generator": "^2.4.0",
"typescript": "^5.9.3",
"vite": "^7.3.1",
"vite-plugin-pwa": "^1.2.0",
Expand Down
Loading
Loading