Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: 13.11.1 #10543

Merged
merged 19 commits into from
Apr 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
e58b357
fix(client): PWA時の絵文字ピッカーの位置をホームバーに重ならないように調整 (#10534)
takeyaqa Apr 8, 2023
7a33c5d
update CHANGELOG.md
tamaina Apr 8, 2023
d76220c
fix(server): IdService.parseを全てのidタイプに対応させるように (#10533)
tamaina Apr 8, 2023
64597a2
Update CHANGELOG.md
syuilo Apr 8, 2023
038365b
fix: redis から取得できないチャンネル投稿はDBから取得 (#10539)
futchitwo Apr 8, 2023
b7ed3dd
fix(backend): 通知読み込みでエラーが発生する場合がある問題を修正
syuilo Apr 8, 2023
f794f3a
fix(client): リスト、クリップが無限ロードされる現象の解決 (#10538)
tai-cha Apr 8, 2023
ad40067
チャンネルのお気に入りが無限に読み込まれる問題を修正
syuilo Apr 8, 2023
9ae2e87
Update CHANGELOG.md
syuilo Apr 8, 2023
004ace3
さがすのローカルユーザー(ピンどめ)が無限に生成される問題を修正
syuilo Apr 8, 2023
cb3a84a
チャンネルを新規作成できない問題を修正
syuilo Apr 8, 2023
087da76
Update CHANGELOG.md
syuilo Apr 8, 2023
b9d022f
New Crowdin updates (#10522)
syuilo Apr 9, 2023
31ff3a2
13.11.1
syuilo Apr 9, 2023
269d1e7
fix(frontend): ユーザープレビューが表示されない問題を修正
syuilo Apr 9, 2023
9feb6b0
fix(server): リアクションできない問題をとりあえず修正 (#10529)
tamaina Apr 9, 2023
1057da1
add note
syuilo Apr 9, 2023
86de46d
Update CHANGELOG.md
syuilo Apr 9, 2023
59d0d50
fix(backend): 連合しているインスタンスについて予期せず配送が全て停止されることがある問題を修正
syuilo Apr 9, 2023
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
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,26 @@

-->

## 13.11.1

### General
- チャンネルの投稿を過去までさかのぼれるように

### Client
- PWA時の絵文字ピッカーの位置をホームバーに重ならないように調整
- リスト管理の画面でリストが無限に読み込まれる問題を修正
- 自分のクリップが無限に読み込まれる問題を修正
- チャンネルのお気に入りが無限に読み込まれる問題を修正
- さがすのローカルユーザー(ピンどめ)が無限に生成される問題を修正
- チャンネルを新規作成できない問題を修正
- ユーザープレビューが表示されない問題を修正

### Server
- 通知読み込みでエラーが発生する場合がある問題を修正
- リアクションできないことがある問題を修正
- IDをaid以外に設定している場合の問題を修正
- 連合しているインスタンスについて予期せず配送が全て停止されることがある問題を修正

## 13.11.0

### NOTE
Expand All @@ -20,6 +40,7 @@

### General
- チャンネルをお気に入りに登録できるように
- タイムラインのアンテナ選択などでは、フォローしているアンテナの代わりにお気に入りしたアンテナが表示されるようになっています。チャンネルをお気に入りに登録するには、当該チャンネルのページ→概要→⭐️のボタンを押します。
- チャンネルにノートをピン留めできるように

### Client
Expand Down
4 changes: 2 additions & 2 deletions locales/de-DE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ instanceInfo: "Instanzinformationen"
statistics: "Statistiken"
clearQueue: "Warteschlange leeren"
clearQueueConfirmTitle: "Möchtest du die Warteschlange wirklich leeren?"
clearQueueConfirmText: "Hierdurch werden jegliche noch nicht gesendete Notizen nicht förderiert. Normalerweise wird dies nicht benötigt."
clearQueueConfirmText: "Hierdurch werden jegliche noch nicht gesendete Notizen nicht föderiert. Normalerweise wird dies nicht benötigt."
clearCachedFiles: "Cache leeren"
clearCachedFilesConfirm: "Sollen alle im Cache gespeicherten Dateien von anderen Instanzen wirklich gelöscht werden?"
blockedInstances: "Blockierte Instanzen"
Expand Down Expand Up @@ -1696,7 +1696,7 @@ _visibility:
followersDescription: "Nur für Follower sichtbar"
specified: "Direkt"
specifiedDescription: "Nur für bestimmte Benutzer sichtbar"
disableFederation: "Deförderiert"
disableFederation: "Deföderieren"
disableFederationDescription: "Nicht an andere Instanzen übertragen"
_postForm:
replyPlaceholder: "Dieser Notiz antworten …"
Expand Down
3 changes: 1 addition & 2 deletions locales/en-US.yml
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,6 @@ _accountMigration:
moveFromLabel: "Account to move from:"
moveFromDescription: "Create an alias for the account to move from on this account if you wish to transfer its followers. This has to be done before the transfer! Then, enter the account to move to in the following format: @[email protected]"
migrationConfirm: "Really migrate this account to {account}? Once started, this process cannot be stopped or taken back, and you will not be able to use this account in its original state anymore.\n\nAlso, confirm you've created an alias at the account to migrate to."

_achievements:
earnedAt: "Unlocked at"
_types:
Expand Down Expand Up @@ -1697,7 +1696,7 @@ _visibility:
followersDescription: "Make visible to your followers only"
specified: "Direct"
specifiedDescription: "Make visible for specified users only"
disableFederation: "Unfederated"
disableFederation: "Defederate"
disableFederationDescription: "Don't transmit to other instances"
_postForm:
replyPlaceholder: "Reply to this note..."
Expand Down
29 changes: 22 additions & 7 deletions locales/it-IT.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ proxyAccountDescription: "Un profilo proxy funziona come follower per i profili
host: "Server remoto"
selectUser: "Seleziona profilo"
recipient: "Destinatario"
annotation: "Annotazione"
annotation: "Annotazione preventiva"
federation: "Federazione"
instances: "Istanza"
registeredAt: "Registrato presso"
Expand Down Expand Up @@ -506,6 +506,7 @@ objectStorageUseSSLDesc: "Disabilita quest'opzione se non utilizzi HTTPS per le
objectStorageUseProxy: "Usa proxy"
objectStorageUseProxyDesc: "Disabilita quest'opzione se non usi proxy per la connessione API."
objectStorageSetPublicRead: "Imposta \"visibilità pubblica\" al momento di caricare"
s3ForcePathStyleDesc: "L'attivazione di s3ForcePathStyle impone di specificare il nome del bucket come parte del percorso nell'URL anziché del nome host. Potrebbe tornare utile quando si utilizzano applicazioni come Minio."
serverLogs: "Log del server"
deleteAll: "Cancella cronologia"
showFixedPostForm: "Visualizzare la finestra di pubblicazione in cima alla timeline"
Expand Down Expand Up @@ -564,7 +565,7 @@ invisibleNote: "Nota invisibile"
enableInfiniteScroll: "Abilita scorrimento infinito"
visibility: "Visibilità"
poll: "Sondaggio"
useCw: "Nascondere media"
useCw: "Content Warning"
enablePlayer: "Visualizza"
disablePlayer: "Chiudi"
expandTweet: "Espandi tweet"
Expand All @@ -579,7 +580,7 @@ plugins: "Estensioni"
preferencesBackups: "Backup delle impostazioni"
deck: "Deck"
undeck: "Esci dal deck"
useBlurEffectForModal: "Utilizza effetto sfocatura per i modali"
useBlurEffectForModal: "Utilizza effetto sfocatura per le finestre modali"
useFullReactionPicker: "Usa la totalità del pannello di reazioni"
width: "Larghezza"
height: "Altezza"
Expand Down Expand Up @@ -814,7 +815,7 @@ translatedFrom: "Tradotto da {x}"
accountDeletionInProgress: "È in corso l'eliminazione del profilo"
usernameInfo: "Un nome per identificare univocamente il tuo profilo sull'istanza. Puoi utilizzare caratteri alfanumerici maiuscoli, minuscoli e il trattino basso (_). Non potrai cambiare nome utente in seguito."
aiChanMode: "Modalità Ai"
keepCw: "Mantieni il CW"
keepCw: "Mantieni il Content Warning"
pubSub: "Publish/Subscribe del profilo"
lastCommunication: "La comunicazione più recente"
resolved: "Risolto"
Expand Down Expand Up @@ -919,6 +920,7 @@ pushNotificationNotSupported: "Il client o il server non supporta le notifiche p
sendPushNotificationReadMessage: "Elimina le notifiche push dopo la relativa lettura"
sendPushNotificationReadMessageCaption: "Se possibile, verrà mostrata brevemente una notifica con il testo \"{emptyPushNotificationMessage}\". Potrebbe influire negativamente sulla durata della batteria."
windowMaximize: "Ingrandisci"
windowMinimize: "Contrai finestra"
windowRestore: "Ripristina"
caption: "Didascalia"
loggedInAsBot: "Connessione come Bot"
Expand Down Expand Up @@ -960,6 +962,9 @@ copyErrorInfo: "Copia le informazioni sull'errore"
joinThisServer: "Registrati su questa istanza"
exploreOtherServers: "Trova altre istanze"
letsLookAtTimeline: "Sbircia la timeline"
disableFederationConfirm: "Vuoi davvero disattivare la federazione?"
disableFederationConfirmWarn: "Anche se defederate, le Note continueranno ad essere pubbliche, se non diversamente specificato. Di solito, non è necessario far questo."
disableFederationOk: "Disabilita federazione"
invitationRequiredToRegister: "L'accesso a questa istanza è solo ad invito. Può registrarsi solo chi ha un codice fornito dall'amministrazione."
emailNotSupported: "L'istanza non supporta l'invio di email"
postToTheChannel: "Pubblica nel canale"
Expand All @@ -984,6 +989,16 @@ enableChartsForFederatedInstances: "Abilita i grafici per le istanze federate"
showClipButtonInNoteFooter: "Aggiungi il bottone Clip tra le azioni delle Note"
largeNoteReactions: "Ingrandisci le reazioni"
noteIdOrUrl: "ID della Nota o URL"
accountMigration: "Migrazione del profilo"
accountMoved: "Questo profilo ha migrato altrove:"
_accountMigration:
moveTo: "Migrare questo profilo verso un un altro"
moveToLabel: "Profilo verso cui migrare"
moveAccountDescription: "Questa attività è irreversibile! Innanzitutto, assicurati di aver creato, nella istanza di destinazione, un alias con l'indirizzo di questo profilo. Successivamente, indica qui il profilo di destinazione in questo modo: @[email protected]"
moveFrom: "Migra un altro profilo dentro a questo"
moveFromLabel: "Profilo da cui migrare:"
moveFromDescription: "Se desideri spostare i profili follower da un altro profilo a questo, devi prima creare un alias qui. Assicurati averlo creato PRIMA di eseguire l'attività! Inserisci l'indirizzo del profilo mittente in questo modo: @[email protected]"
migrationConfirm: "Vuoi davvero migrare questo profilo su {account}? L'azione è irreversibile e non potrai più utilizzare questo profilo nel suo stato originale.\nInoltre, assicurati di aver già creato un alias sull'account a cui ti stai trasferendo."
_achievements:
earnedAt: "Data di conseguimento"
_types:
Expand Down Expand Up @@ -1676,12 +1691,12 @@ _visibility:
public: "Pubblica"
publicDescription: "Visibile per tutti sul Fediverso"
home: "Home"
homeDescription: "Visibile solo sulla timeline \"Home\""
homeDescription: "Visibile solo sulla timeline locale"
followers: "Follower"
followersDescription: "Visibile solo per i tuoi follower"
followersDescription: "Visibile solo ai tuoi follower"
specified: "Nota diretta"
specifiedDescription: "Visibile solo ai profili menzionati"
disableFederation: "Interrompi la federazione"
disableFederation: "Federazione disabilitata"
disableFederationDescription: "Non spedire attività alle altre istanze remote"
_postForm:
replyPlaceholder: "Rispondi a questa nota..."
Expand Down
9 changes: 9 additions & 0 deletions locales/ja-KS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,16 @@ enableChartsForFederatedInstances: "リモートサーバーのチャートを
showClipButtonInNoteFooter: "ノートのアクションにクリップを追加"
largeNoteReactions: "ノートのリアクションを大きする"
noteIdOrUrl: "ノートIDかURL"
accountMigration: "アカウントのお引っ越し"
accountMoved: "このユーザーはさらのアカウントに引っ越したで:"
_accountMigration:
moveTo: "このアカウントをさらのアカウントに引っ越すで"
moveToLabel: "引っ越し先のアカウント:"
moveAccountDescription: "この操作は戻されへんで。まず引っ越し先のアカウントでこのアカウントへのエイリアスが作れたか確認してきなはれや。エイリアスができてたら、引っ越し先のアカウントをこんな風に入力してくれへんか?:@[email protected]"
moveFrom: "別のアカウントからこのアカウントに引っ越す"
moveFromLabel: "引っ越し元のアカウント:"
moveFromDescription: "別のアカウントからこのアカウントにフォロワーを引き継いで引っ越したかったら、ここでエイリアスを作っとく必要があるで。必ずお引っ越しを実行する前に作っとかなあかんで!引っ越し元のアカウントをこんな風に入力してくれへんか?:@[email protected]"
migrationConfirm: "ほんまにこのアカウントを {account} に引っ越すんか?一回引っ越してもうたら取り消されへんし、二度とこのアカウントを元に戻されへんくなるで。\nそれと、引っ越し先のアカウントでエイリアスが作れたかちゃ~んと確認しーや?"
_achievements:
earnedAt: "貰った日ぃ"
_types:
Expand Down
2 changes: 2 additions & 0 deletions locales/sv-SE.yml
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,7 @@ aboutMisskey: "Om Misskey"
administrator: "Administratör"
passwordLessLogin: "Lösenordsfri inloggning"
passwordLessLoginDescription: "Tillåter lösenordsfri inloggning med endast en säkerhetsnyckel eller en passkey."
resetPassword: "Återställ Lösenord"
newPasswordIs: "Det nya lösenordet är \"{password}\""
share: "Dela"
enable: "Aktivera"
Expand All @@ -362,6 +363,7 @@ smtpUser: "Användarnamn"
smtpPass: "Lösenord"
emptyToDisableSmtpAuth: "Lämna användarnamn och lösenord tomt för att avaktivera SMTP verifiering"
clearCache: "Rensa cache"
onlineUsersCount: "{n} användare är online"
enabled: "Aktiverad"
user: "Användare"
global: "Global"
Expand Down
12 changes: 11 additions & 1 deletion locales/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ settingGuide: "推荐配置"
cacheRemoteFiles: "缓存远程文件"
cacheRemoteFilesDescription: "当禁用此设定时远程文件将直接从远程服务器载入。禁用后会减小储存空间需求,但是会增加流量,因为缩略图不会被生成。"
flagAsBot: "这是一个机器人账号"
flagAsBotDescription: "如果此帐户由程序控制,请启用此项。启用后,此标志可以帮助其他开发人员防止机器人之间产生无限互动的行为,并让Misskey的内部系统将此帐户识别为机器人。"
flagAsBotDescription: "如果此账户由程序控制,请启用此项。启用后,此标志可以帮助其他开发人员防止机器人之间产生无限互动的行为,并让Misskey的内部系统将此账户识别为机器人。"
flagAsCat: "将这个账户设定为一只猫"
flagAsCatDescription: "如果您想表明此帐户是一只猫,请打开此标志。\n开启后,会在您的头像上出现猫耳朵,并将你的帖子中的「na」替换为「nya」,日文同理。"
flagShowTimelineReplies: "在时间线上显示帖子的回复"
Expand Down Expand Up @@ -989,6 +989,16 @@ enableChartsForFederatedInstances: "生成远程服务器的图表"
showClipButtonInNoteFooter: "在贴文下方显示便签按钮"
largeNoteReactions: "使用大图标来显示回应"
noteIdOrUrl: "帖子ID或URL"
accountMigration: "账户迁移"
accountMoved: "此用户已迁移账户"
_accountMigration:
moveTo: "把这个账户迁移到新的账户"
moveToLabel: "迁移后的账户"
moveAccountDescription: "此操作无法取消。请先确认您已在迁移后的账户上,为此账户创造了别名。创造别名后,请如以下输入您的迁移后的账户:@[email protected]"
moveFrom: "从别的账号迁移到此账户"
moveFromLabel: "迁移前的账户"
moveFromDescription: "如果迁移时需要继承其他账户的关注者,请在此创造别名。此操作需要在实行迁移之前完成!请如已下输入需要迁移的账户:@[email protected]"
migrationConfirm: "确定要把此账户迁移到{account}吗?一旦确定后,此操作无法取消,此账户也无法以原来的状态使用。\n同时,请确认迁移后的账户,已创造别名。"
_achievements:
earnedAt: "达成时间"
_types:
Expand Down
4 changes: 4 additions & 0 deletions locales/zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -984,6 +984,10 @@ enableChartsForFederatedInstances: "生成遠端伺服器的圖表"
showClipButtonInNoteFooter: "將摘錄添加至貼文"
largeNoteReactions: "將貼文的反應放大顯示"
noteIdOrUrl: "貼文ID或URL"
accountMigration: "遷移帳戶"
_accountMigration:
moveTo: "將這個帳戶遷移至新的帳戶"
moveToLabel: "要遷移的帳戶:"
_achievements:
earnedAt: "獲得日期"
_types:
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "misskey",
"version": "13.11.0",
"version": "13.11.1",
"codename": "nasubi",
"repository": {
"type": "git",
Expand Down
6 changes: 5 additions & 1 deletion packages/backend/src/core/CustomEmojiService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ export class CustomEmojiService {
memoryCacheLifetime: 1000 * 60 * 3, // 3m
fetcher: () => this.emojisRepository.find({ where: { host: IsNull() } }).then(emojis => new Map(emojis.map(emoji => [emoji.name, emoji]))),
toRedisConverter: (value) => JSON.stringify(value.values()),
fromRedisConverter: (value) => new Map(JSON.parse(value).map((x: Emoji) => [x.name, x])), // TODO: Date型の変換
fromRedisConverter: (value) => {
// 原因不明だが配列以外が入ってくることがあるため
if (!Array.isArray(JSON.parse(value))) return undefined;
return new Map(JSON.parse(value).map((x: Emoji) => [x.name, x]));
}, // TODO: Date型の変換
});
}

Expand Down
1 change: 1 addition & 0 deletions packages/backend/src/core/FederatedInstanceService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export class FederatedInstanceService {
toRedisConverter: (value) => JSON.stringify(value),
fromRedisConverter: (value) => {
const parsed = JSON.parse(value);
if (parsed == null) return null;
return {
...parsed,
firstRetrievedAt: new Date(parsed.firstRetrievedAt),
Expand Down
14 changes: 7 additions & 7 deletions packages/backend/src/core/IdService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import { ulid } from 'ulid';
import { DI } from '@/di-symbols.js';
import type { Config } from '@/config.js';
import { genAid, parseAid } from '@/misc/id/aid.js';
import { genMeid } from '@/misc/id/meid.js';
import { genMeidg } from '@/misc/id/meidg.js';
import { genMeid, parseMeid } from '@/misc/id/meid.js';
import { genMeidg, parseMeidg } from '@/misc/id/meidg.js';
import { genObjectId } from '@/misc/id/object-id.js';
import { bindThis } from '@/decorators.js';
import { parseUlid } from '@/misc/id/ulid.js';

@Injectable()
export class IdService {
Expand Down Expand Up @@ -37,11 +38,10 @@ export class IdService {
public parse(id: string): { date: Date; } {
switch (this.method) {
case 'aid': return parseAid(id);
// TODO
//case 'meid':
//case 'meidg':
//case 'ulid':
//case 'objectid':
case 'objectid':
case 'meid': return parseMeid(id);
case 'meidg': return parseMeidg(id);
case 'ulid': return parseUlid(id);
default: throw new Error('unrecognized id generation method');
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ class DeliverManager {

for (const following of followers) {
const inbox = following.followerSharedInbox ?? following.followerInbox;
inboxes.set(inbox, following.followerSharedInbox === null);
inboxes.set(inbox, following.followerSharedInbox != null);
}
}

Expand Down
4 changes: 2 additions & 2 deletions packages/backend/src/misc/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export class RedisKVCache<T> {
private memoryCache: MemoryKVCache<T>;
private fetcher: (key: string) => Promise<T>;
private toRedisConverter: (value: T) => string;
private fromRedisConverter: (value: string) => T;
private fromRedisConverter: (value: string) => T | undefined; // undefined means no cache

constructor(redisClient: RedisKVCache<T>['redisClient'], name: RedisKVCache<T>['name'], opts: {
lifetime: RedisKVCache<T>['lifetime'];
Expand Down Expand Up @@ -92,7 +92,7 @@ export class RedisSingleCache<T> {
private memoryCache: MemorySingleCache<T>;
private fetcher: () => Promise<T>;
private toRedisConverter: (value: T) => string;
private fromRedisConverter: (value: string) => T;
private fromRedisConverter: (value: string) => T | undefined; // undefined means no cache

constructor(redisClient: RedisSingleCache<T>['redisClient'], name: RedisSingleCache<T>['name'], opts: {
lifetime: RedisSingleCache<T>['lifetime'];
Expand Down
2 changes: 2 additions & 0 deletions packages/backend/src/misc/id/aid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

import * as crypto from 'node:crypto';

export const aidRegExp = /^[0-9a-z]{10}$/;

const TIME2000 = 946684800000;
let counter = crypto.randomBytes(2).readUInt16LE(0);

Expand Down
9 changes: 9 additions & 0 deletions packages/backend/src/misc/id/meid.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const CHARS = '0123456789abcdef';

// same as object-id
export const meidRegExp = /^[0-9a-f]{24}$/;

function getTime(time: number) {
if (time < 0) time = 0;
if (time === 0) {
Expand All @@ -24,3 +27,9 @@ function getRandom() {
export function genMeid(date: Date): string {
return getTime(date.getTime()) + getRandom();
}

export function parseMeid(id: string): { date: Date; } {
return {
date: new Date(parseInt(id.slice(0, 12), 16) - 0x800000000000),
};
}
7 changes: 7 additions & 0 deletions packages/backend/src/misc/id/meidg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const CHARS = '0123456789abcdef';
// 4bit Fixed hex value 'g'
// 44bit UNIX Time ms in Hex
// 48bit Random value in Hex
export const meidgRegExp = /^g[0-9a-f]{23}$/;

function getTime(time: number) {
if (time < 0) time = 0;
Expand All @@ -26,3 +27,9 @@ function getRandom() {
export function genMeidg(date: Date): string {
return 'g' + getTime(date.getTime()) + getRandom();
}

export function parseMeidg(id: string): { date: Date; } {
return {
date: new Date(parseInt(id.slice(1, 12), 16)),
};
}
9 changes: 9 additions & 0 deletions packages/backend/src/misc/id/object-id.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
const CHARS = '0123456789abcdef';

// same as meid
export const objectIdRegExp = /^[0-9a-f]{24}$/;

function getTime(time: number) {
if (time < 0) time = 0;
if (time === 0) {
Expand All @@ -24,3 +27,9 @@ function getRandom() {
export function genObjectId(date: Date): string {
return getTime(date.getTime()) + getRandom();
}

export function parseObjectId(id: string): { date: Date; } {
return {
date: new Date(parseInt(id.slice(0, 8), 16) * 1000),
};
}
Loading