Skip to content

Commit

Permalink
Merge pull request #76 from sakura-tel/sakura-tel/develop
Browse files Browse the repository at this point in the history
Release 2022.07.03-milkey-3.2
  • Loading branch information
atsu1125 authored Aug 17, 2024
2 parents 33256ed + c34d22b commit 2f4e828
Show file tree
Hide file tree
Showing 32 changed files with 456 additions and 87 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,41 @@ jobs:
build:
runs-on: ubuntu-latest

services:
postgres:
image: postgres:12.2-alpine
ports:
- 54355:5432
env:
POSTGRES_DB: test-misskey
POSTGRES_HOST_AUTH_METHOD: trust
redis:
image: redis:4.0-alpine
ports:
- 56312:6379

steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build . --file Dockerfile --tag my-image-name
- run: docker image ls my-image-name
- run: docker history my-image-name
- name: Copy Configure
run: cp test/test.yml .config/default.yml
- name: Start Docker container
run: |
docker run -d --net=host -v ./.config:/misskey/.config:ro --name my-container my-image-name
sleep 60
- name: Check Docker container logs
run: docker logs my-container
- name: Test HTTP request to container
run: |
response=$(curl --retry 10 -X POST -s -o /dev/null -w "%{http_code}" http://localhost:61812/api/notes/local-timeline)
if [ $response -eq 200 ]; then
echo "HTTP request successful. Status code: $response"
else
echo "HTTP request failed with status code: $response"
exit 1
fi
- name: Stop Docker container
run: docker stop my-container
2 changes: 1 addition & 1 deletion .node-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v16.20.2
v18.20.4
9 changes: 6 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16.20.2-bullseye AS builder
FROM node:18.20.4-bullseye AS builder

ENV NODE_ENV=production
WORKDIR /misskey
Expand All @@ -12,19 +12,22 @@ COPY . ./
RUN yarn build


FROM node:16.20.2-bullseye-slim AS runner
FROM node:18.20.4-bullseye-slim AS runner

WORKDIR /misskey

RUN apt-get update \
&& apt-get install -y --no-install-recommends ffmpeg tini \
&& apt-get install -y --no-install-recommends \
ffmpeg tini curl libjemalloc-dev libjemalloc2 \
&& ln -s /usr/lib/$(uname -m)-linux-gnu/libjemalloc.so.2 /usr/local/lib/libjemalloc.so \
&& apt-get -y clean \
&& rm -rf /var/lib/apt/lists/*

COPY --from=builder /misskey/node_modules ./node_modules
COPY --from=builder /misskey/built ./built
COPY . ./

ENV LD_PRELOAD=/usr/local/lib/libjemalloc.so
ENV NODE_ENV=production
ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["npm", "run", "migrateandstart"]
3 changes: 0 additions & 3 deletions README-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,6 @@ Groundpolis (通称グランポリス)は、 [Misskey](https://github.com/misske
最新情報を Milkey 公式アカウントで呟いています。
- [@Milkey221B@milkey.homes](https://milkey.homes/@Milkey221B)

Groundpolis の最新情報はこちら。
- [@dev@groundpolis.app](https://groundpolis.app/@dev)

文書
--------
開発者、サーバー運用者向けドキュメントは[Wiki](https://github.com/sakura-tel/milkey/wiki)にあります。
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ News
--------
Check the latest information on the official account.
- [@Milkey221B@milkey.homes](https://milkey.homes/@Milkey221B)
- [@dev@groundpolis.app](https://groundpolis.app/@dev)

Documentation
---------
Expand Down
1 change: 1 addition & 0 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,7 @@ invitationRequiredToRegister: "This server is currently invitation only. Only th
themeColor: "Theme Color"
preferTickerSoftwareColor: "Prefer Software Color on instance ticker"
typeToConfirm: "Please enter {x} to confirm"
rateLimitExceeded: "Rate limit exceeded"

_template:
edit: "Edit Template..."
Expand Down
1 change: 1 addition & 0 deletions locales/ja-JP.yml
Original file line number Diff line number Diff line change
Expand Up @@ -919,6 +919,7 @@ notSpecifiedMentionWarning: "宛先に含まれていないメンションがあ
themeColor: "テーマカラー"
preferTickerSoftwareColor: "インスタンスティッカーにソフトウェアカラーを採用して表示する"
typeToConfirm: "この操作を行うには {x} と入力してください"
rateLimitExceeded: "レート制限を超えました"

_template:
edit: "定型文を編集…"
Expand Down
14 changes: 14 additions & 0 deletions migration/1702199825139-addpartialindexforlocalnote.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import {MigrationInterface, QueryRunner} from "typeorm";

export class addpartialindexforlocalnote1702199825139 implements MigrationInterface {
name = 'addpartialindexforlocalnote1702199825139'

public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE INDEX IF NOT EXISTS idx_partial_local_noteid on note (id) WHERE "userHost" IS NULL`, undefined);
}

public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`DROP INDEX "public"."idx_partial_local_noteid"`, undefined);
}

}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "groundpolis-milkey",
"version": "2022.07.03-milkey-3.1",
"version": "2022.07.03-milkey-3.2",
"private": true,
"author": "Xeltica <xeltica@gmail.com> , Minemu <minemu398@outlook.jp> , Azuki⪥ <cluikeit_31701@outlook.com> , Remito <remitocat@gmail.com> , atsu1125 <atsuchan@atsuchan.page>",
"contributors": [
Expand Down
2 changes: 1 addition & 1 deletion src/client/pages/about-misskey.vue
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
</FormGroup>
<FormGroup>
<template #label>{{ $ts._aboutMisskey.contributors }}</template>
<FormLink to="https://github.com/Xeltica" external>@Xeltica</FormLink>
<FormLink to="https://github.com/EbiseLutica" external>@EbiseLutica</FormLink>
<FormLink to="https://github.com/m-hayabusa" external>@m-hayabusa</FormLink>
<FormLink to="https://github.com/remitocat" external>@remitocat</FormLink>
<FormLink to="https://github.com/mei23" external>@mei23</FormLink>
Expand Down
63 changes: 61 additions & 2 deletions src/client/pages/instance/user-dialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,18 +47,34 @@
<pre><code>{{ JSON.stringify(info, null, 2) }}</code></pre>
</details>
</div>
<div class="_section" v-if="user.host == null && ($i.isAdmin || $i.isModerator)">
<FormPagination :pagination="pagination">
<template #label>{{ $ts.signinHistory }}</template>
<template #default="{items}">
<div class="_formPanel timnmucd" v-for="item in items" :key="item.id">
<header>
<Fa class="icon succ" :icon="faCheck" v-if="item.success"/>
<Fa class="icon fail" :icon="faTimesCircle" v-else/>
<code class="ip _monospace">{{ item.ip }}</code>
<MkTime :time="item.createdAt" class="time"/>
</header>
</div>
</template>
</FormPagination>
</div>
</div>
</XModalWindow>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import { faTimes, faBookmark, faKey, faSync, faMicrophoneSlash, faExternalLinkSquareAlt, faCrown, } from '@fortawesome/free-solid-svg-icons';
import { faTimes, faBookmark, faKey, faSync, faMicrophoneSlash, faExternalLinkSquareAlt, faCrown, faCheck, faTimesCircle, } from '@fortawesome/free-solid-svg-icons';
import { faSnowflake, faTrashAlt, faBookmark as farBookmark } from '@fortawesome/free-regular-svg-icons';
import MkButton from '@/components/ui/button.vue';
import MkSwitch from '@/components/ui/switch.vue';
import GpVerified from '@/components/verified.vue';
import XModalWindow from '@/components/ui/modal-window.vue';
import FormPagination from '@/components/form/pagination.vue';
import Progress from '@/scripts/loading';
import { acct, userPage } from '../../filters/user';
import * as os from '@/os';
Expand All @@ -70,6 +86,7 @@ export default defineComponent({
MkSwitch,
GpVerified,
XModalWindow,
FormPagination,
},
props: {
Expand All @@ -89,7 +106,14 @@ export default defineComponent({
suspended: false,
verified: false,
premium: false,
faTimes, faBookmark, farBookmark, faKey, faSync, faMicrophoneSlash, faSnowflake, faTrashAlt, faExternalLinkSquareAlt, faCrown,
faTimes, faBookmark, farBookmark, faKey, faSync, faMicrophoneSlash, faSnowflake, faTrashAlt, faExternalLinkSquareAlt, faCrown, faCheck, faTimesCircle,
pagination: {
endpoint: 'admin/show-user-signins',
limit: 5,
params: () => ({
userId: this.user.id,
}),
},
};
},
Expand Down Expand Up @@ -293,4 +317,39 @@ export default defineComponent({
}
}
}
.timnmucd {
padding: 16px;
> header {
display: flex;
align-items: center;
> .icon {
width: 1em;
margin-right: 0.75em;
&.succ {
color: var(--success);
}
&.fail {
color: var(--error);
}
}
> .ip {
flex: 1;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
margin-right: 12px;
}
> .time {
margin-left: auto;
opacity: 0.7;
}
}
}
</style>
4 changes: 2 additions & 2 deletions src/client/ui/default.widgets.vue
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@ export default defineComponent({
});
if (canceled) return;
this.$store.set('widgets', [...this.$store.state.widgets, {
this.$store.set('widgets', [{
name: widget,
id: uuid(),
place: null,
data: {}
}]);
}, ...this.$store.state.widgets]);
},
removeWidget(widget) {
Expand Down
4 changes: 2 additions & 2 deletions src/client/widgets/server-metric/cpu-mem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default defineComponent({
if (this.stats.length > 50) this.stats.shift();
const cpuPolylinePoints = this.stats.map((s, i) => [this.viewBoxX - ((this.stats.length - 1) - i), (1 - s.cpu) * this.viewBoxY]);
const memPolylinePoints = this.stats.map((s, i) => [this.viewBoxX - ((this.stats.length - 1) - i), (1 - (s.mem.used / this.meta.mem.total)) * this.viewBoxY]);
const memPolylinePoints = this.stats.map((s, i) => [this.viewBoxX - ((this.stats.length - 1) - i), (1 - (s.mem.active / this.meta.mem.total)) * this.viewBoxY]);
this.cpuPolylinePoints = cpuPolylinePoints.map(xy => `${xy[0]},${xy[1]}`).join(' ');
this.memPolylinePoints = memPolylinePoints.map(xy => `${xy[0]},${xy[1]}`).join(' ');
Expand All @@ -133,7 +133,7 @@ export default defineComponent({
this.memHeadY = memPolylinePoints[memPolylinePoints.length - 1][1];
this.cpuP = (stats.cpu * 100).toFixed(0);
this.memP = (stats.mem.used / this.meta.mem.total * 100).toFixed(0);
this.memP = (stats.mem.active / this.meta.mem.total * 100).toFixed(0);
},
onStatsLog(statsLog) {
for (const stats of [...statsLog].reverse()) {
Expand Down
6 changes: 3 additions & 3 deletions src/client/widgets/server-metric/mem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ export default defineComponent({
},
methods: {
onStats(stats) {
this.usage = stats.mem.used / this.meta.mem.total;
this.usage = stats.mem.active / this.meta.mem.total;
this.total = this.meta.mem.total;
this.used = stats.mem.used;
this.free = this.meta.mem.total - stats.mem.used;
this.used = stats.mem.active;
this.free = this.meta.mem.total - stats.mem.active;
},
bytes
}
Expand Down
6 changes: 2 additions & 4 deletions src/daemons/server-stats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default function() {
const stats = {
cpu: roundCpu(cpu),
mem: {
used: round(memStats.used),
used: round(memStats.used - memStats.buffers - memStats.cached),
active: round(memStats.active),
},
net: {
Expand All @@ -46,8 +46,6 @@ export default function() {
if (log.length > 200) log.pop();
}

if (config.hideServerInfo) return;

tick();

setInterval(tick, interval);
Expand Down Expand Up @@ -78,5 +76,5 @@ async function net() {
// FS STAT
async function fs() {
const data = await si.disksIO().catch(() => ({ rIO_sec: 0, wIO_sec: 0 }));
return data;
return data || { rIO_sec: 0, wIO_sec: 0 };
}
6 changes: 3 additions & 3 deletions src/misc/download-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as fs from 'fs';
import * as stream from 'stream';
import * as util from 'util';
import got, * as Got from 'got';
import { httpAgent, httpsAgent, StatusError } from './fetch';
import { getAgentByUrl, httpAgent, httpsAgent, StatusError } from './fetch';
import config from '../config';
import * as chalk from 'chalk';
import Logger from '../services/logger';
Expand Down Expand Up @@ -40,8 +40,8 @@ export async function downloadUrl(url: string, path: string) {
request: operationTimeout, // whole operation timeout
},
agent: {
http: httpAgent,
https: httpsAgent,
http: getAgentByUrl(new URL(url)),
https: getAgentByUrl(new URL(url)) as any,
},
http2: false, // default
retry: {
Expand Down
9 changes: 9 additions & 0 deletions src/misc/get-ip-hash.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import * as IPCIDR from 'ip-cidr';

export function getIpHash(ip: string) {
// because a single person may control many IPv6 addresses,
// only a /64 subnet prefix of any IP will be taken into account.
// (this means for IPv4 the entire address is used)
const prefix = IPCIDR.createAddress(ip).mask(64);
return 'ip-' + BigInt('0b' + prefix).toString(36);
}
Loading

0 comments on commit 2f4e828

Please sign in to comment.