Compare commits
42 Commits
Author | SHA1 | Date | |
---|---|---|---|
a64817cea1 | |||
c32c3c1370 | |||
29ad7ab0cf | |||
11716fa9d3 | |||
210f11ffd8 | |||
814751d76a | |||
440cf139bb | |||
276d8ffc66 | |||
d9cdc1f079 | |||
414c600356 | |||
e37c19fdcd | |||
d69b919961 | |||
1311db8060 | |||
ed9e7520f1 | |||
8fe6da0cad | |||
b8eac630ed | |||
a5b9d7eb3b | |||
06c453c3bc | |||
97b7567770 | |||
34345ea8a7 | |||
fc166b7bee | |||
cf3112c7c0 | |||
e7dd74a443 | |||
b5acf15877 | |||
f62603fd9d | |||
d000b9e7cd | |||
0e1f858dfd | |||
bcf28282f6 | |||
abfbb068d7 | |||
9643a87320 | |||
b3817240b8 | |||
8d53f8639e | |||
27f90b61e6 | |||
c9a57fe8fe | |||
9516f2fa63 | |||
7be88b7816 | |||
faabb039a5 | |||
15e4cf1243 | |||
75764e59e1 | |||
f664cf09c0 | |||
0c3e9dd5e0 | |||
0bc7d28f58 |
@ -52,9 +52,9 @@ If you want to translate Misskey, please see [Translation guide](./docs/translat
|
||||
[List of all contributors](https://github.com/syuilo/misskey/graphs/contributors)
|
||||
|
||||
### :earth_americas: Translators
|
||||
| ![][mirro-san-icon] | ![][Conan-kun-icon] |
|
||||
|:-:|:-:|
|
||||
| [Mirro][mirro-san-link]<br>English, French | [Asriel][Conan-kun-link]<br>English, French |
|
||||
| ![][mirro-san-icon] | ![][Conan-kun-icon] | ![][m4sk1n-icon] |
|
||||
|:-:|:-:|:-:|
|
||||
| [Mirro][mirro-san-link]<br>English, French | [Asriel][Conan-kun-link]<br>English, French | [Marcin Mikołajczak][m4sk1n-link]<br>Polish |
|
||||
|
||||
:four_leaf_clover: Copyright
|
||||
----------------------------------------------------------------
|
||||
@ -100,4 +100,5 @@ Misskey is an open-source software licensed under [GNU AGPLv3](LICENSE).
|
||||
[mirro-san-icon]: https://avatars1.githubusercontent.com/u/17948612?s=70&v=4
|
||||
[Conan-kun-link]: https://github.com/Conan-kun
|
||||
[Conan-kun-icon]: https://avatars3.githubusercontent.com/u/30003708?s=70&v=4
|
||||
|
||||
[m4sk1n-link]: https://github.com/m4sk1n
|
||||
[m4sk1n-icon]: https://avatars3.githubusercontent.com/u/21127288?s=70&v=4
|
||||
|
101
cli/clean-cached-remote-files.js
Normal file
101
cli/clean-cached-remote-files.js
Normal file
@ -0,0 +1,101 @@
|
||||
const chalk = require('chalk');
|
||||
const log = require('single-line-log').stdout;
|
||||
const sequential = require('promise-sequential');
|
||||
const { default: DriveFile, DriveFileChunk } = require('../built/models/drive-file');
|
||||
const { default: DriveFileThumbnail, DriveFileThumbnailChunk } = require('../built/models/drive-file-thumbnail');
|
||||
const { default: User } = require('../built/models/user');
|
||||
|
||||
const q = {
|
||||
'metadata._user.host': {
|
||||
$ne: null
|
||||
}
|
||||
};
|
||||
|
||||
async function main() {
|
||||
const promiseGens = [];
|
||||
|
||||
const count = await DriveFile.count(q);
|
||||
|
||||
let prev;
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
promiseGens.push(() => {
|
||||
const promise = new Promise(async (res, rej) => {
|
||||
const file = await DriveFile.findOne(prev ? Object.assign({
|
||||
_id: { $lt: prev._id }
|
||||
}, q) : q, {
|
||||
sort: {
|
||||
_id: -1
|
||||
}
|
||||
});
|
||||
|
||||
prev = file;
|
||||
|
||||
function skip() {
|
||||
res([i, file, false]);
|
||||
}
|
||||
|
||||
if (file == null) return skip();
|
||||
|
||||
log(chalk`{gray ${i}} scanning {bold ${file._id}} ${file.filename} ...`);
|
||||
|
||||
const attachingUsersCount = await User.count({
|
||||
$or: [{
|
||||
avatarId: file._id
|
||||
}, {
|
||||
bannerId: file._id
|
||||
}]
|
||||
}, { limit: 1 });
|
||||
if (attachingUsersCount !== 0) return skip();
|
||||
|
||||
Promise.all([
|
||||
// チャンクをすべて削除
|
||||
DriveFileChunk.remove({
|
||||
files_id: file._id
|
||||
}),
|
||||
|
||||
DriveFile.update({ _id: file._id }, {
|
||||
$set: {
|
||||
'metadata.deletedAt': new Date(),
|
||||
'metadata.isExpired': true
|
||||
}
|
||||
})
|
||||
]).then(async () => {
|
||||
res([i, file, true]);
|
||||
|
||||
//#region サムネイルもあれば削除
|
||||
const thumbnail = await DriveFileThumbnail.findOne({
|
||||
'metadata.originalId': file._id
|
||||
});
|
||||
|
||||
if (thumbnail) {
|
||||
DriveFileThumbnailChunk.remove({
|
||||
files_id: thumbnail._id
|
||||
});
|
||||
|
||||
DriveFileThumbnail.remove({ _id: thumbnail._id });
|
||||
}
|
||||
//#endregion
|
||||
});
|
||||
});
|
||||
|
||||
promise.then(([i, file, deleted]) => {
|
||||
if (deleted) {
|
||||
log(chalk`{gray ${i}} {red deleted: {bold ${file._id}} ${file.filename}}`);
|
||||
} else {
|
||||
log(chalk`{gray ${i}} {green skipped: {bold ${file._id}} ${file.filename}}`);
|
||||
}
|
||||
log.clear();
|
||||
console.log();
|
||||
});
|
||||
|
||||
return promise;
|
||||
});
|
||||
}
|
||||
|
||||
return await sequential(promiseGens);
|
||||
}
|
||||
|
||||
main().then(() => {
|
||||
console.log('ALL DONE');
|
||||
}).catch(console.error);
|
80
cli/clean-unused-drive-files.js
Normal file
80
cli/clean-unused-drive-files.js
Normal file
@ -0,0 +1,80 @@
|
||||
const chalk = require('chalk');
|
||||
const log = require('single-line-log').stdout;
|
||||
const sequential = require('promise-sequential');
|
||||
const { default: DriveFile, deleteDriveFile } = require('../built/models/drive-file');
|
||||
const { default: Note } = require('../built/models/note');
|
||||
const { default: MessagingMessage } = require('../built/models/messaging-message');
|
||||
const { default: User } = require('../built/models/user');
|
||||
|
||||
async function main() {
|
||||
const promiseGens = [];
|
||||
|
||||
const count = await DriveFile.count({});
|
||||
|
||||
let prev;
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
promiseGens.push(() => {
|
||||
const promise = new Promise(async (res, rej) => {
|
||||
const file = await DriveFile.findOne(prev ? {
|
||||
_id: { $lt: prev._id }
|
||||
} : {}, {
|
||||
sort: {
|
||||
_id: -1
|
||||
}
|
||||
});
|
||||
|
||||
prev = file;
|
||||
|
||||
function skip() {
|
||||
res([i, file, false]);
|
||||
}
|
||||
|
||||
if (file == null) return skip();
|
||||
|
||||
log(chalk`{gray ${i}} scanning {bold ${file._id}} ${file.filename} ...`);
|
||||
|
||||
const attachingUsersCount = await User.count({
|
||||
$or: [{
|
||||
avatarId: file._id
|
||||
}, {
|
||||
bannerId: file._id
|
||||
}]
|
||||
}, { limit: 1 });
|
||||
if (attachingUsersCount !== 0) return skip();
|
||||
|
||||
const attachingNotesCount = await Note.count({
|
||||
mediaIds: file._id
|
||||
}, { limit: 1 });
|
||||
if (attachingNotesCount !== 0) return skip();
|
||||
|
||||
const attachingMessagesCount = await MessagingMessage.count({
|
||||
fileId: file._id
|
||||
}, { limit: 1 });
|
||||
if (attachingMessagesCount !== 0) return skip();
|
||||
|
||||
deleteDriveFile(file).then(() => {
|
||||
res([i, file, true]);
|
||||
}).catch(rej);
|
||||
});
|
||||
|
||||
promise.then(([i, file, deleted]) => {
|
||||
if (deleted) {
|
||||
log(chalk`{gray ${i}} {red deleted: {bold ${file._id}} ${file.filename}}`);
|
||||
} else {
|
||||
log(chalk`{gray ${i}} {green skipped: {bold ${file._id}} ${file.filename}}`);
|
||||
}
|
||||
log.clear();
|
||||
console.log();
|
||||
});
|
||||
|
||||
return promise;
|
||||
});
|
||||
}
|
||||
|
||||
return await sequential(promiseGens);
|
||||
}
|
||||
|
||||
main().then(() => {
|
||||
console.log('done');
|
||||
}).catch(console.error);
|
@ -59,9 +59,15 @@ gulp.task('build:ts', () => {
|
||||
.pipe(gulp.dest('./built/'));
|
||||
});
|
||||
|
||||
gulp.task('build:copy', () =>
|
||||
gulp.task('build:copy:views', () =>
|
||||
gulp.src('./src/server/web/views/**/*').pipe(gulp.dest('./built/server/web/views'))
|
||||
);
|
||||
|
||||
gulp.task('build:copy', ['build:copy:views'], () =>
|
||||
gulp.src([
|
||||
'./build/Release/crypto_key.node',
|
||||
'./src/const.json',
|
||||
'./src/server/web/views/**/*',
|
||||
'./src/**/assets/**/*',
|
||||
'!./src/client/app/**/assets/**/*'
|
||||
]).pipe(gulp.dest('./built/'))
|
||||
|
@ -13,7 +13,8 @@ const native = loadLang('ja');
|
||||
const langs = {
|
||||
'en': loadLang('en'),
|
||||
'fr': loadLang('fr'),
|
||||
'ja': native
|
||||
'ja': native,
|
||||
'pl': loadLang('pl')
|
||||
};
|
||||
|
||||
Object.entries(langs).map(([, locale]) => {
|
||||
|
628
locales/pl.yml
Normal file
628
locales/pl.yml
Normal file
@ -0,0 +1,628 @@
|
||||
common:
|
||||
misskey: "Dziel się zawartością z innymi korzystając z Misskey."
|
||||
|
||||
time:
|
||||
unknown: "nieznany"
|
||||
future: "w przyszłości"
|
||||
just_now: "teraz"
|
||||
seconds_ago: "{} sek. temu"
|
||||
minutes_ago: "{} min. temu"
|
||||
hours_ago: "{} godz. temu"
|
||||
days_ago: "{} dni temu"
|
||||
weeks_ago: "{} tyg. temu"
|
||||
months_ago: "{} mies. temu"
|
||||
years_ago: "{} lat temu"
|
||||
|
||||
weekday-short:
|
||||
sunday: "N"
|
||||
monday: "Pn"
|
||||
tuesday: "W"
|
||||
wednesday: "Ś"
|
||||
thursday: "C"
|
||||
friday: "P"
|
||||
satruday: "S"
|
||||
|
||||
reactions:
|
||||
like: "Lubię"
|
||||
love: "Kocham"
|
||||
laugh: "Śmieszne"
|
||||
hmm: "Hmm…?"
|
||||
surprise: "Wow"
|
||||
congrats: "Gratuluję!"
|
||||
angry: "Wściekły"
|
||||
confused: "Zmieszany"
|
||||
pudding: "Pudding"
|
||||
|
||||
delete: "Usuń"
|
||||
loading: "Ładowanie"
|
||||
ok: "OK"
|
||||
update-available: "Nowa wersja Misskey jest dostępna ({newer}, obecna to {current}). Odśwież stronę, aby zastosować aktualizację."
|
||||
my-token-regenerated: "Twój token został wygenerowany. Zostaniesz wylogowany."
|
||||
|
||||
common/views/components/connect-failed.vue:
|
||||
title: "Nie udało się połączyć z serwerem"
|
||||
description: "Wystąpił problem z Twoim połączeniem z Internetem, lub z serwerem. {Spróbuj ponownie} wkrótce."
|
||||
thanks: "Dziękujemy za korzystanie z Misskey."
|
||||
troubleshoot: "Rozwiązywanie problemów"
|
||||
|
||||
common/views/components/connect-failed.troubleshooter.vue:
|
||||
title: "Rozwiązywanie problemów"
|
||||
network: "Połączenie z siecią"
|
||||
checking-network: "Sprawdzanie połączenia sieciowego"
|
||||
internet: "Połączenie z Internetem"
|
||||
checking-internet: "Sprawdzanie połączenia z Internetem"
|
||||
server: "Połączenie z serwerem"
|
||||
checking-server: "Sprawdzanie połączenia z serwerem"
|
||||
finding: "Wyszukiwanie problemu"
|
||||
no-network: "Brak połączenia z siecią"
|
||||
no-network-desc: "Upewnij się, że jesteś połączony z siecią."
|
||||
no-internet: "Brak połączenia z Internetem"
|
||||
no-internet-desc: "Upewnij się, że jesteś połączony z Internetem."
|
||||
no-server: "Nie udało się połączyć z serwerem"
|
||||
no-server-desc: "Połączenie sieciowe działa, ale nie udało się połączyć z serwerem Misskey. Możliwe że serwer nie działa lub trwają prace konserwacyjne, spróbuj ponownie później."
|
||||
success: "Pomyślnie połączono z serwerem Misskey"
|
||||
success-desc: "Wygląda na to, że udało się połączyć. Odśwież stronę."
|
||||
flush: "Wyczyść pamięć podręczną"
|
||||
set-version: "Określ wersję"
|
||||
|
||||
common/views/components/messaging.vue:
|
||||
search-user: "Znajdź użytkownika"
|
||||
you: "Ty"
|
||||
no-history: "Brak historii"
|
||||
|
||||
common/views/components/messaging-room.vue:
|
||||
empty: "Brak konwersacji"
|
||||
more: "Więcej"
|
||||
no-history: "Brak dalszej historii"
|
||||
resize-form: "Przeciągnij aby zmienić rozmiar"
|
||||
new-message: "Nowa wiadomość"
|
||||
|
||||
common/views/components/messaging-room.form.vue:
|
||||
input-message-here: "Wprowadź wiadomość tutaj"
|
||||
send: "Wyślij"
|
||||
attach-from-local: "Załącz pliki z komputera"
|
||||
attach-from-drive: "Załącz pliki z dysku"
|
||||
|
||||
common/views/components/messaging-room.message.vue:
|
||||
is-read: "Przeczytano"
|
||||
deleted: "Wiadomość została usunięta"
|
||||
|
||||
common/views/components/nav.vue:
|
||||
about: "O stronie"
|
||||
stats: "Statystyki"
|
||||
status: "Stan"
|
||||
wiki: "Wiki"
|
||||
donors: "Sponsorzy"
|
||||
repository: "Repozytorium"
|
||||
develop: "Autorzy"
|
||||
feedback: "Opinie"
|
||||
|
||||
common/views/components/note-menu.vue:
|
||||
favorite: "Dodaj do ulubionych"
|
||||
pin: "Przypnij do profilu"
|
||||
|
||||
common/views/components/poll.vue:
|
||||
vote-to: "Zagłosuj na '{}'"
|
||||
vote-count: "{} głosów"
|
||||
total-users: "{} głosujących"
|
||||
vote: "Zagłosuj"
|
||||
show-result: "Pokaż wyniki"
|
||||
voted: "Zagłosowano"
|
||||
|
||||
common/views/components/poll-editor.vue:
|
||||
no-only-one-choice: "Musisz wprowadzić dwie lub więcej opcji."
|
||||
choice-n: "Opcja {}"
|
||||
remove: "Usuń tą opcję"
|
||||
add: "+ Dodaj opcję"
|
||||
destroy: "Usuń ankietę"
|
||||
|
||||
common/views/components/reaction-picker.vue:
|
||||
choose-reaction: "Wybierz reakcję"
|
||||
|
||||
common/views/components/signin.vue:
|
||||
username: "Nazwa użytkownika"
|
||||
password: "Hasło"
|
||||
token: "Token"
|
||||
signing-in: "Logowanie…"
|
||||
signin: "Zaloguj"
|
||||
|
||||
common/views/components/signup.vue:
|
||||
username: "Nazwa użytkownika"
|
||||
checking: "Sprawdzanie…"
|
||||
available: "Dostępna"
|
||||
unavailable: "Niedostępna"
|
||||
error: "Błąd sieci"
|
||||
invalid-format: "Może zawierać litery, cyfry i myślniki."
|
||||
too-short: "Wprowadź przynajmniej jeden znak"
|
||||
too-long: "Nazwa nie może zawierać więcej niż 20 znaków"
|
||||
password: "Hasło"
|
||||
password-placeholder: "Zalecamy korzystanie z hasła zawierającego przynajmniej 8 znaków."
|
||||
weak-password: "Słabe"
|
||||
normal-password: "Średnie"
|
||||
strong-password: "Silne"
|
||||
retype: "Powtórz hasło"
|
||||
retype-placeholder: "Potwierdź hasło"
|
||||
password-matched: "OK"
|
||||
password-not-matched: "Hasła nie zgadzają się"
|
||||
recaptcha: "Weryfikacja"
|
||||
create: "Utwórz konto"
|
||||
some-error: "Nie udało się utworzyć konta. Spróbuj ponownie."
|
||||
|
||||
common/views/components/special-message.vue:
|
||||
new-year: "Szczęśliwego nowego roku!"
|
||||
christmas: "Wesołych świąt!"
|
||||
|
||||
common/views/components/stream-indicator.vue:
|
||||
connecting: "Łączenie"
|
||||
reconnecting: "Ponowne łączenie"
|
||||
connected: "Połączono"
|
||||
|
||||
common/views/components/twitter-setting.vue:
|
||||
description: "Jeżeli połączysz konto Twittera z kontem Misskey, informacje z Twittera będą widoczne na Twoim profilu i będziesz mógł logować się z użyciem Twittera."
|
||||
connected-to: "Jesteś połączony z tym kontem Twittera"
|
||||
detail: "Szczegóły…"
|
||||
reconnect: "Połącz ponownie"
|
||||
connect: "Połącz z kontem Twittera"
|
||||
disconnect: "Rozłącz"
|
||||
|
||||
common/views/components/uploader.vue:
|
||||
waiting: "Oczekiwanie"
|
||||
|
||||
common/views/widgets/broadcast.vue:
|
||||
no-broadcasts: "Brak transmisji"
|
||||
have-a-nice-day: "Miłego dnia!"
|
||||
next: "Dalej"
|
||||
|
||||
common/views/widgets/donation.vue:
|
||||
title: "Dotacje"
|
||||
text: "Aby utrzymywać Misskey, płacimy za domenę, serwery i nie tylko… Nie zarabiamy na tym, więc byłoby nam miło, gdybyśmy uzyskali od Ciebie dotację. Jeżeli jesteś zainteresowany, skontaktuj się z {}. Dziękujemy za wsparcie!"
|
||||
|
||||
common/views/widgets/photo-stream.vue:
|
||||
no-photos: "Brak zdjęć"
|
||||
|
||||
common/views/widgets/server.vue:
|
||||
title: "Informacje o serwerze"
|
||||
toggle: "Przełącz widok"
|
||||
|
||||
desktop/views/components/activity.vue:
|
||||
title: "Aktywność"
|
||||
toggle: "Przełącz widok"
|
||||
|
||||
desktop/views/components/calendar.vue:
|
||||
title: "{1} / {2}"
|
||||
prev: "Poprzedni miesiąc"
|
||||
next: "Następny miesiąc"
|
||||
go: "Naciśnij, aby przejść"
|
||||
|
||||
desktop/views/components/drive-window.vue:
|
||||
used: "wykorzystane"
|
||||
drive: "Dysk"
|
||||
|
||||
desktop/views/components/drive.file.vue:
|
||||
avatar: "Awatar"
|
||||
banner: "Baner"
|
||||
contextmenu:
|
||||
rename: "Zmień nazwę"
|
||||
copy-url: "Skopiuj adres"
|
||||
download: "Pobierz"
|
||||
else-files: "Inne"
|
||||
set-as-avatar: "Ustaw jako awatar"
|
||||
set-as-banner: "Ustaw jako baner"
|
||||
open-in-app: "Otwórz w aplikacji"
|
||||
add-app: "Dodaj aplikację"
|
||||
rename-file: "Zmień nazwę pliku"
|
||||
input-new-file-name: "Wprowadź nową nazwę"
|
||||
copied: "Skopiowano"
|
||||
copied-url-to-clipboard: "Skopiowano adres do schowka"
|
||||
|
||||
desktop/views/components/drive.folder.vue:
|
||||
unable-to-process: "Nie udało się ukończyć działania."
|
||||
circular-reference-detected: "Docelowy katalog znajduje się w katalogu, który chcesz przenieść."
|
||||
unhandled-error: "Nieznany błąd"
|
||||
contextmenu:
|
||||
move-to-this-folder: "Przenieś do tego katalogu"
|
||||
show-in-new-window: "Otwórz w nowym oknie"
|
||||
rename: "Zmień nazwę"
|
||||
rename-folder: "Zmień nazwę katalogu"
|
||||
input-new-folder-name: "Wprowadź nową nazwę"
|
||||
|
||||
desktop/views/components/drive.nav-folder.vue:
|
||||
drive: "Dysk"
|
||||
|
||||
desktop/views/components/drive.vue:
|
||||
search: "Szukaj"
|
||||
load-more: "Załaduj więcej"
|
||||
empty-drive: "Twój dysk jest posty"
|
||||
empty-drive-description: "Możesz wysłać plik klikając prawym przyciskiem myszy i wybierając \"Wyślij plik\" lub przeciągnąć plik i upuścić w tym oknie."
|
||||
empty-folder: "Ten katalog jest posty"
|
||||
unable-to-process: "Nie udało się dokończyć działania."
|
||||
circular-reference-detected: "Ten katalog znajduje się w katalogu, który chcesz przenieść."
|
||||
unhandled-error: "Nieznany błąd"
|
||||
url-upload: "Wyślij z adresu"
|
||||
url-of-file: "Adres URL pliku, który chcesz wysłać"
|
||||
may-take-time: "Może trochę potrwać, zanim wysyłanie zostanie ukończone."
|
||||
create-folder: "Utwórz katalog"
|
||||
folder-name: "Nazwa katalogu"
|
||||
contextmenu:
|
||||
create-folder: "Utwórz katalog"
|
||||
upload: "Wyślij plik"
|
||||
url-upload: "Wyślij z adresu URL"
|
||||
|
||||
desktop/views/components/messaging-window.vue:
|
||||
title: "Wiadomości"
|
||||
|
||||
desktop/views/components/notes.note.vue:
|
||||
reposted-by: "Udostępniono przez {}"
|
||||
reply: "Odpowiedz"
|
||||
add-reaction: "Dodaj reakcję"
|
||||
detail: "Pokaż szczegóły"
|
||||
|
||||
desktop/views/components/notifications.vue:
|
||||
more: "Więcej"
|
||||
empty: "Brak powiadomień"
|
||||
|
||||
desktop/views/components/post-form.vue:
|
||||
note-placeholder: "Co się dzieje?"
|
||||
reply-placeholder: "Odpowiedz na ten wpis…"
|
||||
quote-placeholder: "Zacytuj ten wpis…"
|
||||
note: "Wyślij"
|
||||
reply: "Odpowiedz"
|
||||
posted: "Posted!"
|
||||
replied: "Odpowiedziano!"
|
||||
reposted: "Udostępniono!"
|
||||
note-failed: "Nie udało się wysłać"
|
||||
reply-failed: "Nie udało się odpowiedzieć"
|
||||
posting: "Wysyłanie"
|
||||
attach-media-from-local: "Załącz zawartość multimedialną z komputera"
|
||||
attach-media-from-drive: "Załącz zawartość multimedialną z dysku"
|
||||
attach-cancel: "Usuń załącznik"
|
||||
insert-a-kao: "v(‘ω’)v"
|
||||
create-poll: "Utwórz ankietę"
|
||||
text-remain: "pozostałe znaki: {}"
|
||||
|
||||
desktop/views/components/post-form-window.vue:
|
||||
note: "Nowy wpis"
|
||||
reply: "Odpowiedz"
|
||||
attaches: "{} załączników multimedialnych"
|
||||
uploading-media: "Wysyłanie {} treści multimedialnych"
|
||||
|
||||
desktop/views/components/renote-form.vue:
|
||||
quote: "Cytuj…"
|
||||
cancel: "Anuluj"
|
||||
reposting: "Udostępnianie…"
|
||||
success: "Udostępniono!"
|
||||
|
||||
desktop/views/components/settings.vue:
|
||||
profile: "Profil"
|
||||
notification: "Powiadomienie"
|
||||
apps: "Aplikacje"
|
||||
mute: "Wycisz"
|
||||
drive: "Dysk"
|
||||
security: "Bezpieczeństwo"
|
||||
password: "Hasło"
|
||||
2fa: "Uwierzytelnianie dwuetapowe"
|
||||
other: "Inne"
|
||||
license: "Licencja"
|
||||
|
||||
desktop/views/components/settings.2fa.vue:
|
||||
intro: "Jeżeli skonfigurujesz uwierzytelnianie dwuetapowe, aby zablokować się będziesz potrzebować (oprócz hasła) kodu ze skonfigurowanego urządzenia (np. smartfonu), co zwiększy bezpieczeństwo."
|
||||
detail: "Zobacz szczegóły…"
|
||||
url: "https://www.google.com/landing/2step/"
|
||||
caution: "Jeżeli stracisz dostęp do urządzenia, nie będziesz mógł logować się do Misskey!"
|
||||
register: "Zarejestruj urządzenie"
|
||||
already-registered: "Urządzenie jest już zarejestrowane"
|
||||
unregister: "Wyłącz"
|
||||
unregistered: "Wyłączono uwierzytelnianie dwuetapowe."
|
||||
enter-password: "Wprowadź hasło"
|
||||
authenticator: "Na początek musisz zainstalować Google Authenticator na swoim urządzeniu:"
|
||||
howtoinstall: "Jak zainstalować"
|
||||
scan: "Później, zeskanuje ten kod QR:"
|
||||
done: "Wprowadź token wyświetlony na Twoim urządzeniu:"
|
||||
submit: "Wyślij"
|
||||
success: "Pomyślnie ukończono konfigurację!"
|
||||
failed: "Nie udało się skonfigurować uwierzytelniania dwuetapowego, upewnij się że wprowadziłeś prawidłowy token."
|
||||
info: "Od teraz, wprowadzaj token wyświetlany na urządzeniu przy każdym logowaniu do Misskey."
|
||||
|
||||
desktop/views/components/settings.api.vue:
|
||||
caution: "Nie pokazuj tego tokenu osobom trzecim (nie wprowadzaj go nigdzie indziej), aby konto nie trafiło w niepowołane ręce."
|
||||
regeneration-of-token: "W przypadku wycieku tokenu, możesz wygenerować nowy."
|
||||
regenerate-token: "Wygeneruj nowy token"
|
||||
enter-password: "Wprowadź hasło"
|
||||
|
||||
desktop/views/components/settings.app.vue:
|
||||
no-apps: "Brak zautoryzowanych aplikacji"
|
||||
|
||||
desktop/views/components/settings.mute.vue:
|
||||
no-users: "Brak wyciszonych użytkowników"
|
||||
|
||||
desktop/views/components/settings.password.vue:
|
||||
reset: "Zmień hasło"
|
||||
enter-current-password: "Wprowadź obecne hasło"
|
||||
enter-new-password: "Wprowadź nowe hasło"
|
||||
enter-new-password-again: "Wprowadź ponownie nowe hasło"
|
||||
not-match: "Nowe hasła nie pasują do siebie"
|
||||
changed: "Pomyślnie zmieniono hasło"
|
||||
|
||||
desktop/views/components/settings.profile.vue:
|
||||
avatar: "Awatar"
|
||||
choice-avatar: "Wybierz obraz"
|
||||
name: "Nazwa"
|
||||
location: "Lokalizacja"
|
||||
description: "Opis"
|
||||
birthday: "Data urodzenia"
|
||||
save: "Aktualizuj profil"
|
||||
|
||||
desktop/views/components/ui.header.account.vue:
|
||||
profile: "Twój profil"
|
||||
drive: "Dysk"
|
||||
favorites: "Ulubione"
|
||||
lists: "Listy"
|
||||
customize: "Dostosuj"
|
||||
settings: "Ustawienia"
|
||||
signout: "Wyloguj się"
|
||||
dark: "Sprowadź ciemność"
|
||||
|
||||
desktop/views/components/ui.header.nav.vue:
|
||||
home: "Strona główna"
|
||||
messaging: "Wiadomości"
|
||||
game: "Gra"
|
||||
|
||||
desktop/views/components/ui.header.notifications.vue:
|
||||
title: "Powiadomienia"
|
||||
|
||||
desktop/views/components/ui.header.post.vue:
|
||||
post: "Utwórz nowy wpis"
|
||||
|
||||
desktop/views/components/ui.header.search.vue:
|
||||
placeholder: "Szukaj"
|
||||
|
||||
desktop/views/pages/note.vue:
|
||||
prev: "Poprzedni wpis"
|
||||
next: "Następny wpis"
|
||||
|
||||
desktop/views/pages/selectdrive.vue:
|
||||
title: "Wybierz plik(i)"
|
||||
ok: "OK"
|
||||
cancel: "Anuluj"
|
||||
upload: "Wyślij pliki z Twojego komputera"
|
||||
|
||||
desktop/views/pages/user/user.followers-you-know.vue:
|
||||
title: "Śledzący których znasz"
|
||||
loading: "Ładowanie"
|
||||
no-users: "Brak użytkowników"
|
||||
|
||||
desktop/views/pages/user/user.friends.vue:
|
||||
title: "Najczęściej odpisujący"
|
||||
loading: "Ładowanie"
|
||||
no-users: "Brak użytkowników"
|
||||
|
||||
desktop/views/pages/user/user.header.vue:
|
||||
is-suspended: "To konto zostało zawieszone."
|
||||
is-remote: "To jest użytkownik zdalnej instancji, informacje mogą nie być w pełni dokładne."
|
||||
view-remote: "Wyświetl dokładne informacje"
|
||||
|
||||
desktop/views/pages/user/user.home.vue:
|
||||
last-used-at: "Ostatnio aktywny: "
|
||||
|
||||
desktop/views/pages/user/user.photos.vue:
|
||||
title: "Zdjęcia"
|
||||
loading: "Ładowanie"
|
||||
no-photos: "Brak zdjęć"
|
||||
|
||||
desktop/views/pages/user/user.profile.vue:
|
||||
follows-you: "Śledzi Cię"
|
||||
stalk: "Stalkuj"
|
||||
stalking: "Stalkujesz"
|
||||
unstalk: "Przestań stalkować"
|
||||
mute: "Wycisz"
|
||||
muted: "Wyciszyłeś"
|
||||
unmute: "Cofnij wyciszenie"
|
||||
|
||||
desktop/views/widgets/notifications.vue:
|
||||
title: "Powiadomienia"
|
||||
settings: "Ustawienia"
|
||||
|
||||
desktop/views/widgets/polls.vue:
|
||||
title: "Ankiety"
|
||||
refresh: "Pokaż inne"
|
||||
nothing: "Pusto"
|
||||
|
||||
desktop/views/widgets/post-form.vue:
|
||||
title: "Wpis"
|
||||
note: "Wpis"
|
||||
placeholder: "Co się dzieje?"
|
||||
|
||||
desktop/views/widgets/trends.vue:
|
||||
title: "Na czasie"
|
||||
refresh: "Pokaż inne"
|
||||
nothing: "Pusto"
|
||||
|
||||
desktop/views/widgets/users.vue:
|
||||
title: "Polecani użytkownicy"
|
||||
refresh: "Pokaż innych"
|
||||
no-one: "Pusto"
|
||||
|
||||
desktop/views/widgets/channel.vue:
|
||||
title: "Kanał"
|
||||
settings: "Ustawienia widżetu"
|
||||
|
||||
mobile/views/components/drive.vue:
|
||||
drive: "Dysk"
|
||||
used: "użyto"
|
||||
folder-count: "Katalog(i)"
|
||||
count-separator: ", "
|
||||
file-count: "Plik(i)"
|
||||
load-more: "Załaduj więcej"
|
||||
nothing-in-drive: "Pusto"
|
||||
folder-is-empty: "Ten katalog jest pusty"
|
||||
|
||||
mobile/views/components/drive-file-chooser.vue:
|
||||
select-file: "Wybierz plik"
|
||||
|
||||
mobile/views/components/drive-folder-chooser.vue:
|
||||
select-folder: "Wybierz katalog"
|
||||
|
||||
mobile/views/components/drive.file-detail.vue:
|
||||
download: "Pobierz"
|
||||
rename: "Zmień nazwę"
|
||||
move: "Przenieś"
|
||||
hash: "Hash (md5)"
|
||||
exif: "EXIF"
|
||||
|
||||
mobile/views/components/follow-button.vue:
|
||||
follow: "Śledź"
|
||||
unfollow: "Przestań śledzić"
|
||||
|
||||
mobile/views/components/note-detail.vue:
|
||||
reply: "Odpowiedz"
|
||||
reaction: "Reakcja"
|
||||
|
||||
mobile/views/components/notifications.vue:
|
||||
more: "Więcej"
|
||||
empty: "Brak powiadomień"
|
||||
|
||||
mobile/views/components/post-form.vue:
|
||||
submit: "Wyślij"
|
||||
reply-placeholder: "Odpowiedź na ten wpis…"
|
||||
note-placeholder: "Co się dzieje?"
|
||||
|
||||
mobile/views/components/sub-note-content.vue:
|
||||
media-count: "{} zawartości multimedialnej"
|
||||
poll: "Ankieta"
|
||||
|
||||
mobile/views/components/timeline.vue:
|
||||
empty: "Brak wpisów"
|
||||
load-more: "Więcej"
|
||||
|
||||
mobile/views/components/ui.nav.vue:
|
||||
home: "Strona główna"
|
||||
notifications: "Powiadomienia"
|
||||
messaging: "Wiadomości"
|
||||
drive: "Dysk"
|
||||
settings: "Ustawienia"
|
||||
about: "O Misskey"
|
||||
search: "Szukaj"
|
||||
|
||||
mobile/views/components/user-timeline.vue:
|
||||
no-notes: "Wygląda na to, że ten użytkownik nie opublikował jeszcze niczego"
|
||||
no-notes-with-media: "Brak wpisów z zawartością multimedialną"
|
||||
load-more: "Więcej"
|
||||
|
||||
mobile/views/components/users-list.vue:
|
||||
all: "Wszyscy"
|
||||
known: "Znasz"
|
||||
load-more: "Więcej"
|
||||
|
||||
mobile/views/pages/drive.vue:
|
||||
drive: "Dysk"
|
||||
|
||||
mobile/views/pages/followers.vue:
|
||||
followers-of: "Śledzący {}"
|
||||
|
||||
mobile/views/pages/following.vue:
|
||||
following-of: "Śledzeni przez {}"
|
||||
|
||||
mobile/views/pages/home.vue:
|
||||
timeline: "Oś czasu"
|
||||
|
||||
mobile/views/pages/messaging.vue:
|
||||
messaging: "Wiadomości"
|
||||
|
||||
mobile/views/pages/messaging-room.vue:
|
||||
messaging: "Wiadomości"
|
||||
|
||||
mobile/views/pages/note.vue:
|
||||
title: "Wyślij"
|
||||
prev: "Poprzedni wpis"
|
||||
next: "Następny wpis"
|
||||
|
||||
mobile/views/pages/notifications.vue:
|
||||
notifications: "Powiadomienia"
|
||||
read-all: "Czy na pewno chcesz oznaczyć wszystkie powiadomienia jako przeczytane?"
|
||||
|
||||
mobile/views/pages/profile-setting.vue:
|
||||
title: "Ustawienia profilu"
|
||||
will-be-published: "Te ustawienia profilu zostaną zaktualizowane."
|
||||
name: "Nazwa"
|
||||
location: "Lokalizacja"
|
||||
description: "Opis"
|
||||
birthday: "Data urodzenia"
|
||||
avatar: "Awatar"
|
||||
banner: "Baner"
|
||||
avatar-saved: "Pomyślnie zaktualizowano awatar"
|
||||
banner-saved: "Pomyślnie zaktualizowano baner"
|
||||
set-avatar: "Wybierz awatar"
|
||||
set-banner: "Wybierz baner"
|
||||
save: "Zapisz"
|
||||
saved: "Pomyślnie zaktualizowano profil"
|
||||
|
||||
mobile/views/pages/search.vue:
|
||||
search: "Szukaj"
|
||||
empty: "Nie znaleziono wpisów zawierających '{}'"
|
||||
|
||||
mobile/views/pages/selectdrive.vue:
|
||||
select-file: "Wybierz plik"
|
||||
|
||||
mobile/views/pages/settings.vue:
|
||||
signed-in-as: "Zalogowany jako {}"
|
||||
profile: "Profil"
|
||||
twitter-integration: "Integracja z Twitterem"
|
||||
signin-history: "Historia logowań"
|
||||
settings: "Ustawienia"
|
||||
signout: "Wyloguj"
|
||||
|
||||
mobile/views/pages/user.vue:
|
||||
follows-you: "Śledzi Cię"
|
||||
following: "Śledzeni"
|
||||
followers: "Śledzący"
|
||||
notes: "Wpisy"
|
||||
overview: "Przegląd"
|
||||
timeline: "Oś czasu"
|
||||
media: "Zawartość multimedialna"
|
||||
is-suspended: "To konto zostało zablokowane"
|
||||
is-remote: "To jest użytkownik zdalnej instancji, informacje mogą nie być w pełni dokładne."
|
||||
view-remote: "Wyświetl dokładne informacje"
|
||||
|
||||
mobile/views/pages/user/home.vue:
|
||||
recent-notes: "Ostatnie wpisy"
|
||||
images: "Zdjęcia"
|
||||
activity: "Aktywność"
|
||||
keywords: "Słowa kluczowe"
|
||||
domains: "Domeny"
|
||||
frequently-replied-users: "Często aktywni użytkownicy"
|
||||
followers-you-know: "Śledzący których znasz"
|
||||
last-used-at: "Ostatnio aktywny:"
|
||||
|
||||
mobile/views/pages/user/home.followers-you-know.vue:
|
||||
loading: "Ładowanie"
|
||||
no-users: "Brak użytkowników"
|
||||
|
||||
mobile/views/pages/user/home.friends.vue:
|
||||
loading: "Ładowanie"
|
||||
no-users: "Brak użytkowników"
|
||||
|
||||
mobile/views/pages/user/home.notes.vue:
|
||||
loading: "Ładowanie"
|
||||
no-notes: "Brak wpisów"
|
||||
|
||||
mobile/views/pages/user/home.photos.vue:
|
||||
loading: "Ładowanie"
|
||||
no-photos: "Brak zdjęć"
|
||||
|
||||
docs:
|
||||
edit-this-page-on-github: "Znalazłeś błąd lub chcesz pomóc w tworzeniu dokumentacji?"
|
||||
edit-this-page-on-github-link: "Edytuj stronę na GitHubie!"
|
||||
|
||||
api:
|
||||
entities:
|
||||
properties: "Właściwości"
|
||||
endpoints:
|
||||
params: "Parametry"
|
||||
res: "Odpowiedź"
|
||||
props:
|
||||
name: "Nazwa"
|
||||
type: "Rodzaj"
|
||||
optional: "Nieobowiązkowy"
|
||||
description: "Opis"
|
||||
yes: "Tak"
|
||||
no: "Nie"
|
57
migration/2.0.0.js
Normal file
57
migration/2.0.0.js
Normal file
@ -0,0 +1,57 @@
|
||||
// for Node.js interpret
|
||||
|
||||
const chalk = require('chalk');
|
||||
const sequential = require('promise-sequential');
|
||||
|
||||
const { default: User } = require('../built/models/user');
|
||||
const { default: DriveFile } = require('../built/models/drive-file');
|
||||
|
||||
async function main() {
|
||||
const promiseGens = [];
|
||||
|
||||
const count = await DriveFile.count({});
|
||||
|
||||
let prev;
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
promiseGens.push(() => {
|
||||
const promise = new Promise(async (res, rej) => {
|
||||
const file = await DriveFile.findOne(prev ? {
|
||||
_id: { $gt: prev._id }
|
||||
} : {}, {
|
||||
sort: {
|
||||
_id: 1
|
||||
}
|
||||
});
|
||||
|
||||
prev = file;
|
||||
|
||||
const user = await User.findOne({ _id: file.metadata.userId });
|
||||
|
||||
DriveFile.update({
|
||||
_id: file._id
|
||||
}, {
|
||||
$set: {
|
||||
'metadata._user': {
|
||||
host: user.host
|
||||
}
|
||||
}
|
||||
}).then(() => {
|
||||
res([i, file]);
|
||||
}).catch(rej);
|
||||
});
|
||||
|
||||
promise.then(([i, file]) => {
|
||||
console.log(chalk`{gray ${i}} {green done: {bold ${file._id}} ${file.filename}}`);
|
||||
});
|
||||
|
||||
return promise;
|
||||
});
|
||||
}
|
||||
|
||||
return await sequential(promiseGens);
|
||||
}
|
||||
|
||||
main().then(() => {
|
||||
console.log('ALL DONE');
|
||||
}).catch(console.error);
|
@ -1,49 +0,0 @@
|
||||
// for Node.js interpret
|
||||
|
||||
const { default: User } = require('../built/models/user');
|
||||
const { default: Following } = require('../built/models/following');
|
||||
const { default: zip } = require('@prezzemolo/zip')
|
||||
|
||||
const migrate = async (following) => {
|
||||
const follower = await User.findOne({ _id: following.followerId });
|
||||
const followee = await User.findOne({ _id: following.followeeId });
|
||||
const result = await Following.update(following._id, {
|
||||
$set: {
|
||||
stalk: true,
|
||||
_follower: {
|
||||
host: follower.host,
|
||||
inbox: follower.host != null ? follower.inbox : undefined
|
||||
},
|
||||
_followee: {
|
||||
host: followee.host,
|
||||
inbox: followee.host != null ? followee.inbox : undefined
|
||||
}
|
||||
}
|
||||
});
|
||||
return result.ok === 1;
|
||||
}
|
||||
|
||||
async function main() {
|
||||
const count = await Following.count({});
|
||||
|
||||
const dop = Number.parseInt(process.argv[2]) || 5
|
||||
const idop = ((count - (count % dop)) / dop) + 1
|
||||
|
||||
return zip(
|
||||
1,
|
||||
async (time) => {
|
||||
console.log(`${time} / ${idop}`)
|
||||
const doc = await Following.find({}, {
|
||||
limit: dop, skip: time * dop
|
||||
})
|
||||
return Promise.all(doc.map(migrate))
|
||||
},
|
||||
idop
|
||||
).then(a => {
|
||||
const rv = []
|
||||
a.forEach(e => rv.push(...e))
|
||||
return rv
|
||||
})
|
||||
}
|
||||
|
||||
main().then(console.dir).catch(console.error)
|
11
package.json
11
package.json
@ -1,8 +1,8 @@
|
||||
{
|
||||
"name": "misskey",
|
||||
"author": "syuilo <i@syuilo.com>",
|
||||
"version": "1.5.0",
|
||||
"clientVersion": "1.0.5165",
|
||||
"version": "2.3.0",
|
||||
"clientVersion": "1.0.5207",
|
||||
"codename": "nighthike",
|
||||
"main": "./built/index.js",
|
||||
"private": true,
|
||||
@ -58,6 +58,7 @@
|
||||
"@types/koa-multer": "1.0.0",
|
||||
"@types/koa-router": "7.0.28",
|
||||
"@types/koa-send": "4.1.1",
|
||||
"@types/koa-views": "^2.0.3",
|
||||
"@types/koa__cors": "2.2.2",
|
||||
"@types/kue": "0.11.8",
|
||||
"@types/license-checker": "15.0.0",
|
||||
@ -76,6 +77,7 @@
|
||||
"@types/request-promise-native": "1.0.14",
|
||||
"@types/rimraf": "2.0.2",
|
||||
"@types/seedrandom": "2.4.27",
|
||||
"@types/single-line-log": "^1.1.0",
|
||||
"@types/speakeasy": "2.0.2",
|
||||
"@types/tmp": "0.0.33",
|
||||
"@types/uuid": "3.4.3",
|
||||
@ -88,7 +90,7 @@
|
||||
"autwh": "0.1.0",
|
||||
"bcryptjs": "2.4.3",
|
||||
"bootstrap-vue": "2.0.0-rc.6",
|
||||
"cafy": "7.0.1",
|
||||
"cafy": "8.0.0",
|
||||
"chai": "4.1.2",
|
||||
"chai-http": "4.0.0",
|
||||
"chalk": "2.4.1",
|
||||
@ -145,6 +147,7 @@
|
||||
"koa-router": "7.4.0",
|
||||
"koa-send": "4.1.3",
|
||||
"koa-slow": "2.1.0",
|
||||
"koa-views": "^6.1.4",
|
||||
"kue": "0.11.6",
|
||||
"license-checker": "18.0.0",
|
||||
"loader-utils": "1.1.0",
|
||||
@ -165,6 +168,7 @@
|
||||
"os-utils": "0.0.14",
|
||||
"progress-bar-webpack-plugin": "1.11.0",
|
||||
"prominence": "0.2.0",
|
||||
"promise-sequential": "^1.1.1",
|
||||
"pug": "2.0.3",
|
||||
"punycode": "2.1.0",
|
||||
"qrcode": "1.2.0",
|
||||
@ -179,6 +183,7 @@
|
||||
"s-age": "1.1.2",
|
||||
"sass-loader": "7.0.1",
|
||||
"seedrandom": "2.4.3",
|
||||
"single-line-log": "^1.1.2",
|
||||
"speakeasy": "2.0.0",
|
||||
"style-loader": "0.21.0",
|
||||
"stylus": "0.54.5",
|
||||
|
@ -8,8 +8,8 @@ export const isNotAnId = x => !isAnId(x);
|
||||
* ID
|
||||
*/
|
||||
export default class ID extends Query<mongo.ObjectID> {
|
||||
constructor(...args) {
|
||||
super(...args);
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.transform = v => {
|
||||
if (isAnId(v) && !mongo.ObjectID.prototype.isPrototypeOf(v)) {
|
||||
@ -19,7 +19,7 @@ export default class ID extends Query<mongo.ObjectID> {
|
||||
}
|
||||
};
|
||||
|
||||
this.pushValidator(v => {
|
||||
this.push(v => {
|
||||
if (!mongo.ObjectID.prototype.isPrototypeOf(v) && isNotAnId(v)) {
|
||||
return new Error('must-be-an-id');
|
||||
}
|
||||
|
@ -1,3 +1,5 @@
|
||||
block vars
|
||||
|
||||
doctype html
|
||||
|
||||
!= '\n<!-- Thank you for using Misskey! @syuilo -->\n'
|
||||
@ -9,9 +11,17 @@ html
|
||||
meta(name='application-name' content='Misskey')
|
||||
meta(name='theme-color' content=themeColor)
|
||||
meta(name='referrer' content='origin')
|
||||
meta(property='og:site_name' content='Misskey')
|
||||
link(rel='manifest' href='/manifest.json')
|
||||
|
||||
title Misskey
|
||||
title
|
||||
block title
|
||||
| Misskey
|
||||
|
||||
block desc
|
||||
meta(name='description' content='A SNS')
|
||||
|
||||
block meta
|
||||
|
||||
style
|
||||
include ./../../../built/client/assets/init.css
|
||||
|
@ -26,7 +26,7 @@ export default Vue.extend({
|
||||
|
||||
<style lang="stylus" scoped>
|
||||
.mk-avatar
|
||||
display block
|
||||
display inline-block
|
||||
|
||||
> img
|
||||
display inline-block
|
||||
|
@ -2,7 +2,7 @@
|
||||
<div class="mk-media-list" :data-count="mediaList.length">
|
||||
<template v-for="media in mediaList">
|
||||
<mk-media-video :video="media" :key="media.id" v-if="media.type.startsWith('video')" :inline-playable="mediaList.length === 1"/>
|
||||
<mk-media-image :image="media" :key="media.id" v-else />
|
||||
<mk-media-image :image="media" :key="media.id" v-else :raw="raw"/>
|
||||
</template>
|
||||
</div>
|
||||
</template>
|
||||
@ -11,7 +11,14 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
export default Vue.extend({
|
||||
props: ['mediaList'],
|
||||
props: {
|
||||
mediaList: {
|
||||
required: true
|
||||
},
|
||||
raw: {
|
||||
default: false
|
||||
}
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
@ -23,7 +30,7 @@ export default Vue.extend({
|
||||
|
||||
@media (max-width 500px)
|
||||
height 192px
|
||||
|
||||
|
||||
&[data-count="1"]
|
||||
grid-template-rows 1fr
|
||||
&[data-count="2"]
|
||||
@ -40,7 +47,7 @@ export default Vue.extend({
|
||||
&[data-count="4"]
|
||||
grid-template-columns 1fr 1fr
|
||||
grid-template-rows 1fr 1fr
|
||||
|
||||
|
||||
:nth-child(1)
|
||||
grid-column 1 / 2
|
||||
grid-row 1 / 2
|
||||
@ -53,5 +60,5 @@ export default Vue.extend({
|
||||
:nth-child(4)
|
||||
grid-column 2 / 3
|
||||
grid-row 2 / 3
|
||||
|
||||
|
||||
</style>
|
||||
|
@ -31,7 +31,7 @@
|
||||
<section v-if="invitations.length > 0">
|
||||
<h2>対局の招待があります!:</h2>
|
||||
<div class="invitation" v-for="i in invitations" tabindex="-1" @click="accept(i)">
|
||||
<img :src="`${i.parent.avatarUrl}?thumbnail&size=32`" alt="">
|
||||
<mk-avatar class="avatar" :user="i.parent"/>
|
||||
<span class="name"><b>{{ i.parent.name }}</b></span>
|
||||
<span class="username">@{{ i.parent.username }}</span>
|
||||
<mk-time :time="i.createdAt"/>
|
||||
@ -40,8 +40,8 @@
|
||||
<section v-if="myGames.length > 0">
|
||||
<h2>自分の対局</h2>
|
||||
<a class="game" v-for="g in myGames" tabindex="-1" @click.prevent="go(g)" :href="`/othello/${g.id}`">
|
||||
<img :src="`${g.user1.avatarUrl}?thumbnail&size=32`" alt="">
|
||||
<img :src="`${g.user2.avatarUrl}?thumbnail&size=32`" alt="">
|
||||
<mk-avatar class="avatar" :user="g.user1"/>
|
||||
<mk-avatar class="avatar" :user="g.user2"/>
|
||||
<span><b>{{ g.user1.name }}</b> vs <b>{{ g.user2.name }}</b></span>
|
||||
<span class="state">{{ g.isEnded ? '終了' : '進行中' }}</span>
|
||||
</a>
|
||||
@ -49,8 +49,8 @@
|
||||
<section v-if="games.length > 0">
|
||||
<h2>みんなの対局</h2>
|
||||
<a class="game" v-for="g in games" tabindex="-1" @click.prevent="go(g)" :href="`/othello/${g.id}`">
|
||||
<img :src="`${g.user1.avatarUrl}?thumbnail&size=32`" alt="">
|
||||
<img :src="`${g.user2.avatarUrl}?thumbnail&size=32`" alt="">
|
||||
<mk-avatar class="avatar" :user="g.user1"/>
|
||||
<mk-avatar class="avatar" :user="g.user2"/>
|
||||
<span><b>{{ g.user1.name }}</b> vs <b>{{ g.user2.name }}</b></span>
|
||||
<span class="state">{{ g.isEnded ? '終了' : '進行中' }}</span>
|
||||
</a>
|
||||
@ -271,8 +271,9 @@ export default Vue.extend({
|
||||
&:active
|
||||
background #eee
|
||||
|
||||
> img
|
||||
vertical-align bottom
|
||||
> .avatar
|
||||
width 32px
|
||||
height 32px
|
||||
border-radius 100%
|
||||
|
||||
> span
|
||||
@ -301,8 +302,9 @@ export default Vue.extend({
|
||||
&:active
|
||||
background #eee
|
||||
|
||||
> img
|
||||
vertical-align bottom
|
||||
> .avatar
|
||||
width 32px
|
||||
height 32px
|
||||
border-radius 100%
|
||||
|
||||
> span
|
||||
|
@ -5,7 +5,7 @@
|
||||
cx="50%" cy="50%"
|
||||
fill="none"
|
||||
stroke-width="0.1"
|
||||
stroke="rgba(#000, 0.05)"/>
|
||||
stroke="rgba(0, 0, 0, 0.05)"/>
|
||||
<circle
|
||||
:r="r"
|
||||
cx="50%" cy="50%"
|
||||
|
@ -250,7 +250,7 @@ root(isDark)
|
||||
> div
|
||||
display flex
|
||||
margin 0 auto
|
||||
max-width 1200px - 32px
|
||||
max-width 1220px - 32px
|
||||
|
||||
> div
|
||||
width 50%
|
||||
@ -281,7 +281,7 @@ root(isDark)
|
||||
display flex
|
||||
justify-content center
|
||||
margin 0 auto
|
||||
max-width 1200px
|
||||
max-width 1220px
|
||||
|
||||
> *
|
||||
.customize-container
|
||||
|
@ -14,12 +14,20 @@ import Vue from 'vue';
|
||||
import MkMediaImageDialog from './media-image-dialog.vue';
|
||||
|
||||
export default Vue.extend({
|
||||
props: ['image'],
|
||||
props: {
|
||||
image: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
raw: {
|
||||
default: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
style(): any {
|
||||
return {
|
||||
'background-color': this.image.properties.avgColor ? `rgb(${this.image.properties.avgColor.join(',')})` : 'transparent',
|
||||
'background-image': `url(${this.image.url}?thumbnail&size=512)`
|
||||
'background-image': this.raw ? `url(${this.image.url})` : `url(${this.image.url}?thumbnail&size=512)`
|
||||
};
|
||||
}
|
||||
},
|
||||
|
@ -52,6 +52,7 @@ export default Vue.extend({
|
||||
width 100%
|
||||
height 100%
|
||||
border-radius 4px
|
||||
|
||||
.mk-media-video-thumbnail
|
||||
display flex
|
||||
justify-content center
|
||||
|
@ -39,7 +39,7 @@
|
||||
<mk-note-html v-if="p.text" :text="p.text" :i="os.i"/>
|
||||
</div>
|
||||
<div class="media" v-if="p.media.length > 0">
|
||||
<mk-media-list :media-list="p.media"/>
|
||||
<mk-media-list :media-list="p.media" :raw="true"/>
|
||||
</div>
|
||||
<mk-poll v-if="p.poll" :note="p"/>
|
||||
<mk-url-preview v-for="url in urls" :url="url" :key="url"/>
|
||||
|
@ -53,6 +53,7 @@ root(isDark)
|
||||
|
||||
> header
|
||||
display flex
|
||||
align-items baseline
|
||||
white-space nowrap
|
||||
|
||||
> .name
|
||||
|
@ -65,6 +65,7 @@ root(isDark)
|
||||
|
||||
> header
|
||||
display flex
|
||||
align-items baseline
|
||||
margin-bottom 2px
|
||||
white-space nowrap
|
||||
line-height 21px
|
||||
|
@ -400,7 +400,7 @@ root(isDark)
|
||||
|
||||
> header
|
||||
display flex
|
||||
align-items center
|
||||
align-items baseline
|
||||
margin-bottom 4px
|
||||
white-space nowrap
|
||||
|
||||
|
@ -83,6 +83,7 @@
|
||||
<el-option label="ja-JP" value="ja"/>
|
||||
<el-option label="en-US" value="en"/>
|
||||
<el-option label="fr" value="fr"/>
|
||||
<el-option label="pl" value="pl"/>
|
||||
</el-option-group>
|
||||
</el-select>
|
||||
<div class="none ui info">
|
||||
|
@ -2,8 +2,8 @@
|
||||
<div class="header" :data-is-dark-background="user.bannerUrl != null">
|
||||
<div class="is-suspended" v-if="user.isSuspended"><p>%fa:exclamation-triangle% %i18n:@is-suspended%</p></div>
|
||||
<div class="is-remote" v-if="user.host != null"><p>%fa:exclamation-triangle% %i18n:@is-remote%<a :href="user.url || user.uri" target="_blank">%i18n:@view-remote%</a></p></div>
|
||||
<div class="banner-container" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl}?thumbnail&size=2048)` : ''">
|
||||
<div class="banner" ref="banner" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl}?thumbnail&size=2048)` : ''" @click="onBannerClick"></div>
|
||||
<div class="banner-container" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl})` : ''">
|
||||
<div class="banner" ref="banner" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl})` : ''" @click="onBannerClick"></div>
|
||||
<div class="fade"></div>
|
||||
</div>
|
||||
<div class="container">
|
||||
|
@ -6,12 +6,20 @@
|
||||
import Vue from 'vue';
|
||||
|
||||
export default Vue.extend({
|
||||
props: ['image'],
|
||||
props: {
|
||||
image: {
|
||||
type: Object,
|
||||
required: true
|
||||
},
|
||||
raw: {
|
||||
default: false
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
style(): any {
|
||||
return {
|
||||
'background-color': this.image.properties.avgColor ? `rgb(${this.image.properties.avgColor.join(',')})` : 'transparent',
|
||||
'background-image': `url(${this.image.url}?thumbnail&size=512)`
|
||||
'background-image': this.raw ? `url(${this.image.url})` : `url(${this.image.url}?thumbnail&size=512)`
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -55,6 +55,7 @@ root(isDark)
|
||||
|
||||
> header
|
||||
display flex
|
||||
align-items baseline
|
||||
margin-bottom 4px
|
||||
white-space nowrap
|
||||
|
||||
|
@ -37,7 +37,7 @@
|
||||
<router-link v-for="tag in p.tags" :key="tag" :to="`/search?q=#${tag}`">{{ tag }}</router-link>
|
||||
</div>
|
||||
<div class="media" v-if="p.media.length > 0">
|
||||
<mk-media-list :media-list="p.media"/>
|
||||
<mk-media-list :media-list="p.media" :raw="true"/>
|
||||
</div>
|
||||
<mk-poll v-if="p.poll" :note="p"/>
|
||||
<mk-url-preview v-for="url in urls" :url="url" :key="url"/>
|
||||
|
@ -49,6 +49,7 @@ root(isDark)
|
||||
|
||||
> header
|
||||
display flex
|
||||
align-items baseline
|
||||
margin-bottom 4px
|
||||
white-space nowrap
|
||||
|
||||
|
@ -69,6 +69,7 @@ root(isDark)
|
||||
|
||||
> header
|
||||
display flex
|
||||
align-items baseline
|
||||
margin-bottom 2px
|
||||
white-space nowrap
|
||||
|
||||
|
@ -333,7 +333,7 @@ root(isDark)
|
||||
|
||||
> header
|
||||
display flex
|
||||
align-items center
|
||||
align-items baseline
|
||||
white-space nowrap
|
||||
|
||||
@media (min-width 500px)
|
||||
|
@ -124,7 +124,7 @@ root(isDark)
|
||||
|
||||
> header
|
||||
display flex
|
||||
align-items center
|
||||
align-items baseline
|
||||
white-space nowrap
|
||||
|
||||
i, .mk-reaction-icon
|
||||
|
@ -16,6 +16,7 @@ const fetchLimit = 10;
|
||||
|
||||
export default Vue.extend({
|
||||
props: ['user', 'withMedia'],
|
||||
|
||||
data() {
|
||||
return {
|
||||
fetching: true,
|
||||
@ -23,9 +24,17 @@ export default Vue.extend({
|
||||
moreFetching: false
|
||||
};
|
||||
},
|
||||
|
||||
computed: {
|
||||
canFetchMore(): boolean {
|
||||
return !this.moreFetching && !this.fetching && this.existMore;
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.fetch();
|
||||
},
|
||||
|
||||
methods: {
|
||||
fetch() {
|
||||
this.fetching = true;
|
||||
@ -45,7 +54,10 @@ export default Vue.extend({
|
||||
}, rej);
|
||||
}));
|
||||
},
|
||||
|
||||
more() {
|
||||
if (!this.canFetchMore) return;
|
||||
|
||||
this.moreFetching = true;
|
||||
(this as any).api('users/notes', {
|
||||
userId: this.user.id,
|
||||
|
@ -5,7 +5,7 @@
|
||||
<div class="is-suspended" v-if="user.isSuspended"><p>%fa:exclamation-triangle% %i18n:@is-suspended%</p></div>
|
||||
<div class="is-remote" v-if="user.host != null"><p>%fa:exclamation-triangle% %i18n:@is-remote%<a :href="user.url || user.uri" target="_blank">%i18n:@view-remote%</a></p></div>
|
||||
<header>
|
||||
<div class="banner" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl}?thumbnail&size=1024)` : ''"></div>
|
||||
<div class="banner" :style="user.bannerUrl ? `background-image: url(${user.bannerUrl})` : ''"></div>
|
||||
<div class="body">
|
||||
<div class="top">
|
||||
<a class="avatar">
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"copyright": "Copyright (c) 2014-2018 syuilo",
|
||||
"themeColor": "#5cbb2d",
|
||||
"themeColor": "#f66e4f",
|
||||
"themeColorForeground": "#fff"
|
||||
}
|
||||
|
25
src/drive/gen-thumbnail.ts
Normal file
25
src/drive/gen-thumbnail.ts
Normal file
@ -0,0 +1,25 @@
|
||||
import * as stream from 'stream';
|
||||
import * as Gm from 'gm';
|
||||
import { IDriveFile, getDriveFileBucket } from '../models/drive-file';
|
||||
|
||||
const gm = Gm.subClass({
|
||||
imageMagick: true
|
||||
});
|
||||
|
||||
export default async function(file: IDriveFile): Promise<stream.Readable> {
|
||||
if (!/^image\/.*$/.test(file.contentType)) return null;
|
||||
|
||||
const bucket = await getDriveFileBucket();
|
||||
const readable = bucket.openDownloadStream(file._id);
|
||||
|
||||
const g = gm(readable);
|
||||
|
||||
const stream = g
|
||||
.resize(256, 256)
|
||||
.compress('jpeg')
|
||||
.quality(70)
|
||||
.interlace('line')
|
||||
.stream();
|
||||
|
||||
return stream;
|
||||
}
|
61
src/models/drive-file-thumbnail.ts
Normal file
61
src/models/drive-file-thumbnail.ts
Normal file
@ -0,0 +1,61 @@
|
||||
import * as mongo from 'mongodb';
|
||||
import monkDb, { nativeDbConn } from '../db/mongodb';
|
||||
|
||||
const DriveFileThumbnail = monkDb.get<IDriveFileThumbnail>('driveFileThumbnails.files');
|
||||
DriveFileThumbnail.createIndex('metadata.originalId', { sparse: true, unique: true });
|
||||
export default DriveFileThumbnail;
|
||||
|
||||
export const DriveFileThumbnailChunk = monkDb.get('driveFileThumbnails.chunks');
|
||||
|
||||
export const getDriveFileThumbnailBucket = async (): Promise<mongo.GridFSBucket> => {
|
||||
const db = await nativeDbConn();
|
||||
const bucket = new mongo.GridFSBucket(db, {
|
||||
bucketName: 'driveFileThumbnails'
|
||||
});
|
||||
return bucket;
|
||||
};
|
||||
|
||||
export type IMetadata = {
|
||||
originalId: mongo.ObjectID;
|
||||
};
|
||||
|
||||
export type IDriveFileThumbnail = {
|
||||
_id: mongo.ObjectID;
|
||||
uploadDate: Date;
|
||||
md5: string;
|
||||
filename: string;
|
||||
contentType: string;
|
||||
metadata: IMetadata;
|
||||
};
|
||||
|
||||
/**
|
||||
* DriveFileThumbnailを物理削除します
|
||||
*/
|
||||
export async function deleteDriveFileThumbnail(driveFile: string | mongo.ObjectID | IDriveFileThumbnail) {
|
||||
let d: IDriveFileThumbnail;
|
||||
|
||||
// Populate
|
||||
if (mongo.ObjectID.prototype.isPrototypeOf(driveFile)) {
|
||||
d = await DriveFileThumbnail.findOne({
|
||||
_id: driveFile
|
||||
});
|
||||
} else if (typeof driveFile === 'string') {
|
||||
d = await DriveFileThumbnail.findOne({
|
||||
_id: new mongo.ObjectID(driveFile)
|
||||
});
|
||||
} else {
|
||||
d = driveFile as IDriveFileThumbnail;
|
||||
}
|
||||
|
||||
if (d == null) return;
|
||||
|
||||
// このDriveFileThumbnailのチャンクをすべて削除
|
||||
await DriveFileThumbnailChunk.remove({
|
||||
files_id: d._id
|
||||
});
|
||||
|
||||
// このDriveFileThumbnailを削除
|
||||
await DriveFileThumbnail.remove({
|
||||
_id: d._id
|
||||
});
|
||||
}
|
@ -6,6 +6,7 @@ import monkDb, { nativeDbConn } from '../db/mongodb';
|
||||
import Note, { deleteNote } from './note';
|
||||
import MessagingMessage, { deleteMessagingMessage } from './messaging-message';
|
||||
import User from './user';
|
||||
import DriveFileThumbnail, { deleteDriveFileThumbnail } from './drive-file-thumbnail';
|
||||
|
||||
const DriveFile = monkDb.get<IDriveFile>('driveFiles.files');
|
||||
DriveFile.createIndex('metadata.uri', { sparse: true, unique: true });
|
||||
@ -13,7 +14,7 @@ export default DriveFile;
|
||||
|
||||
export const DriveFileChunk = monkDb.get('driveFiles.chunks');
|
||||
|
||||
const getGridFSBucket = async (): Promise<mongo.GridFSBucket> => {
|
||||
export const getDriveFileBucket = async (): Promise<mongo.GridFSBucket> => {
|
||||
const db = await nativeDbConn();
|
||||
const bucket = new mongo.GridFSBucket(db, {
|
||||
bucketName: 'driveFiles'
|
||||
@ -21,15 +22,16 @@ const getGridFSBucket = async (): Promise<mongo.GridFSBucket> => {
|
||||
return bucket;
|
||||
};
|
||||
|
||||
export { getGridFSBucket };
|
||||
|
||||
export type IMetadata = {
|
||||
properties: any;
|
||||
userId: mongo.ObjectID;
|
||||
_user: any;
|
||||
folderId: mongo.ObjectID;
|
||||
comment: string;
|
||||
uri: string;
|
||||
uri?: string;
|
||||
url?: string;
|
||||
deletedAt?: Date;
|
||||
isExpired?: boolean;
|
||||
};
|
||||
|
||||
export type IDriveFile = {
|
||||
@ -93,6 +95,11 @@ export async function deleteDriveFile(driveFile: string | mongo.ObjectID | IDriv
|
||||
}
|
||||
}
|
||||
|
||||
// このDriveFileのDriveFileThumbnailをすべて削除
|
||||
await Promise.all((
|
||||
await DriveFileThumbnail.find({ 'metadata.originalId': d._id })
|
||||
).map(x => deleteDriveFileThumbnail(x)));
|
||||
|
||||
// このDriveFileのチャンクをすべて削除
|
||||
await DriveFileChunk.remove({
|
||||
files_id: d._id
|
||||
|
@ -17,7 +17,7 @@ export interface INoteReaction {
|
||||
reaction: string;
|
||||
}
|
||||
|
||||
export const validateReaction = $().string().or([
|
||||
export const validateReaction = $.str.or([
|
||||
'like',
|
||||
'love',
|
||||
'laugh',
|
||||
|
@ -286,7 +286,7 @@ export const pack = async (
|
||||
_id: -1
|
||||
}
|
||||
});
|
||||
return prev ? prev._id : null;
|
||||
return prev ? prev._id.toHexString() : null;
|
||||
})();
|
||||
|
||||
// Get next note info
|
||||
@ -304,7 +304,7 @@ export const pack = async (
|
||||
_id: 1
|
||||
}
|
||||
});
|
||||
return next ? next._id : null;
|
||||
return next ? next._id.toHexString() : null;
|
||||
})();
|
||||
|
||||
if (_note.replyId) {
|
||||
|
@ -24,7 +24,7 @@ export async function createImage(actor: IRemoteUser, value): Promise<IDriveFile
|
||||
|
||||
log(`Creating the Image: ${image.url}`);
|
||||
|
||||
return await uploadFromUrl(image.url, actor);
|
||||
return await uploadFromUrl(image.url, actor, null, image.url);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 投稿を表す文字列を取得します。
|
||||
* @param {*} note 投稿
|
||||
* @param {*} note (packされた)投稿
|
||||
*/
|
||||
const summarize = (note: any): string => {
|
||||
if (note.isHidden) {
|
||||
|
@ -9,7 +9,7 @@ import Note from '../../../../models/note';
|
||||
*/
|
||||
module.exports = params => new Promise(async (res, rej) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 365, limitErr] = $(params.limit).optional.number().range(1, 365).get();
|
||||
const [limit = 365, limitErr] = $.num.optional().range(1, 365).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
const datas = await Note
|
||||
|
@ -9,7 +9,7 @@ import User from '../../../../models/user';
|
||||
*/
|
||||
module.exports = params => new Promise(async (res, rej) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 365, limitErr] = $(params.limit).optional.number().range(1, 365).get();
|
||||
const [limit = 365, limitErr] = $.num.optional().range(1, 365).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
const users = await User
|
||||
|
@ -12,11 +12,11 @@ import Note from '../../../../../models/note';
|
||||
*/
|
||||
module.exports = (params) => new Promise(async (res, rej) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 365, limitErr] = $(params.limit).optional.number().range(1, 365).get();
|
||||
const [limit = 365, limitErr] = $.num.optional().range(1, 365).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'userId' parameter
|
||||
const [userId, userIdErr] = $(params.userId).type(ID).get();
|
||||
const [userId, userIdErr] = $.type(ID).get(params.userId);
|
||||
if (userIdErr) return rej('invalid userId param');
|
||||
|
||||
// Lookup user
|
||||
|
@ -10,7 +10,7 @@ import FollowedLog from '../../../../../models/followed-log';
|
||||
*/
|
||||
module.exports = (params) => new Promise(async (res, rej) => {
|
||||
// Get 'userId' parameter
|
||||
const [userId, userIdErr] = $(params.userId).type(ID).get();
|
||||
const [userId, userIdErr] = $.type(ID).get(params.userId);
|
||||
if (userIdErr) return rej('invalid userId param');
|
||||
|
||||
// Lookup user
|
||||
|
@ -10,7 +10,7 @@ import FollowingLog from '../../../../../models/following-log';
|
||||
*/
|
||||
module.exports = (params) => new Promise(async (res, rej) => {
|
||||
// Get 'userId' parameter
|
||||
const [userId, userIdErr] = $(params.userId).type(ID).get();
|
||||
const [userId, userIdErr] = $.type(ID).get(params.userId);
|
||||
if (userIdErr) return rej('invalid userId param');
|
||||
|
||||
// Lookup user
|
||||
|
@ -10,7 +10,7 @@ import Note from '../../../../../models/note';
|
||||
*/
|
||||
module.exports = (params) => new Promise(async (res, rej) => {
|
||||
// Get 'userId' parameter
|
||||
const [userId, userIdErr] = $(params.userId).type(ID).get();
|
||||
const [userId, userIdErr] = $.type(ID).get(params.userId);
|
||||
if (userIdErr) return rej('invalid userId param');
|
||||
|
||||
// Lookup user
|
||||
|
@ -13,7 +13,7 @@ import Reaction from '../../../../../models/note-reaction';
|
||||
*/
|
||||
module.exports = (params) => new Promise(async (res, rej) => {
|
||||
// Get 'userId' parameter
|
||||
const [userId, userIdErr] = $(params.userId).type(ID).get();
|
||||
const [userId, userIdErr] = $.type(ID).get(params.userId);
|
||||
if (userIdErr) return rej('invalid userId param');
|
||||
|
||||
// Lookup user
|
||||
|
@ -67,24 +67,24 @@ import App, { isValidNameId, pack } from '../../../../models/app';
|
||||
*/
|
||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'nameId' parameter
|
||||
const [nameId, nameIdErr] = $(params.nameId).string().pipe(isValidNameId).get();
|
||||
const [nameId, nameIdErr] = $.str.pipe(isValidNameId).get(params.nameId);
|
||||
if (nameIdErr) return rej('invalid nameId param');
|
||||
|
||||
// Get 'name' parameter
|
||||
const [name, nameErr] = $(params.name).string().get();
|
||||
const [name, nameErr] = $.str.get(params.name);
|
||||
if (nameErr) return rej('invalid name param');
|
||||
|
||||
// Get 'description' parameter
|
||||
const [description, descriptionErr] = $(params.description).string().get();
|
||||
const [description, descriptionErr] = $.str.get(params.description);
|
||||
if (descriptionErr) return rej('invalid description param');
|
||||
|
||||
// Get 'permission' parameter
|
||||
const [permission, permissionErr] = $(params.permission).array($().string()).unique().get();
|
||||
const [permission, permissionErr] = $.arr($.str).unique().get(params.permission);
|
||||
if (permissionErr) return rej('invalid permission param');
|
||||
|
||||
// Get 'callbackUrl' parameter
|
||||
// TODO: Check it is valid url
|
||||
const [callbackUrl = null, callbackUrlErr] = $(params.callbackUrl).optional.nullable.string().get();
|
||||
const [callbackUrl = null, callbackUrlErr] = $.str.optional().nullable().get(params.callbackUrl);
|
||||
if (callbackUrlErr) return rej('invalid callbackUrl param');
|
||||
|
||||
// Generate secret
|
||||
|
@ -42,7 +42,7 @@ import { isValidNameId } from '../../../../../models/app';
|
||||
*/
|
||||
module.exports = async (params) => new Promise(async (res, rej) => {
|
||||
// Get 'nameId' parameter
|
||||
const [nameId, nameIdErr] = $(params.nameId).string().pipe(isValidNameId).get();
|
||||
const [nameId, nameIdErr] = $.str.pipe(isValidNameId).get(params.nameId);
|
||||
if (nameIdErr) return rej('invalid nameId param');
|
||||
|
||||
// Get exist
|
||||
|
@ -41,11 +41,11 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
|
||||
const isSecure = user != null && app == null;
|
||||
|
||||
// Get 'appId' parameter
|
||||
const [appId, appIdErr] = $(params.appId).optional.type(ID).get();
|
||||
const [appId, appIdErr] = $.type(ID).optional().get(params.appId);
|
||||
if (appIdErr) return rej('invalid appId param');
|
||||
|
||||
// Get 'nameId' parameter
|
||||
const [nameId, nameIdErr] = $(params.nameId).optional.string().get();
|
||||
const [nameId, nameIdErr] = $.str.optional().get(params.nameId);
|
||||
if (nameIdErr) return rej('invalid nameId param');
|
||||
|
||||
if (appId === undefined && nameId === undefined) {
|
||||
|
@ -40,7 +40,7 @@ import AccessToken from '../../../../models/access-token';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'token' parameter
|
||||
const [token, tokenErr] = $(params.token).string().get();
|
||||
const [token, tokenErr] = $.str.get(params.token);
|
||||
if (tokenErr) return rej('invalid token param');
|
||||
|
||||
// Fetch token
|
||||
|
@ -46,7 +46,7 @@ import config from '../../../../../config';
|
||||
*/
|
||||
module.exports = (params) => new Promise(async (res, rej) => {
|
||||
// Get 'appSecret' parameter
|
||||
const [appSecret, appSecretErr] = $(params.appSecret).string().get();
|
||||
const [appSecret, appSecretErr] = $.str.get(params.appSecret);
|
||||
if (appSecretErr) return rej('invalid appSecret param');
|
||||
|
||||
// Lookup app
|
||||
|
@ -53,7 +53,7 @@ import AuthSess, { pack } from '../../../../../models/auth-session';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'token' parameter
|
||||
const [token, tokenErr] = $(params.token).string().get();
|
||||
const [token, tokenErr] = $.str.get(params.token);
|
||||
if (tokenErr) return rej('invalid token param');
|
||||
|
||||
// Lookup session
|
||||
|
@ -51,7 +51,7 @@ import { pack } from '../../../../../models/user';
|
||||
*/
|
||||
module.exports = (params) => new Promise(async (res, rej) => {
|
||||
// Get 'appSecret' parameter
|
||||
const [appSecret, appSecretErr] = $(params.appSecret).string().get();
|
||||
const [appSecret, appSecretErr] = $.str.get(params.appSecret);
|
||||
if (appSecretErr) return rej('invalid appSecret param');
|
||||
|
||||
// Lookup app
|
||||
@ -64,7 +64,7 @@ module.exports = (params) => new Promise(async (res, rej) => {
|
||||
}
|
||||
|
||||
// Get 'token' parameter
|
||||
const [token, tokenErr] = $(params.token).string().get();
|
||||
const [token, tokenErr] = $.str.get(params.token);
|
||||
if (tokenErr) return rej('invalid token param');
|
||||
|
||||
// Fetch token
|
||||
|
@ -13,15 +13,15 @@ import Channel, { pack } from '../../../models/channel';
|
||||
*/
|
||||
module.exports = (params, me) => new Promise(async (res, rej) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
|
||||
const [sinceId, sinceIdErr] = $.type(ID).optional().get(params.sinceId);
|
||||
if (sinceIdErr) return rej('invalid sinceId param');
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
|
||||
const [untilId, untilIdErr] = $.type(ID).optional().get(params.untilId);
|
||||
if (untilIdErr) return rej('invalid untilId param');
|
||||
|
||||
// Check if both of sinceId and untilId is specified
|
||||
|
@ -11,7 +11,7 @@ import { pack } from '../../../../models/channel';
|
||||
*/
|
||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'title' parameter
|
||||
const [title, titleErr] = $(params.title).string().range(1, 100).get();
|
||||
const [title, titleErr] = $.str.range(1, 100).get(params.title);
|
||||
if (titleErr) return rej('invalid title param');
|
||||
|
||||
// Create a channel
|
||||
|
@ -10,15 +10,15 @@ import Note, { pack } from '../../../../models/note';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 1000, limitErr] = $(params.limit).optional.number().range(1, 1000).get();
|
||||
const [limit = 1000, limitErr] = $.num.optional().range(1, 1000).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
|
||||
const [sinceId, sinceIdErr] = $.type(ID).optional().get(params.sinceId);
|
||||
if (sinceIdErr) return rej('invalid sinceId param');
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
|
||||
const [untilId, untilIdErr] = $.type(ID).optional().get(params.untilId);
|
||||
if (untilIdErr) return rej('invalid untilId param');
|
||||
|
||||
// Check if both of sinceId and untilId is specified
|
||||
@ -27,7 +27,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
}
|
||||
|
||||
// Get 'channelId' parameter
|
||||
const [channelId, channelIdErr] = $(params.channelId).type(ID).get();
|
||||
const [channelId, channelIdErr] = $.type(ID).get(params.channelId);
|
||||
if (channelIdErr) return rej('invalid channelId param');
|
||||
|
||||
// Fetch channel
|
||||
|
@ -9,7 +9,7 @@ import Channel, { IChannel, pack } from '../../../../models/channel';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'channelId' parameter
|
||||
const [channelId, channelIdErr] = $(params.channelId).type(ID).get();
|
||||
const [channelId, channelIdErr] = $.type(ID).get(params.channelId);
|
||||
if (channelIdErr) return rej('invalid channelId param');
|
||||
|
||||
// Fetch channel
|
||||
|
@ -10,7 +10,7 @@ import Watching from '../../../../models/channel-watching';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'channelId' parameter
|
||||
const [channelId, channelIdErr] = $(params.channelId).type(ID).get();
|
||||
const [channelId, channelIdErr] = $.type(ID).get(params.channelId);
|
||||
if (channelIdErr) return rej('invalid channelId param');
|
||||
|
||||
//#region Fetch channel
|
||||
|
@ -10,7 +10,7 @@ import Watching from '../../../../models/channel-watching';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'channelId' parameter
|
||||
const [channelId, channelIdErr] = $(params.channelId).type(ID).get();
|
||||
const [channelId, channelIdErr] = $.type(ID).get(params.channelId);
|
||||
if (channelIdErr) return rej('invalid channelId param');
|
||||
|
||||
//#region Fetch channel
|
||||
|
@ -9,15 +9,15 @@ import DriveFile, { pack } from '../../../../models/drive-file';
|
||||
*/
|
||||
module.exports = async (params, user, app) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
|
||||
if (limitErr) throw 'invalid limit param';
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
|
||||
const [sinceId, sinceIdErr] = $.type(ID).optional().get(params.sinceId);
|
||||
if (sinceIdErr) throw 'invalid sinceId param';
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
|
||||
const [untilId, untilIdErr] = $.type(ID).optional().get(params.untilId);
|
||||
if (untilIdErr) throw 'invalid untilId param';
|
||||
|
||||
// Check if both of sinceId and untilId is specified
|
||||
@ -26,11 +26,11 @@ module.exports = async (params, user, app) => {
|
||||
}
|
||||
|
||||
// Get 'folderId' parameter
|
||||
const [folderId = null, folderIdErr] = $(params.folderId).optional.nullable.type(ID).get();
|
||||
const [folderId = null, folderIdErr] = $.type(ID).optional().nullable().get(params.folderId);
|
||||
if (folderIdErr) throw 'invalid folderId param';
|
||||
|
||||
// Get 'type' parameter
|
||||
const [type, typeErr] = $(params.type).optional.string().match(/^[a-zA-Z\/\-\*]+$/).get();
|
||||
const [type, typeErr] = $.str.optional().match(/^[a-zA-Z\/\-\*]+$/).get(params.type);
|
||||
if (typeErr) throw 'invalid type param';
|
||||
|
||||
// Construct query
|
||||
|
@ -29,7 +29,7 @@ module.exports = async (file, params, user): Promise<any> => {
|
||||
}
|
||||
|
||||
// Get 'folderId' parameter
|
||||
const [folderId = null, folderIdErr] = $(params.folderId).optional.nullable.type(ID).get();
|
||||
const [folderId = null, folderIdErr] = $.type(ID).optional().nullable().get(params.folderId);
|
||||
if (folderIdErr) throw 'invalid folderId param';
|
||||
|
||||
try {
|
||||
|
@ -9,11 +9,11 @@ import DriveFile, { pack } from '../../../../../models/drive-file';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'name' parameter
|
||||
const [name, nameErr] = $(params.name).string().get();
|
||||
const [name, nameErr] = $.str.get(params.name);
|
||||
if (nameErr) return rej('invalid name param');
|
||||
|
||||
// Get 'folderId' parameter
|
||||
const [folderId = null, folderIdErr] = $(params.folderId).optional.nullable.type(ID).get();
|
||||
const [folderId = null, folderIdErr] = $.type(ID).optional().nullable().get(params.folderId);
|
||||
if (folderIdErr) return rej('invalid folderId param');
|
||||
|
||||
// Issue query
|
||||
|
@ -9,7 +9,7 @@ import DriveFile, { pack } from '../../../../../models/drive-file';
|
||||
*/
|
||||
module.exports = async (params, user) => {
|
||||
// Get 'fileId' parameter
|
||||
const [fileId, fileIdErr] = $(params.fileId).type(ID).get();
|
||||
const [fileId, fileIdErr] = $.type(ID).get(params.fileId);
|
||||
if (fileIdErr) throw 'invalid fileId param';
|
||||
|
||||
// Fetch file
|
||||
|
@ -11,7 +11,7 @@ import { publishDriveStream } from '../../../../../publishers/stream';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'fileId' parameter
|
||||
const [fileId, fileIdErr] = $(params.fileId).type(ID).get();
|
||||
const [fileId, fileIdErr] = $.type(ID).get(params.fileId);
|
||||
if (fileIdErr) return rej('invalid fileId param');
|
||||
|
||||
// Fetch file
|
||||
@ -26,12 +26,12 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
}
|
||||
|
||||
// Get 'name' parameter
|
||||
const [name, nameErr] = $(params.name).optional.string().pipe(validateFileName).get();
|
||||
const [name, nameErr] = $.str.optional().pipe(validateFileName).get(params.name);
|
||||
if (nameErr) return rej('invalid name param');
|
||||
if (name) file.filename = name;
|
||||
|
||||
// Get 'folderId' parameter
|
||||
const [folderId, folderIdErr] = $(params.folderId).optional.nullable.type(ID).get();
|
||||
const [folderId, folderIdErr] = $.type(ID).optional().nullable().get(params.folderId);
|
||||
if (folderIdErr) return rej('invalid folderId param');
|
||||
|
||||
if (folderId !== undefined) {
|
||||
|
@ -11,11 +11,11 @@ import uploadFromUrl from '../../../../../services/drive/upload-from-url';
|
||||
module.exports = async (params, user): Promise<any> => {
|
||||
// Get 'url' parameter
|
||||
// TODO: Validate this url
|
||||
const [url, urlErr] = $(params.url).string().get();
|
||||
const [url, urlErr] = $.str.get(params.url);
|
||||
if (urlErr) throw 'invalid url param';
|
||||
|
||||
// Get 'folderId' parameter
|
||||
const [folderId = null, folderIdErr] = $(params.folderId).optional.nullable.type(ID).get();
|
||||
const [folderId = null, folderIdErr] = $.type(ID).optional().nullable().get(params.folderId);
|
||||
if (folderIdErr) throw 'invalid folderId param';
|
||||
|
||||
return pack(await uploadFromUrl(url, user, folderId));
|
||||
|
@ -9,15 +9,15 @@ import DriveFolder, { pack } from '../../../../models/drive-folder';
|
||||
*/
|
||||
module.exports = (params, user, app) => new Promise(async (res, rej) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
|
||||
const [sinceId, sinceIdErr] = $.type(ID).optional().get(params.sinceId);
|
||||
if (sinceIdErr) return rej('invalid sinceId param');
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
|
||||
const [untilId, untilIdErr] = $.type(ID).optional().get(params.untilId);
|
||||
if (untilIdErr) return rej('invalid untilId param');
|
||||
|
||||
// Check if both of sinceId and untilId is specified
|
||||
@ -26,7 +26,7 @@ module.exports = (params, user, app) => new Promise(async (res, rej) => {
|
||||
}
|
||||
|
||||
// Get 'folderId' parameter
|
||||
const [folderId = null, folderIdErr] = $(params.folderId).optional.nullable.type(ID).get();
|
||||
const [folderId = null, folderIdErr] = $.type(ID).optional().nullable().get(params.folderId);
|
||||
if (folderIdErr) return rej('invalid folderId param');
|
||||
|
||||
// Construct query
|
||||
|
@ -10,11 +10,11 @@ import { publishDriveStream } from '../../../../../publishers/stream';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'name' parameter
|
||||
const [name = '無題のフォルダー', nameErr] = $(params.name).optional.string().pipe(isValidFolderName).get();
|
||||
const [name = '無題のフォルダー', nameErr] = $.str.optional().pipe(isValidFolderName).get(params.name);
|
||||
if (nameErr) return rej('invalid name param');
|
||||
|
||||
// Get 'parentId' parameter
|
||||
const [parentId = null, parentIdErr] = $(params.parentId).optional.nullable.type(ID).get();
|
||||
const [parentId = null, parentIdErr] = $.type(ID).optional().nullable().get(params.parentId);
|
||||
if (parentIdErr) return rej('invalid parentId param');
|
||||
|
||||
// If the parent folder is specified
|
||||
|
@ -9,11 +9,11 @@ import DriveFolder, { pack } from '../../../../../models/drive-folder';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'name' parameter
|
||||
const [name, nameErr] = $(params.name).string().get();
|
||||
const [name, nameErr] = $.str.get(params.name);
|
||||
if (nameErr) return rej('invalid name param');
|
||||
|
||||
// Get 'parentId' parameter
|
||||
const [parentId = null, parentIdErr] = $(params.parentId).optional.nullable.type(ID).get();
|
||||
const [parentId = null, parentIdErr] = $.type(ID).optional().nullable().get(params.parentId);
|
||||
if (parentIdErr) return rej('invalid parentId param');
|
||||
|
||||
// Issue query
|
||||
|
@ -9,7 +9,7 @@ import DriveFolder, { pack } from '../../../../../models/drive-folder';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'folderId' parameter
|
||||
const [folderId, folderIdErr] = $(params.folderId).type(ID).get();
|
||||
const [folderId, folderIdErr] = $.type(ID).get(params.folderId);
|
||||
if (folderIdErr) return rej('invalid folderId param');
|
||||
|
||||
// Get folder
|
||||
|
@ -10,7 +10,7 @@ import { publishDriveStream } from '../../../../../publishers/stream';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'folderId' parameter
|
||||
const [folderId, folderIdErr] = $(params.folderId).type(ID).get();
|
||||
const [folderId, folderIdErr] = $.type(ID).get(params.folderId);
|
||||
if (folderIdErr) return rej('invalid folderId param');
|
||||
|
||||
// Fetch folder
|
||||
@ -25,12 +25,12 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
}
|
||||
|
||||
// Get 'name' parameter
|
||||
const [name, nameErr] = $(params.name).optional.string().pipe(isValidFolderName).get();
|
||||
const [name, nameErr] = $.str.optional().pipe(isValidFolderName).get(params.name);
|
||||
if (nameErr) return rej('invalid name param');
|
||||
if (name) folder.name = name;
|
||||
|
||||
// Get 'parentId' parameter
|
||||
const [parentId, parentIdErr] = $(params.parentId).optional.nullable.type(ID).get();
|
||||
const [parentId, parentIdErr] = $.type(ID).optional().nullable().get(params.parentId);
|
||||
if (parentIdErr) return rej('invalid parentId param');
|
||||
if (parentId !== undefined) {
|
||||
if (parentId === null) {
|
||||
|
@ -9,15 +9,15 @@ import DriveFile, { pack } from '../../../../models/drive-file';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
|
||||
const [sinceId, sinceIdErr] = $.type(ID).optional().get(params.sinceId);
|
||||
if (sinceIdErr) return rej('invalid sinceId param');
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
|
||||
const [untilId, untilIdErr] = $.type(ID).optional().get(params.untilId);
|
||||
if (untilIdErr) return rej('invalid untilId param');
|
||||
|
||||
// Check if both of sinceId and untilId is specified
|
||||
@ -26,7 +26,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
}
|
||||
|
||||
// Get 'type' parameter
|
||||
const [type, typeErr] = $(params.type).optional.string().match(/^[a-zA-Z\/\-\*]+$/).get();
|
||||
const [type, typeErr] = $.str.optional().match(/^[a-zA-Z\/\-\*]+$/).get(params.type);
|
||||
if (typeErr) return rej('invalid type param');
|
||||
|
||||
// Construct query
|
||||
|
@ -13,7 +13,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
const follower = user;
|
||||
|
||||
// Get 'userId' parameter
|
||||
const [userId, userIdErr] = $(params.userId).type(ID).get();
|
||||
const [userId, userIdErr] = $.type(ID).get(params.userId);
|
||||
if (userIdErr) return rej('invalid userId param');
|
||||
|
||||
// 自分自身
|
||||
|
@ -13,7 +13,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
const follower = user;
|
||||
|
||||
// Get 'userId' parameter
|
||||
const [userId, userIdErr] = $(params.userId).type(ID).get();
|
||||
const [userId, userIdErr] = $.type(ID).get(params.userId);
|
||||
if (userIdErr) return rej('invalid userId param');
|
||||
|
||||
// Check if the followee is yourself
|
||||
|
@ -8,7 +8,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
const follower = user;
|
||||
|
||||
// Get 'userId' parameter
|
||||
const [userId, userIdErr] = $(params.userId).type(ID).get();
|
||||
const [userId, userIdErr] = $.type(ID).get(params.userId);
|
||||
if (userIdErr) return rej('invalid userId param');
|
||||
|
||||
// Fetch following
|
||||
|
@ -8,7 +8,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
const follower = user;
|
||||
|
||||
// Get 'userId' parameter
|
||||
const [userId, userIdErr] = $(params.userId).type(ID).get();
|
||||
const [userId, userIdErr] = $.type(ID).get(params.userId);
|
||||
if (userIdErr) return rej('invalid userId param');
|
||||
|
||||
// Fetch following
|
||||
|
@ -7,7 +7,7 @@ import User from '../../../../../models/user';
|
||||
|
||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'token' parameter
|
||||
const [token, tokenErr] = $(params.token).string().get();
|
||||
const [token, tokenErr] = $.str.get(params.token);
|
||||
if (tokenErr) return rej('invalid token param');
|
||||
|
||||
const _token = token.replace(/\s/g, '');
|
||||
|
@ -10,7 +10,7 @@ import config from '../../../../../config';
|
||||
|
||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'password' parameter
|
||||
const [password, passwordErr] = $(params.password).string().get();
|
||||
const [password, passwordErr] = $.str.get(params.password);
|
||||
if (passwordErr) return rej('invalid password param');
|
||||
|
||||
// Compare password
|
||||
|
@ -7,7 +7,7 @@ import User from '../../../../../models/user';
|
||||
|
||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'password' parameter
|
||||
const [password, passwordErr] = $(params.password).string().get();
|
||||
const [password, passwordErr] = $.str.get(params.password);
|
||||
if (passwordErr) return rej('invalid password param');
|
||||
|
||||
// Compare password
|
||||
|
@ -10,15 +10,15 @@ import { pack } from '../../../../models/app';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'offset' parameter
|
||||
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
|
||||
const [offset = 0, offsetErr] = $.num.optional().min(0).get(params.offset);
|
||||
if (offsetErr) return rej('invalid offset param');
|
||||
|
||||
// Get 'sort' parameter
|
||||
const [sort = 'desc', sortError] = $(params.sort).optional.string().or('desc asc').get();
|
||||
const [sort = 'desc', sortError] = $.str.optional().or('desc asc').get(params.sort);
|
||||
if (sortError) return rej('invalid sort param');
|
||||
|
||||
// Get tokens
|
||||
|
@ -10,11 +10,11 @@ import User from '../../../../models/user';
|
||||
*/
|
||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'currentPasword' parameter
|
||||
const [currentPassword, currentPasswordErr] = $(params.currentPasword).string().get();
|
||||
const [currentPassword, currentPasswordErr] = $.str.get(params.currentPasword);
|
||||
if (currentPasswordErr) return rej('invalid currentPasword param');
|
||||
|
||||
// Get 'newPassword' parameter
|
||||
const [newPassword, newPasswordErr] = $(params.newPassword).string().get();
|
||||
const [newPassword, newPasswordErr] = $.str.get(params.newPassword);
|
||||
if (newPasswordErr) return rej('invalid newPassword param');
|
||||
|
||||
// Compare password
|
||||
|
@ -9,15 +9,15 @@ import Favorite, { pack } from '../../../../models/favorite';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
|
||||
const [sinceId, sinceIdErr] = $.type(ID).optional().get(params.sinceId);
|
||||
if (sinceIdErr) return rej('invalid sinceId param');
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
|
||||
const [untilId, untilIdErr] = $.type(ID).optional().get(params.untilId);
|
||||
if (untilIdErr) return rej('invalid untilId param');
|
||||
|
||||
// Check if both of sinceId and untilId is specified
|
||||
|
@ -14,27 +14,27 @@ import read from '../../common/read-notification';
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'following' parameter
|
||||
const [following = false, followingError] =
|
||||
$(params.following).optional.boolean().get();
|
||||
$.bool.optional().get(params.following);
|
||||
if (followingError) return rej('invalid following param');
|
||||
|
||||
// Get 'markAsRead' parameter
|
||||
const [markAsRead = true, markAsReadErr] = $(params.markAsRead).optional.boolean().get();
|
||||
const [markAsRead = true, markAsReadErr] = $.bool.optional().get(params.markAsRead);
|
||||
if (markAsReadErr) return rej('invalid markAsRead param');
|
||||
|
||||
// Get 'type' parameter
|
||||
const [type, typeErr] = $(params.type).optional.array($().string()).unique().get();
|
||||
const [type, typeErr] = $.arr($.str).optional().unique().get(params.type);
|
||||
if (typeErr) return rej('invalid type param');
|
||||
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
|
||||
const [sinceId, sinceIdErr] = $.type(ID).optional().get(params.sinceId);
|
||||
if (sinceIdErr) return rej('invalid sinceId param');
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
|
||||
const [untilId, untilIdErr] = $.type(ID).optional().get(params.untilId);
|
||||
if (untilIdErr) return rej('invalid untilId param');
|
||||
|
||||
// Check if both of sinceId and untilId is specified
|
||||
|
@ -11,7 +11,7 @@ import { pack } from '../../../../models/user';
|
||||
*/
|
||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'noteId' parameter
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
|
||||
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
|
||||
if (noteIdErr) return rej('invalid noteId param');
|
||||
|
||||
// Fetch pinee
|
||||
|
@ -12,7 +12,7 @@ import generateUserToken from '../../common/generate-native-user-token';
|
||||
*/
|
||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'password' parameter
|
||||
const [password, passwordErr] = $(params.password).string().get();
|
||||
const [password, passwordErr] = $.str.get(params.password);
|
||||
if (passwordErr) return rej('invalid password param');
|
||||
|
||||
// Compare password
|
||||
|
@ -9,15 +9,15 @@ import Signin, { pack } from '../../../../models/signin';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
|
||||
const [sinceId, sinceIdErr] = $.type(ID).optional().get(params.sinceId);
|
||||
if (sinceIdErr) return rej('invalid sinceId param');
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
|
||||
const [untilId, untilIdErr] = $.type(ID).optional().get(params.untilId);
|
||||
if (untilIdErr) return rej('invalid untilId param');
|
||||
|
||||
// Check if both of sinceId and untilId is specified
|
||||
|
@ -12,42 +12,42 @@ module.exports = async (params, user, app) => new Promise(async (res, rej) => {
|
||||
const isSecure = user != null && app == null;
|
||||
|
||||
// Get 'name' parameter
|
||||
const [name, nameErr] = $(params.name).optional.nullable.string().pipe(isValidName).get();
|
||||
const [name, nameErr] = $.str.optional().nullable().pipe(isValidName).get(params.name);
|
||||
if (nameErr) return rej('invalid name param');
|
||||
if (name) user.name = name;
|
||||
|
||||
// Get 'description' parameter
|
||||
const [description, descriptionErr] = $(params.description).optional.nullable.string().pipe(isValidDescription).get();
|
||||
const [description, descriptionErr] = $.str.optional().nullable().pipe(isValidDescription).get(params.description);
|
||||
if (descriptionErr) return rej('invalid description param');
|
||||
if (description !== undefined) user.description = description;
|
||||
|
||||
// Get 'location' parameter
|
||||
const [location, locationErr] = $(params.location).optional.nullable.string().pipe(isValidLocation).get();
|
||||
const [location, locationErr] = $.str.optional().nullable().pipe(isValidLocation).get(params.location);
|
||||
if (locationErr) return rej('invalid location param');
|
||||
if (location !== undefined) user.profile.location = location;
|
||||
|
||||
// Get 'birthday' parameter
|
||||
const [birthday, birthdayErr] = $(params.birthday).optional.nullable.string().pipe(isValidBirthday).get();
|
||||
const [birthday, birthdayErr] = $.str.optional().nullable().pipe(isValidBirthday).get(params.birthday);
|
||||
if (birthdayErr) return rej('invalid birthday param');
|
||||
if (birthday !== undefined) user.profile.birthday = birthday;
|
||||
|
||||
// Get 'avatarId' parameter
|
||||
const [avatarId, avatarIdErr] = $(params.avatarId).optional.type(ID).get();
|
||||
const [avatarId, avatarIdErr] = $.type(ID).optional().get(params.avatarId);
|
||||
if (avatarIdErr) return rej('invalid avatarId param');
|
||||
if (avatarId) user.avatarId = avatarId;
|
||||
|
||||
// Get 'bannerId' parameter
|
||||
const [bannerId, bannerIdErr] = $(params.bannerId).optional.type(ID).get();
|
||||
const [bannerId, bannerIdErr] = $.type(ID).optional().get(params.bannerId);
|
||||
if (bannerIdErr) return rej('invalid bannerId param');
|
||||
if (bannerId) user.bannerId = bannerId;
|
||||
|
||||
// Get 'isBot' parameter
|
||||
const [isBot, isBotErr] = $(params.isBot).optional.boolean().get();
|
||||
const [isBot, isBotErr] = $.bool.optional().get(params.isBot);
|
||||
if (isBotErr) return rej('invalid isBot param');
|
||||
if (isBot != null) user.isBot = isBot;
|
||||
|
||||
// Get 'autoWatch' parameter
|
||||
const [autoWatch, autoWatchErr] = $(params.autoWatch).optional.boolean().get();
|
||||
const [autoWatch, autoWatchErr] = $.bool.optional().get(params.autoWatch);
|
||||
if (autoWatchErr) return rej('invalid autoWatch param');
|
||||
if (autoWatch != null) user.settings.autoWatch = autoWatch;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
* Module dependencies
|
||||
*/
|
||||
import $ from 'cafy';
|
||||
import User, { pack } from '../../../../models/user';
|
||||
import User from '../../../../models/user';
|
||||
import event from '../../../../publishers/stream';
|
||||
|
||||
/**
|
||||
@ -10,11 +10,11 @@ import event from '../../../../publishers/stream';
|
||||
*/
|
||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'name' parameter
|
||||
const [name, nameErr] = $(params.name).string().get();
|
||||
const [name, nameErr] = $.str.get(params.name);
|
||||
if (nameErr) return rej('invalid name param');
|
||||
|
||||
// Get 'value' parameter
|
||||
const [value, valueErr] = $(params.value).nullable.any().get();
|
||||
const [value, valueErr] = $.any.nullable().get(params.value);
|
||||
if (valueErr) return rej('invalid value param');
|
||||
|
||||
const x = {};
|
||||
|
@ -7,20 +7,22 @@ import event from '../../../../publishers/stream';
|
||||
|
||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'home' parameter
|
||||
const [home, homeErr] = $(params.home).optional.array().each(
|
||||
$().object(true)
|
||||
.have('name', $().string())
|
||||
.have('id', $().string())
|
||||
.have('place', $().string())
|
||||
.have('data', $().object())).get();
|
||||
const [home, homeErr] = $.arr(
|
||||
$.obj.strict()
|
||||
.have('name', $.str)
|
||||
.have('id', $.str)
|
||||
.have('place', $.str)
|
||||
.have('data', $.obj))
|
||||
.optional()
|
||||
.get(params.home);
|
||||
if (homeErr) return rej('invalid home param');
|
||||
|
||||
// Get 'id' parameter
|
||||
const [id, idErr] = $(params.id).optional.string().get();
|
||||
const [id, idErr] = $.str.optional().get(params.id);
|
||||
if (idErr) return rej('invalid id param');
|
||||
|
||||
// Get 'data' parameter
|
||||
const [data, dataErr] = $(params.data).optional.object().get();
|
||||
const [data, dataErr] = $.obj.optional().get(params.data);
|
||||
if (dataErr) return rej('invalid data param');
|
||||
|
||||
if (home) {
|
||||
|
@ -7,19 +7,20 @@ import event from '../../../../publishers/stream';
|
||||
|
||||
module.exports = async (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'home' parameter
|
||||
const [home, homeErr] = $(params.home).optional.array().each(
|
||||
$().object(true)
|
||||
.have('name', $().string())
|
||||
.have('id', $().string())
|
||||
.have('data', $().object())).get();
|
||||
const [home, homeErr] = $.arr(
|
||||
$.obj.strict()
|
||||
.have('name', $.str)
|
||||
.have('id', $.str)
|
||||
.have('data', $.obj))
|
||||
.optional().get(params.home);
|
||||
if (homeErr) return rej('invalid home param');
|
||||
|
||||
// Get 'id' parameter
|
||||
const [id, idErr] = $(params.id).optional.string().get();
|
||||
const [id, idErr] = $.str.optional().get(params.id);
|
||||
if (idErr) return rej('invalid id param');
|
||||
|
||||
// Get 'data' parameter
|
||||
const [data, dataErr] = $(params.data).optional.object().get();
|
||||
const [data, dataErr] = $.obj.optional().get(params.data);
|
||||
if (dataErr) return rej('invalid data param');
|
||||
|
||||
if (home) {
|
||||
|
@ -11,7 +11,7 @@ import { pack } from '../../../../models/messaging-message';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
const mute = await Mute.find({
|
||||
|
@ -16,7 +16,7 @@ import read from '../../common/read-messaging-message';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'userId' parameter
|
||||
const [recipientId, recipientIdErr] = $(params.userId).type(ID).get();
|
||||
const [recipientId, recipientIdErr] = $.type(ID).get(params.userId);
|
||||
if (recipientIdErr) return rej('invalid userId param');
|
||||
|
||||
// Fetch recipient
|
||||
@ -33,19 +33,19 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
}
|
||||
|
||||
// Get 'markAsRead' parameter
|
||||
const [markAsRead = true, markAsReadErr] = $(params.markAsRead).optional.boolean().get();
|
||||
const [markAsRead = true, markAsReadErr] = $.bool.optional().get(params.markAsRead);
|
||||
if (markAsReadErr) return rej('invalid markAsRead param');
|
||||
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
|
||||
const [sinceId, sinceIdErr] = $.type(ID).optional().get(params.sinceId);
|
||||
if (sinceIdErr) return rej('invalid sinceId param');
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
|
||||
const [untilId, untilIdErr] = $.type(ID).optional().get(params.untilId);
|
||||
if (untilIdErr) return rej('invalid untilId param');
|
||||
|
||||
// Check if both of sinceId and untilId is specified
|
||||
|
@ -19,7 +19,7 @@ import config from '../../../../../config';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'userId' parameter
|
||||
const [recipientId, recipientIdErr] = $(params.userId).type(ID).get();
|
||||
const [recipientId, recipientIdErr] = $.type(ID).get(params.userId);
|
||||
if (recipientIdErr) return rej('invalid userId param');
|
||||
|
||||
// Myself
|
||||
@ -41,11 +41,11 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
}
|
||||
|
||||
// Get 'text' parameter
|
||||
const [text, textErr] = $(params.text).optional.string().pipe(isValidText).get();
|
||||
const [text, textErr] = $.str.optional().pipe(isValidText).get(params.text);
|
||||
if (textErr) return rej('invalid text');
|
||||
|
||||
// Get 'fileId' parameter
|
||||
const [fileId, fileIdErr] = $(params.fileId).optional.type(ID).get();
|
||||
const [fileId, fileIdErr] = $.type(ID).optional().get(params.fileId);
|
||||
if (fileIdErr) return rej('invalid fileId param');
|
||||
|
||||
let file = null;
|
||||
|
@ -12,7 +12,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
const muter = user;
|
||||
|
||||
// Get 'userId' parameter
|
||||
const [userId, userIdErr] = $(params.userId).type(ID).get();
|
||||
const [userId, userIdErr] = $.type(ID).get(params.userId);
|
||||
if (userIdErr) return rej('invalid userId param');
|
||||
|
||||
// 自分自身
|
||||
|
@ -12,7 +12,7 @@ module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
const muter = user;
|
||||
|
||||
// Get 'userId' parameter
|
||||
const [userId, userIdErr] = $(params.userId).type(ID).get();
|
||||
const [userId, userIdErr] = $.type(ID).get(params.userId);
|
||||
if (userIdErr) return rej('invalid userId param');
|
||||
|
||||
// Check if the mutee is yourself
|
||||
|
@ -11,15 +11,15 @@ import { getFriendIds } from '../../common/get-friends';
|
||||
*/
|
||||
module.exports = (params, me) => new Promise(async (res, rej) => {
|
||||
// Get 'iknow' parameter
|
||||
const [iknow = false, iknowErr] = $(params.iknow).optional.boolean().get();
|
||||
const [iknow = false, iknowErr] = $.bool.optional().get(params.iknow);
|
||||
if (iknowErr) return rej('invalid iknow param');
|
||||
|
||||
// Get 'limit' parameter
|
||||
const [limit = 30, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
const [limit = 30, limitErr] = $.num.optional().range(1, 100).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'cursor' parameter
|
||||
const [cursor = null, cursorErr] = $(params.cursor).optional.type(ID).get();
|
||||
const [cursor = null, cursorErr] = $.type(ID).optional().get(params.cursor);
|
||||
if (cursorErr) return rej('invalid cursor param');
|
||||
|
||||
// Construct query
|
||||
|
@ -9,11 +9,11 @@ import App, { pack } from '../../../../models/app';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'offset' parameter
|
||||
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
|
||||
const [offset = 0, offsetErr] = $.num.optional().min(0).get(params.offset);
|
||||
if (offsetErr) return rej('invalid offset param');
|
||||
|
||||
const query = {
|
||||
|
@ -9,35 +9,35 @@ import Note, { pack } from '../../../models/note';
|
||||
*/
|
||||
module.exports = (params) => new Promise(async (res, rej) => {
|
||||
// Get 'reply' parameter
|
||||
const [reply, replyErr] = $(params.reply).optional.boolean().get();
|
||||
const [reply, replyErr] = $.bool.optional().get(params.reply);
|
||||
if (replyErr) return rej('invalid reply param');
|
||||
|
||||
// Get 'renote' parameter
|
||||
const [renote, renoteErr] = $(params.renote).optional.boolean().get();
|
||||
const [renote, renoteErr] = $.bool.optional().get(params.renote);
|
||||
if (renoteErr) return rej('invalid renote param');
|
||||
|
||||
// Get 'media' parameter
|
||||
const [media, mediaErr] = $(params.media).optional.boolean().get();
|
||||
const [media, mediaErr] = $.bool.optional().get(params.media);
|
||||
if (mediaErr) return rej('invalid media param');
|
||||
|
||||
// Get 'poll' parameter
|
||||
const [poll, pollErr] = $(params.poll).optional.boolean().get();
|
||||
const [poll, pollErr] = $.bool.optional().get(params.poll);
|
||||
if (pollErr) return rej('invalid poll param');
|
||||
|
||||
// Get 'bot' parameter
|
||||
//const [bot, botErr] = $(params.bot).optional.boolean().get();
|
||||
//const [bot, botErr] = $.bool.optional().get(params.bot);
|
||||
//if (botErr) return rej('invalid bot param');
|
||||
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'sinceId' parameter
|
||||
const [sinceId, sinceIdErr] = $(params.sinceId).optional.type(ID).get();
|
||||
const [sinceId, sinceIdErr] = $.type(ID).optional().get(params.sinceId);
|
||||
if (sinceIdErr) return rej('invalid sinceId param');
|
||||
|
||||
// Get 'untilId' parameter
|
||||
const [untilId, untilIdErr] = $(params.untilId).optional.type(ID).get();
|
||||
const [untilId, untilIdErr] = $.type(ID).optional().get(params.untilId);
|
||||
if (untilIdErr) return rej('invalid untilId param');
|
||||
|
||||
// Check if both of sinceId and untilId is specified
|
||||
|
@ -13,15 +13,15 @@ import Note, { pack } from '../../../../models/note';
|
||||
*/
|
||||
module.exports = (params, user) => new Promise(async (res, rej) => {
|
||||
// Get 'noteId' parameter
|
||||
const [noteId, noteIdErr] = $(params.noteId).type(ID).get();
|
||||
const [noteId, noteIdErr] = $.type(ID).get(params.noteId);
|
||||
if (noteIdErr) return rej('invalid noteId param');
|
||||
|
||||
// Get 'limit' parameter
|
||||
const [limit = 10, limitErr] = $(params.limit).optional.number().range(1, 100).get();
|
||||
const [limit = 10, limitErr] = $.num.optional().range(1, 100).get(params.limit);
|
||||
if (limitErr) return rej('invalid limit param');
|
||||
|
||||
// Get 'offset' parameter
|
||||
const [offset = 0, offsetErr] = $(params.offset).optional.number().min(0).get();
|
||||
const [offset = 0, offsetErr] = $.num.optional().min(0).get(params.offset);
|
||||
if (offsetErr) return rej('invalid offset param');
|
||||
|
||||
// Lookup note
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user