mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-14 14:07:38 -07:00
Merge pull request 'v13' (#9235) from develop into main
Reviewed-on: https://codeberg.org/thatonecalculator/calckey/pulls/9235
This commit is contained in:
commit
5a676912fb
204 changed files with 1973 additions and 545 deletions
195
.config/ci.yml
Normal file
195
.config/ci.yml
Normal file
|
@ -0,0 +1,195 @@
|
|||
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
# Calckey configuration
|
||||
#━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
||||
|
||||
# ┌─────┐
|
||||
#───┘ URL └─────────────────────────────────────────────────────
|
||||
|
||||
# Final accessible URL seen by a user.
|
||||
url: https://example.tld/
|
||||
|
||||
# ONCE YOU HAVE STARTED THE INSTANCE, DO NOT CHANGE THE
|
||||
# URL SETTINGS AFTER THAT!
|
||||
|
||||
# ┌───────────────────────┐
|
||||
#───┘ Port and TLS settings └───────────────────────────────────
|
||||
|
||||
#
|
||||
# Misskey requires a reverse proxy to support HTTPS connections.
|
||||
#
|
||||
# +----- https://example.tld/ ------------+
|
||||
# +------+ |+-------------+ +----------------+|
|
||||
# | User | ---> || Proxy (443) | ---> | Misskey (3000) ||
|
||||
# +------+ |+-------------+ +----------------+|
|
||||
# +---------------------------------------+
|
||||
#
|
||||
# You need to set up a reverse proxy. (e.g. nginx)
|
||||
# An encrypted connection with HTTPS is highly recommended
|
||||
# because tokens may be transferred in GET requests.
|
||||
|
||||
# The port that your Misskey server should listen on.
|
||||
port: 3000
|
||||
|
||||
# ┌──────────────────────────┐
|
||||
#───┘ PostgreSQL configuration └────────────────────────────────
|
||||
|
||||
db:
|
||||
host: database
|
||||
port: 5432
|
||||
|
||||
# Database name
|
||||
db: postgres
|
||||
|
||||
# Auth
|
||||
user: postgres
|
||||
pass: test
|
||||
|
||||
# Whether disable Caching queries
|
||||
#disableCache: true
|
||||
|
||||
# Extra Connection options
|
||||
#extra:
|
||||
# ssl: true
|
||||
|
||||
# ┌─────────────────────┐
|
||||
#───┘ Redis configuration └─────────────────────────────────────
|
||||
|
||||
redis:
|
||||
host: redis
|
||||
port: 6379
|
||||
#family: 0 # 0=Both, 4=IPv4, 6=IPv6
|
||||
#pass: example-pass
|
||||
#prefix: example-prefix
|
||||
#db: 1
|
||||
|
||||
# ┌─────────────────────────────┐
|
||||
#───┘ Elasticsearch configuration └─────────────────────────────
|
||||
|
||||
#elasticsearch:
|
||||
# host: localhost
|
||||
# port: 9200
|
||||
# ssl: false
|
||||
# user:
|
||||
# pass:
|
||||
|
||||
# ┌───────────────┐
|
||||
#───┘ ID generation └───────────────────────────────────────────
|
||||
|
||||
# You can select the ID generation method.
|
||||
# You don't usually need to change this setting, but you can
|
||||
# change it according to your preferences.
|
||||
|
||||
# Available methods:
|
||||
# aid ... Short, Millisecond accuracy
|
||||
# meid ... Similar to ObjectID, Millisecond accuracy
|
||||
# ulid ... Millisecond accuracy
|
||||
# objectid ... This is left for backward compatibility
|
||||
|
||||
# ONCE YOU HAVE STARTED THE INSTANCE, DO NOT CHANGE THE
|
||||
# ID SETTINGS AFTER THAT!
|
||||
|
||||
id: 'aid'
|
||||
|
||||
# ┌─────────────────────┐
|
||||
#───┘ Other configuration └─────────────────────────────────────
|
||||
|
||||
# Max note length, should be < 8000.
|
||||
#maxNoteLength: 3000
|
||||
|
||||
# Whether disable HSTS
|
||||
#disableHsts: true
|
||||
|
||||
# Number of worker processes
|
||||
#clusterLimit: 1
|
||||
|
||||
# Job concurrency per worker
|
||||
# deliverJobConcurrency: 128
|
||||
# inboxJobConcurrency: 16
|
||||
|
||||
# Job rate limiter
|
||||
# deliverJobPerSec: 128
|
||||
# inboxJobPerSec: 16
|
||||
|
||||
# Job attempts
|
||||
# deliverJobMaxAttempts: 12
|
||||
# inboxJobMaxAttempts: 8
|
||||
|
||||
# IP address family used for outgoing request (ipv4, ipv6 or dual)
|
||||
#outgoingAddressFamily: ipv4
|
||||
|
||||
# Syslog option
|
||||
#syslog:
|
||||
# host: localhost
|
||||
# port: 514
|
||||
|
||||
# Proxy for HTTP/HTTPS
|
||||
#proxy: http://127.0.0.1:3128
|
||||
|
||||
#proxyBypassHosts: [
|
||||
# 'example.com',
|
||||
# '192.0.2.8'
|
||||
#]
|
||||
|
||||
# Proxy for SMTP/SMTPS
|
||||
#proxySmtp: http://127.0.0.1:3128 # use HTTP/1.1 CONNECT
|
||||
#proxySmtp: socks4://127.0.0.1:1080 # use SOCKS4
|
||||
#proxySmtp: socks5://127.0.0.1:1080 # use SOCKS5
|
||||
|
||||
# Media Proxy
|
||||
#mediaProxy: https://example.com/proxy
|
||||
|
||||
# Proxy remote files (default: false)
|
||||
#proxyRemoteFiles: true
|
||||
|
||||
#allowedPrivateNetworks: [
|
||||
# '127.0.0.1/32'
|
||||
#]
|
||||
|
||||
# Upload or download file size limits (bytes)
|
||||
#maxFileSize: 262144000
|
||||
|
||||
# Managed hosting settings
|
||||
# !!!!!!!!!!
|
||||
# >>>>>> NORMAL SELF-HOSTERS, STAY AWAY! <<<<<<
|
||||
# >>>>>> YOU DON'T NEED THIS! <<<<<<
|
||||
# !!!!!!!!!!
|
||||
# Each category is optional, but if each item in each category is mandatory!
|
||||
# If you mess this up, that's on you, you've been warned...
|
||||
|
||||
#maxUserSignups: 100
|
||||
#isManagedHosting: true
|
||||
#deepl:
|
||||
# managed: true
|
||||
# authKey: ''
|
||||
# isPro: false
|
||||
#
|
||||
#email:
|
||||
# managed: true
|
||||
# address: 'example@email.com'
|
||||
# host: 'email.com'
|
||||
# port: 587
|
||||
# user: 'example@email.com'
|
||||
# pass: ''
|
||||
# useImplicitSslTls: false
|
||||
#
|
||||
#objectStorage:
|
||||
# managed: true
|
||||
# baseUrl: ''
|
||||
# bucket: ''
|
||||
# prefix: ''
|
||||
# endpoint: ''
|
||||
# region: ''
|
||||
# accessKey: ''
|
||||
# secretKey: ''
|
||||
# useSsl: true
|
||||
# connnectOverProxy: false
|
||||
# setPublicReadOnUpload: true
|
||||
# s3ForcePathStyle: true
|
||||
|
||||
# !!!!!!!!!!
|
||||
# >>>>>> AGAIN, NORMAL SELF-HOSTERS, STAY AWAY! <<<<<<
|
||||
# >>>>>> YOU DON'T NEED THIS, ABOVE SETTINGS ARE FOR MANAGED HOSTING ONLY! <<<<<<
|
||||
# !!!!!!!!!!
|
||||
|
||||
# Seriously. Do NOT fill out the above settings if you're self-hosting.
|
||||
# They're much better off being set from the control panel.
|
|
@ -93,6 +93,9 @@ id: 'aid'
|
|||
# ┌─────────────────────┐
|
||||
#───┘ Other configuration └─────────────────────────────────────
|
||||
|
||||
# Max note length, should be < 8000.
|
||||
#maxNoteLength: 3000
|
||||
|
||||
# Whether disable HSTS
|
||||
#disableHsts: true
|
||||
|
||||
|
|
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -59,3 +59,8 @@ packages/backend/assets/instance.css
|
|||
*.blend3
|
||||
*.blend4
|
||||
*.blend5
|
||||
|
||||
#intelij stuff
|
||||
packages/backend/.idea/backend.iml
|
||||
packages/backend/.idea/modules.xml
|
||||
packages/backend/.idea/vcs.xml
|
||||
|
|
17
.woodpecker/commitBuild.yml
Normal file
17
.woodpecker/commitBuild.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
pipeline:
|
||||
build:
|
||||
image: node:${NODE_VERSION}
|
||||
commands:
|
||||
- corepack enable
|
||||
- yarn install
|
||||
- yarn build
|
||||
environment:
|
||||
- YARN_ENABLE_IMMUTABLE_INSTALLS=false
|
||||
|
||||
matrix:
|
||||
NODE_VERSION:
|
||||
- 18.12.1
|
||||
- 19.2.0
|
||||
|
||||
branches:
|
||||
include: [ master, develop, feature/* ]
|
27
.woodpecker/commitDatabase.yml
Normal file
27
.woodpecker/commitDatabase.yml
Normal file
|
@ -0,0 +1,27 @@
|
|||
pipeline:
|
||||
migrate:
|
||||
image: node:19.2.0
|
||||
commands:
|
||||
- cp .config/ci.yml .config/default.yml
|
||||
- corepack enable
|
||||
- yarn install
|
||||
- yarn build
|
||||
- yarn migrate
|
||||
environment:
|
||||
- YARN_ENABLE_IMMUTABLE_INSTALLS=false
|
||||
|
||||
services:
|
||||
database:
|
||||
image: postgres:${DATABASE}
|
||||
environment:
|
||||
- POSTGRES_PASSWORD=test
|
||||
redis:
|
||||
image: redis
|
||||
|
||||
matrix:
|
||||
DATABASE:
|
||||
- 12
|
||||
- latest
|
||||
|
||||
branches:
|
||||
include: [ master, develop, feature/* ]
|
11
.woodpecker/commitDocker.yml
Normal file
11
.woodpecker/commitDocker.yml
Normal file
|
@ -0,0 +1,11 @@
|
|||
pipeline:
|
||||
docker-build:
|
||||
image: plugins/kaniko
|
||||
settings:
|
||||
repo: thatonecalculator/calckey
|
||||
tags: test
|
||||
dockerfile: Dockerfile
|
||||
no_push: true
|
||||
|
||||
branches:
|
||||
include: [ master, develop ]
|
17
.woodpecker/dockerHubRelease.yml
Normal file
17
.woodpecker/dockerHubRelease.yml
Normal file
|
@ -0,0 +1,17 @@
|
|||
pipeline:
|
||||
publish-docker-latest:
|
||||
image: plugins/kaniko
|
||||
settings:
|
||||
repo: thatonecalculator/calckey
|
||||
tags: latest
|
||||
dockerfile: Dockerfile
|
||||
username:
|
||||
# Secret 'docker_username' needs to be set in the CI settings
|
||||
from_secret: docker_username
|
||||
password:
|
||||
# Secret 'docker_password' needs to be set in the CI settings
|
||||
from_secret: docker_password
|
||||
when:
|
||||
# Push new version of tag latest if new push on main-branch
|
||||
event: push
|
||||
branch: master
|
18
.woodpecker/dockerHubTag.yml
Normal file
18
.woodpecker/dockerHubTag.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
pipeline:
|
||||
publish-docker-tag:
|
||||
image: plugins/kaniko
|
||||
settings:
|
||||
repo: thatonecalculator/calckey
|
||||
# Uses the tag from git for the container tag
|
||||
tags: ${CI_COMMIT_TAG}
|
||||
dockerfile: Dockerfile
|
||||
username:
|
||||
# Secret 'docker_username' needs to be set in the CI settings
|
||||
from_secret: docker_username
|
||||
password:
|
||||
# Secret 'docker_password' needs to be set in the CI settings
|
||||
from_secret: docker_password
|
||||
when:
|
||||
# Push new version when version tag is created
|
||||
event: tag
|
||||
tag: v*
|
53
CALCKEY.md
53
CALCKEY.md
|
@ -2,34 +2,41 @@
|
|||
|
||||
## Planned
|
||||
|
||||
- MFM button
|
||||
- Classic mode make instance icon bring up new context menu
|
||||
- Exclude self from antenna
|
||||
- Backfill remote users
|
||||
- User "choices" (recommended users) like Mastodon and Soapbox
|
||||
- Option to publicize instance blocks
|
||||
- Fully revamp non-logged-in screen
|
||||
- Personal notes for all accounts
|
||||
- Non-nyaify cat mode
|
||||
- Timeline filters
|
||||
- Filter notifications by user
|
||||
- Join Reason system like Mastodon/Pleroma
|
||||
- Build flag to remove NSFW/AI stuff
|
||||
- [Rat mode?](https://stop.voring.me/notes/933fx97bmd)
|
||||
- Stucture
|
||||
- [Sonic](https://crates.io/crates/sonic-server) support as an ElasticSearch alternative
|
||||
- [DragonflyDB](https://dragonflydb.io/) support as a Redis alternative
|
||||
- Optionally use [ScyllaDB](https://www.scylladb.com/open-source-nosql-database/) for storing notes
|
||||
- Rewrite backend in Rust and [Axum](https://github.com/tokio-rs/axum)
|
||||
- Function
|
||||
- Federate with note edits
|
||||
- Admin customizable max note length (100-8000)
|
||||
- User "choices" (recommended users) like Mastodon and Soapbox
|
||||
- Join Reason system like Mastodon/Pleroma
|
||||
- Option to publicize instance blocks
|
||||
- Backfill remote users
|
||||
- Build flag to remove NSFW/AI stuff
|
||||
- Timeline filters
|
||||
- Filter notifications by user
|
||||
- Non-nyaify cat mode
|
||||
- Exclude self from antenna
|
||||
- Form
|
||||
- MFM button
|
||||
- Personal notes for all accounts
|
||||
- Fully revamp non-logged-in screen
|
||||
- Classic mode make instance icon bring up new context menu
|
||||
- [Rat mode?](https://stop.voring.me/notes/933fx97bmd)
|
||||
|
||||
## Work in progress
|
||||
|
||||
- Weblate project
|
||||
- Customizable max note length
|
||||
- Link verification
|
||||
- Better Messaging UI
|
||||
- Better API Documentation
|
||||
- Remote follow button
|
||||
- Admin custom CSS
|
||||
- Add back time machine (jump to date)
|
||||
- Improve accesibility score
|
||||
<details><summary>Current Misskey score is 57/100</summary>
|
||||
|
||||
![accesibility score](https://pool.jortage.com/voringme/misskey/8ff18aae-4dc6-4b08-9e05-a4c9d051a9e3.png)
|
||||
|
||||
</details>
|
||||
- Improve accesibility
|
||||
|
||||
## Implemented
|
||||
|
||||
|
@ -38,6 +45,7 @@
|
|||
- Fix Dockerfile @hanna
|
||||
- Upgrade packages with security vunrabilities
|
||||
- Saner defaults
|
||||
- Fediverse account migration
|
||||
- Recommended instances timeline
|
||||
- OCR image captioning
|
||||
- Improve mobile UX
|
||||
|
@ -88,8 +96,10 @@
|
|||
- Page drafts
|
||||
- Patron list
|
||||
- Animations respect reduced motion
|
||||
- Obliteration of Ai-chan
|
||||
- Undo renote button inside original note
|
||||
- Custom locales
|
||||
- Obliteration of Ai-chan
|
||||
- Switch to [Calckey.js](https://codeberg.org/thatonecalculator/calckey.js)
|
||||
- MissV: [fix Misskey Forkbomb](https://code.vtopia.live/Vtopia/MissV/commit/40b23c070bd4adbb3188c73546c6c625138fb3c1)
|
||||
- [Make showing ads optional](https://github.com/misskey-dev/misskey/pull/8996)
|
||||
- [Tapping avatar in mobile opens account modal](https://github.com/misskey-dev/misskey/pull/9056)
|
||||
|
@ -131,3 +141,4 @@
|
|||
- 4c5aa9e53887cca5561fcec6ab0754e018f589a5: server: allow to like own pages
|
||||
- 923c93da1228458dd65be47483c198a1a9191bcf: use await for notes.countBy
|
||||
- ca90cedba0a0704b503c2778694230f5a7dfbace: server: reduce dead instance detection to 7 days
|
||||
- e9ab42c10afb4e27516c2d2b5e3e06630efe9edd: Alt text in image viewer
|
||||
|
|
|
@ -1,46 +1,136 @@
|
|||
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, caste, color, religion, or sexual
|
||||
identity and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to creating a positive environment include:
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Using welcoming and inclusive language
|
||||
* Being respectful of differing viewpoints and experiences
|
||||
* Gracefully accepting constructive criticism
|
||||
* Focusing on what is best for the community
|
||||
* Showing empathy towards other community members
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the overall
|
||||
community
|
||||
|
||||
Examples of unacceptable behavior by participants include:
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery and unwelcome sexual attention or advances
|
||||
* Trolling, insulting/derogatory comments, and personal or political attacks
|
||||
* The use of sexualized language or imagery, and sexual attention or advances of
|
||||
any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or electronic address, without explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a professional setting
|
||||
* Publishing others' private information, such as a physical or email address,
|
||||
without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Our Responsibilities
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at syuilotan@yahoo.co.jp. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
@thatonecalculator on Codeberg,
|
||||
`@thatonecalculator@stop.voring.me` or `@t1c@i.calckey.cloud` on the Fediverse,
|
||||
or kainoa@t1c.dev via email.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series of
|
||||
actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or permanent
|
||||
ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within the
|
||||
community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.1, available at
|
||||
[https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
|
||||
|
||||
Community Impact Guidelines were inspired by
|
||||
[Mozilla's code of conduct enforcement ladder][Mozilla CoC].
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
[https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
|
||||
[https://www.contributor-covenant.org/translations][translations].
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
[v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
|
||||
[Mozilla CoC]: https://github.com/mozilla/diversity
|
||||
[FAQ]: https://www.contributor-covenant.org/faq
|
||||
[translations]: https://www.contributor-covenant.org/translations
|
||||
|
||||
[homepage]: http://contributor-covenant.org
|
||||
[version]: http://contributor-covenant.org/version/1/4/
|
||||
|
|
3
COPYING
3
COPYING
|
@ -1,10 +1,11 @@
|
|||
Unless otherwise stated this repository is
|
||||
Copyright © 2014-2022 syuilo and contributers
|
||||
Copyright © 2022 thatonecalculator and contributers
|
||||
|
||||
And is distributed under The GNU Affero General Public License Version 3, you should have received a copy of the license file as LICENSE.
|
||||
|
||||
|
||||
Misskey includes several third-party Open-Source softwares.
|
||||
Calckey includes several third-party Open-Source softwares.
|
||||
|
||||
Emoji keywords for Unicode 11 and below by Mu-An Chiou
|
||||
License: MIT
|
||||
|
|
|
@ -8,7 +8,7 @@ COPY . ./
|
|||
|
||||
# Install Dependencies
|
||||
RUN apk update
|
||||
RUN apk add git ffmpeg tini alpine-sdk
|
||||
RUN apk add git ffmpeg tini alpine-sdk python3
|
||||
|
||||
# Configure corepack and yarn
|
||||
RUN corepack enable
|
||||
|
|
27
README.md
27
README.md
|
@ -1,4 +1,4 @@
|
|||
<div align="center">
|
||||
<a href="https://ci.codeberg.org/thatonecalculator/calckey"><img src="https://ci.codeberg.org/api/badges/thatonecalculator/calckey/status.svg" align="left" height="20px" alt="Calc (the Calckey mascot) smoking a fat dart"/></a><br/><div align="center">
|
||||
<a href="https://i.calckey.cloud/">
|
||||
<img src="./.github/title_float.svg" alt="Calckey logo" style="border-radius:50%" width="400"/>
|
||||
</a>
|
||||
|
@ -11,6 +11,7 @@
|
|||
|
||||
<img src="https://pool.jortage.com/voringme/misskey/e7cd2a17-8b23-4e1e-b5cf-709480c623e2.png" align="right" height="320px" alt="Calc (the Calckey mascot) smoking a fat dart"/>
|
||||
|
||||
|
||||
# ✨ About Calckey
|
||||
|
||||
- Calckey is based off of Misskey, a powerful microblogging server on ActivityPub with features such as emoji reactions, a customizable web UI, rich chatting, and much more!
|
||||
|
@ -19,6 +20,7 @@
|
|||
- Notable differences:
|
||||
- Improved UI/UX (especially on mobile)
|
||||
- Improved notifications
|
||||
- Fediverse account migration
|
||||
- Improved instance security
|
||||
- Improved accessibility
|
||||
- Recommended Instances timeline
|
||||
|
@ -49,10 +51,10 @@ This guide will work for both **starting from scratch** and **migrating from Mis
|
|||
|
||||
## 📦 Dependencies
|
||||
|
||||
- 🐢 At least [NodeJS](https://nodejs.org/en/) v18.12.1 (v19.1.0 recommended)
|
||||
- 🐢 At least [NodeJS](https://nodejs.org/en/) v18.12.1 (v19 recommended)
|
||||
- Install with [nvm](https://github.com/nvm-sh/nvm)
|
||||
- 🐘 At least [PostgreSQL](https://www.postgresql.org/) v12
|
||||
- 🍱 At least [Redis](https://redis.io/) v6 (v7 recommended)
|
||||
- 🍱 At least [Redis](https://redis.io/) v6 (v7 recommend)
|
||||
|
||||
### 😗 Optional dependencies
|
||||
|
||||
|
@ -97,7 +99,7 @@ psql postgres -c "create database calckey with encoding = 'UTF8';"
|
|||
## 💅 Customize
|
||||
|
||||
- To add custom CSS for all users, edit `./custom/assets/instance.css`.
|
||||
- To add static assets (such as images for the splash screen), place them in the `./custom/assets/` directory. They'll then be avaliable on `https://yourinstance.tld/static-assets/filename.ext`.
|
||||
- To add static assets (such as images for the splash screen), place them in the `./custom/assets/` directory. They'll then be available on `https://yourinstance.tld/static-assets/filename.ext`.
|
||||
- To add custom locales, place them in the `./custom/locales/` directory. If you name your custom locale the same as an existing locale, it will overwrite it. If you give it a unique name, it will be added to the list. Also make sure that the first part of the filename matches the locale you're basing it on. (Example: `en-FOO.yml`)
|
||||
- To update custom assets without rebuilding, just run `yarn run gulp`.
|
||||
|
||||
|
@ -134,24 +136,13 @@ cp -r ../misskey/files . # if you don't use object storage
|
|||
```sh
|
||||
# git pull
|
||||
yarn install
|
||||
NODE_ENV=production yarn run build && yarn run migrate
|
||||
NODE_ENV=production yarn run rebuild && yarn run migrate
|
||||
pm2 start "NODE_ENV=production yarn start" --name Calckey
|
||||
```
|
||||
|
||||
### 🐋 Prebuilt Docker image
|
||||
### 🐋 Docker
|
||||
|
||||
```sh
|
||||
docker pull thatonecalculator/calckey
|
||||
docker up -d
|
||||
```
|
||||
|
||||
### 🐳 Docker Compose
|
||||
|
||||
```sh
|
||||
docker-compose build
|
||||
docker-compose run --rm web yarn run init
|
||||
docker-compose up -d
|
||||
```
|
||||
[How to run Calckey with Docker](./docker-README.md).
|
||||
|
||||
## 😉 Tips & Tricks
|
||||
|
||||
|
|
15
SECURITY.md
15
SECURITY.md
|
@ -1,9 +1,16 @@
|
|||
# Reporting Security Issues
|
||||
|
||||
If you discover a security issue in Misskey, please report it by sending an
|
||||
email to [syuilotan@yahoo.co.jp](mailto:syuilotan@yahoo.co.jp).
|
||||
## Minor Security Issues
|
||||
|
||||
If you discover a minor security issue in Calckey, please report it by sending an
|
||||
email to [kainoa@t1c.dev](mailto:kainoa@t1c.dev).
|
||||
|
||||
## High Security Issues
|
||||
|
||||
If you discover a security issue, which is so high risk, that too much is affected by it, please dont send it over unencrypted communication. You can share your PGP keys with us using kainoa@t1c.dev and after we established a secure communication, send it over E-Mail, or message us using matrix' encrypted private messages at @t1c:matrix.fedibird.com or @cleo:tchncs.de
|
||||
|
||||
|
||||
This will allow us to assess the risk, and make a fix available before we add a
|
||||
bug report to the GitHub repository.
|
||||
bug report to the Codeberg repository.
|
||||
|
||||
Thanks for helping make Misskey safe for everyone.
|
||||
Thanks for helping make Calckey safe for everyone.
|
||||
|
|
50
dev/docker-compose.yml
Normal file
50
dev/docker-compose.yml
Normal file
|
@ -0,0 +1,50 @@
|
|||
version: "3"
|
||||
|
||||
services:
|
||||
web:
|
||||
image: docker.io/thatonecalculator/calckey
|
||||
build: ..
|
||||
restart: always
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
# - es
|
||||
ports:
|
||||
- "3000:3000"
|
||||
networks:
|
||||
- network
|
||||
volumes:
|
||||
- ../files:/calckey/files
|
||||
- ../.config:/calckey/.config:ro
|
||||
|
||||
redis:
|
||||
restart: always
|
||||
image: docker.io/redis:7.0-alpine
|
||||
networks:
|
||||
- network
|
||||
volumes:
|
||||
- ../redis:/data
|
||||
|
||||
db:
|
||||
restart: always
|
||||
image: docker.io/postgres:12.2-alpine
|
||||
networks:
|
||||
- network
|
||||
env_file:
|
||||
- ../.config/docker.env
|
||||
volumes:
|
||||
- ../db:/var/lib/postgresql/data
|
||||
|
||||
# es:
|
||||
# restart: always
|
||||
# image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.2
|
||||
# environment:
|
||||
# - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
# - "TAKE_FILE_OWNERSHIP=111"
|
||||
# networks:
|
||||
# - network
|
||||
# volumes:
|
||||
# - ./elasticsearch:/usr/share/elasticsearch/data
|
||||
|
||||
networks:
|
||||
network:
|
46
docker-README.md
Normal file
46
docker-README.md
Normal file
|
@ -0,0 +1,46 @@
|
|||
# 🐳 Docker Compose for Development
|
||||
|
||||
```sh
|
||||
cd dev/
|
||||
docker-compose build
|
||||
docker-compose run --rm web yarn run init
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
# Running a Calckey instance with Docker
|
||||
|
||||
## Pre-built docker container
|
||||
[thatonecalculator/calckey](https://hub.docker.com/r/thatonecalculator/calckey)
|
||||
## docker-compose
|
||||
You can find a `docker-compose.yml` file in the same folder as this `README`, along with a folder called `.config` containing two **example** files needed to get the instance running:
|
||||
- .config/docker.env (**db config settings**)
|
||||
- .config/default.yml (**calckey instance settings**)
|
||||
|
||||
## configuring calckey
|
||||
|
||||
Rename the files:
|
||||
|
||||
`cp .config/default_example.yml .config/default.yml`
|
||||
|
||||
`cp .config/example.env .config/docker.env`
|
||||
|
||||
then edit them according to your environment.
|
||||
You can configure `docker.env` with anything you like, but you will have to pay attention to the `default.yml` file:
|
||||
- `url` should be set to the URL you will be hosting the web interface for the instance at.
|
||||
- `host`, `db`, `user`, `pass` will have to be configured in the `PostgreSQL configuration` section - `host` is the name of the postgres container (eg: *calckey_db_1*), and the others should match your `docker.env`.
|
||||
- `host`will need to be configured in the *Redis configuration* section - it is the name of the redis container (eg: *calckey_redis_1*)
|
||||
|
||||
Everything else can be left as-is.
|
||||
|
||||
## Running docker-compose
|
||||
The [prebuilt container for calckey](https://hub.docker.com/r/thatonecalculator/calckey) is fairly large, and may take a few minutes to download and extract using docker.
|
||||
|
||||
Copy `docker-compose.yml` and the `config/` to a directory, then run the **docker-compose** command:
|
||||
`docker-compose up -d`.
|
||||
|
||||
NOTE: This will take some time to come fully online, even after download and extracting the container images, and it may emit some error messages before completing successfully. Specifically, the `db` container needs to initialize and so isn't available to the `web` container right away. Only once the `db` container comes online does the `web` container start building and initializing the calckey tables.
|
||||
|
||||
Once the instance is up you can use a web browser to access the web interface at `http://serverip:3000` (where `serverip` is the IP of the server you are running the calckey instance on).
|
||||
|
||||
## Securing your instance with a reverse proxy
|
||||
On its own *calckey* serves itself with HTTP, and does not support SSL. In order to support encrypted connections via HTTPS - an absolute necessity if you intend to host an instance accessible from the public internet - you need to add a reverse proxy to your setup.
|
|
@ -3,8 +3,7 @@ version: "3"
|
|||
services:
|
||||
web:
|
||||
image: docker.io/thatonecalculator/calckey
|
||||
build: .
|
||||
restart: always
|
||||
restart: unless-stopped
|
||||
depends_on:
|
||||
- db
|
||||
- redis
|
||||
|
@ -12,39 +11,45 @@ services:
|
|||
ports:
|
||||
- "3000:3000"
|
||||
networks:
|
||||
- network
|
||||
- calcnet
|
||||
# - web
|
||||
environment:
|
||||
NODE_ENV: production
|
||||
volumes:
|
||||
- ./files:/calckey/files
|
||||
- ./.config:/calckey/.config:ro
|
||||
- ./config:/calckey/.config:ro
|
||||
|
||||
redis:
|
||||
restart: always
|
||||
image: docker.io/redis:4.0-alpine
|
||||
restart: unless-stopped
|
||||
image: docker.io/redis:7.0-alpine
|
||||
networks:
|
||||
- network
|
||||
- calcnet
|
||||
volumes:
|
||||
- ./redis:/data
|
||||
|
||||
db:
|
||||
restart: always
|
||||
restart: unless-stopped
|
||||
image: docker.io/postgres:12.2-alpine
|
||||
networks:
|
||||
- network
|
||||
- calcnet
|
||||
env_file:
|
||||
- .config/docker.env
|
||||
- config/docker.env
|
||||
volumes:
|
||||
- ./db:/var/lib/postgresql/data
|
||||
|
||||
# es:
|
||||
# restart: always
|
||||
# image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.2
|
||||
# environment:
|
||||
# restart: unless-stopped
|
||||
# image: docker.elastic.co/elasticsearch/elasticsearch-oss:6.4.2
|
||||
# environment:
|
||||
# - "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
# - "TAKE_FILE_OWNERSHIP=111"
|
||||
# networks:
|
||||
# - network
|
||||
# - calcnet
|
||||
# volumes:
|
||||
# - ./elasticsearch:/usr/share/elasticsearch/data
|
||||
|
||||
networks:
|
||||
network:
|
||||
calcnet:
|
||||
# web:
|
||||
# external:
|
||||
# name: web
|
||||
|
|
|
@ -89,7 +89,7 @@ privacy: "Privatsphäre"
|
|||
makeFollowManuallyApprove: "Follow-Anfragen benötigen Bestätigung"
|
||||
defaultNoteVisibility: "Standardsichtbarkeit"
|
||||
follow: "Folgen"
|
||||
followRequest: "Follow-Anfrage senden"
|
||||
followRequest: "Follow anfragen"
|
||||
followRequests: "Follow-Anfragen"
|
||||
unfollow: "Nicht mehr folgen"
|
||||
followRequestPending: "Follow-Anfrage ausstehend"
|
||||
|
@ -112,6 +112,7 @@ reactionSettingDescription2: "Ziehe um Anzuordnen, klicke um zu löschen, drück
|
|||
rememberNoteVisibility: "Notizsichtbarkeit merken"
|
||||
attachCancel: "Anhang entfernen"
|
||||
markAsSensitive: "Als NSFW markieren"
|
||||
accountMoved: "Benutzer hat zu einem anderen Account gewechselt."
|
||||
unmarkAsSensitive: "Als nicht NSFW markieren"
|
||||
enterFileName: "Dateinamen eingeben"
|
||||
mute: "Stummschalten"
|
||||
|
@ -256,7 +257,7 @@ agreeTo: "Ich stimme {0} zu"
|
|||
tos: "Nutzungsbedingungen"
|
||||
start: "Anfangen"
|
||||
home: "Startseite"
|
||||
remoteUserCaution: "Diese Informationen sind möglicherweise unvollständig, da der Benutzer von einer fremden Instanz stammt."
|
||||
remoteUserCaution: "Informationen von fremden Instanzen sind möglicherweise unvollständig."
|
||||
activity: "Aktivität"
|
||||
images: "Bilder"
|
||||
birthday: "Geburtstag"
|
||||
|
|
|
@ -59,7 +59,7 @@ followRequestAccepted: "Follow request accepted"
|
|||
mention: "Mention"
|
||||
mentions: "Mentions"
|
||||
directNotes: "Direct notes"
|
||||
importAndExport: "Import / Export"
|
||||
importAndExport: "Import/Export Data"
|
||||
import: "Import"
|
||||
export: "Export"
|
||||
files: "Files"
|
||||
|
@ -89,7 +89,7 @@ privacy: "Privacy"
|
|||
makeFollowManuallyApprove: "Follow requests require approval"
|
||||
defaultNoteVisibility: "Default visibility"
|
||||
follow: "Follow"
|
||||
followRequest: "Send follow request"
|
||||
followRequest: "Follow"
|
||||
followRequests: "Follow requests"
|
||||
unfollow: "Unfollow"
|
||||
followRequestPending: "Follow request pending"
|
||||
|
@ -149,6 +149,7 @@ addAccount: "Add account"
|
|||
loginFailed: "Failed to sign in"
|
||||
showOnRemote: "View on remote instance"
|
||||
general: "General"
|
||||
accountMoved: "User has moved to a new account:"
|
||||
wallpaper: "Wallpaper"
|
||||
setWallpaper: "Set wallpaper"
|
||||
removeWallpaper: "Remove wallpaper"
|
||||
|
@ -257,7 +258,7 @@ agreeTo: "I agree to {0}"
|
|||
tos: "Terms of Service"
|
||||
start: "Begin"
|
||||
home: "Home"
|
||||
remoteUserCaution: "As this user is from a remote instance, the shown information may be incomplete."
|
||||
remoteUserCaution: "Information from remote users may be incomplete."
|
||||
activity: "Activity"
|
||||
images: "Images"
|
||||
birthday: "Birthday"
|
||||
|
@ -920,6 +921,15 @@ swipeOnDesktop: "Allow mobile-style swiping on desktop"
|
|||
logoImageUrl: "Logo image URL"
|
||||
showAdminUpdates: "Indicate a new Calckey version is avaliable (admin only)"
|
||||
replayTutorial: "Replay tutorial"
|
||||
migration: "Migration"
|
||||
moveTo: "Move current account to new account"
|
||||
moveToLabel: "Account you're moving to:"
|
||||
moveAccount: "Move account!"
|
||||
moveAccountDescription: "This process is irriversable. Make sure you've set up an alias for this account on your new account before moving. Please enter the tag of the account formatted like @person@instance.com"
|
||||
moveFrom: "Move to this account from an older account"
|
||||
moveFromLabel: "Account you're moving from:"
|
||||
moveFromDescription: "This will set an alias of your old account so that you can move from that account to this current one. Do this BEFORE moving from your older account. Please enter the tag of the account formatted like @person@instance.com"
|
||||
migrationConfirm: "Are you absolutely sure you want to migrate your acccount to {account}? Once you do this, you won't be able to reverse it, and you won't be able to use your account normally again.\nAlso, please ensure that you've set this current account as the account you're moving from."
|
||||
|
||||
_sensitiveMediaDetection:
|
||||
description: "Reduces the effort of server moderation through automatically recognizing NSFW media via Machine Learning. This will slightly increase the load on the server."
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
---
|
|
@ -1 +0,0 @@
|
|||
---
|
|
@ -149,6 +149,7 @@ addAccount: "アカウントを追加"
|
|||
loginFailed: "ログインに失敗しました"
|
||||
showOnRemote: "リモートで表示"
|
||||
general: "全般"
|
||||
accountMoved: "このユーザーは新しいアカウントに移行しました"
|
||||
wallpaper: "壁紙"
|
||||
setWallpaper: "壁紙を設定"
|
||||
removeWallpaper: "壁紙を削除"
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
---
|
|
@ -108,7 +108,7 @@ sensitive: "열람주의"
|
|||
add: "추가"
|
||||
reaction: "리액션"
|
||||
reactionSetting: "선택기에 표시할 리액션"
|
||||
reactionSettingDescription2: "끌어서 순서 변경, 클릭해서 삭제, +를 눌러서 추가할 수 있습니다."
|
||||
reactionSettingDescription2: "끌어서 순서 변경, 클릭해서 삭제, +를 눌러서 추가할 수 있습니다."
|
||||
rememberNoteVisibility: "공개 범위를 기억하기"
|
||||
attachCancel: "첨부 취소"
|
||||
markAsSensitive: "열람주의로 설정"
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
---
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "calckey",
|
||||
"version": "12.119.0-calc.18",
|
||||
"version": "13.0.0",
|
||||
"codename": "aqua",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -14,11 +14,13 @@
|
|||
],
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"rebuild": "yarn clean && yarn build",
|
||||
"build": "yarn workspaces foreach run build && yarn run gulp",
|
||||
"start": "yarn workspace backend run start",
|
||||
"start:test": "yarn workspace backend run start:test",
|
||||
"init": "yarn migrate",
|
||||
"migrate": "yarn workspace backend run migrate",
|
||||
"revertmigration": "yarn workspace backend run revertmigration",
|
||||
"migrateandstart": "yarn migrate && yarn start",
|
||||
"gulp": "gulp build",
|
||||
"watch": "yarn dev",
|
||||
|
@ -42,6 +44,7 @@
|
|||
"@bull-board/api": "^4.6.4",
|
||||
"@bull-board/ui": "^4.6.4",
|
||||
"@tensorflow/tfjs": "^3.21.0",
|
||||
"calckey-js": "^0.0.17",
|
||||
"eslint": "^8.28.0",
|
||||
"execa": "5.1.1",
|
||||
"gulp": "4.0.2",
|
||||
|
|
8
packages/backend/.idea/.gitignore
vendored
Normal file
8
packages/backend/.idea/.gitignore
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
|
@ -0,0 +1,16 @@
|
|||
export class addMovedToAndKnownAs1669288094000 {
|
||||
name = 'addMovedToAndKnownAs1669288094000'
|
||||
|
||||
async up(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "user" ADD "movedToUri" character varying(512)`);
|
||||
await queryRunner.query(`ALTER TABLE "user" ADD "alsoKnownAs" TEXT`);
|
||||
await queryRunner.query(`COMMENT ON COLUMN "user"."movedToUri" IS 'The URI of the new account of the User'`);
|
||||
await queryRunner.query(`COMMENT ON COLUMN "user"."alsoKnownAs" IS 'URIs the user is known as too'`);
|
||||
}
|
||||
|
||||
async down(queryRunner) {
|
||||
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "movedToUri"`);
|
||||
await queryRunner.query(`ALTER TABLE "user" DROP COLUMN "alsoKnownAs"`);
|
||||
}
|
||||
|
||||
}
|
|
@ -7,6 +7,7 @@
|
|||
"start": "node ./built/index.js",
|
||||
"start:test": "NODE_ENV=test node ./built/index.js",
|
||||
"migrate": "typeorm migration:run -d ormconfig.js",
|
||||
"revertmigration": "typeorm migration:revert -d ormconfig.js",
|
||||
"build": "tsc -p tsconfig.json || echo done. && tsc-alias -p tsconfig.json",
|
||||
"watch": "node watch.mjs",
|
||||
"lint": "eslint --quiet \"src/**/*.ts\"",
|
||||
|
@ -41,6 +42,7 @@
|
|||
"blurhash": "1.1.5",
|
||||
"bull": "4.10.1",
|
||||
"cacheable-lookup": "7.0.0",
|
||||
"calckey-js": "^0.0.17",
|
||||
"cbor": "8.1.0",
|
||||
"chalk": "5.1.2",
|
||||
"chalk-template": "0.4.0",
|
||||
|
@ -76,7 +78,6 @@
|
|||
"koa-views": "7.0.2",
|
||||
"mfm-js": "0.23.0",
|
||||
"mime-types": "2.1.35",
|
||||
"misskey-js": "0.0.14",
|
||||
"mocha": "10.1.0",
|
||||
"multer": "1.4.4-lts.1",
|
||||
"nested-property": "4.0.0",
|
||||
|
|
|
@ -67,6 +67,7 @@ export type Source = {
|
|||
// Managed hosting stuff
|
||||
maxUserSignups?: number;
|
||||
isManagedHosting?: boolean;
|
||||
maxNoteLength?: number;
|
||||
deepl: {
|
||||
managed?: boolean;
|
||||
authKey?: string;
|
||||
|
|
|
@ -1,4 +1,6 @@
|
|||
export const MAX_NOTE_TEXT_LENGTH = 3000;
|
||||
import config from '@/config/index.js';
|
||||
|
||||
export const MAX_NOTE_TEXT_LENGTH = config.maxNoteLength != null ? config.maxNoteLength : 3000;
|
||||
|
||||
export const SECOND = 1000;
|
||||
export const SEC = 1000;
|
||||
|
|
|
@ -7,7 +7,7 @@ export async function fetchMeta(noCache = false): Promise<Meta> {
|
|||
if (!noCache && cache) return cache;
|
||||
|
||||
return await db.transaction(async transactionalEntityManager => {
|
||||
// 過去のバグでレコードが複数出来てしまっている可能性があるので新しいIDを優先する
|
||||
// New IDs are prioritized because multiple records may have been created due to past bugs.
|
||||
const metas = await transactionalEntityManager.find(Meta, {
|
||||
order: {
|
||||
id: 'DESC',
|
||||
|
@ -20,7 +20,7 @@ export async function fetchMeta(noCache = false): Promise<Meta> {
|
|||
cache = meta;
|
||||
return meta;
|
||||
} else {
|
||||
// metaが空のときfetchMetaが同時に呼ばれるとここが同時に呼ばれてしまうことがあるのでフェイルセーフなupsertを使う
|
||||
// If fetchMeta is called at the same time when meta is empty, this part may be called at the same time, so use fail-safe upsert.
|
||||
const saved = await transactionalEntityManager
|
||||
.upsert(
|
||||
Meta,
|
||||
|
|
|
@ -33,7 +33,6 @@ export async function skippedInstances(hosts: Array<Instace['host']>): Array<Ins
|
|||
})
|
||||
.andWhere(new Brackets(qb => { qb
|
||||
.where('instance.isSuspended')
|
||||
.orWhere('instance.lastCommunicatedAt < :deadTime', { deadTime });
|
||||
}))
|
||||
.select('host')
|
||||
.getRawMany()
|
||||
|
|
|
@ -68,6 +68,19 @@ export class User {
|
|||
})
|
||||
public followingCount: number;
|
||||
|
||||
@Column('varchar', {
|
||||
length: 512,
|
||||
nullable: true,
|
||||
comment: 'The URI of the new account of the User',
|
||||
})
|
||||
public movedToUri: string | null;
|
||||
|
||||
@Column('simple-array', {
|
||||
nullable: true,
|
||||
comment: 'URIs the user is known as too',
|
||||
})
|
||||
public alsoKnownAs: string[] | null;
|
||||
|
||||
@Column('integer', {
|
||||
default: 0,
|
||||
comment: 'The count of notes.',
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
import { db } from '@/db/postgre.js';
|
||||
import { PageLike } from '@/models/entities/page-like.js';
|
||||
import type { User } from '@/models/entities/user.js';
|
||||
import { Pages } from '../index.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
|
||||
export const PageLikeRepository = db.getRepository(PageLike).extend({
|
||||
async pack(
|
||||
src: PageLike['id'] | PageLike,
|
||||
me?: { id: User['id'] } | null | undefined
|
||||
me?: { id: User['id'] } | null | undefined,
|
||||
) {
|
||||
const like = typeof src === 'object' ? src : await this.findOneByOrFail({ id: src });
|
||||
|
||||
|
@ -17,8 +17,8 @@ export const PageLikeRepository = db.getRepository(PageLike).extend({
|
|||
},
|
||||
|
||||
packMany(
|
||||
likes: any[],
|
||||
me: { id: User['id'] }
|
||||
likes: PageLike[],
|
||||
me: { id: User['id'] },
|
||||
) {
|
||||
return Promise.all(likes.map(x => this.pack(x, me)));
|
||||
},
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { db } from '@/db/postgre.js';
|
||||
import { Page } from '@/models/entities/page.js';
|
||||
import { Packed } from '@/misc/schema.js';
|
||||
import type { Packed } from '@/misc/schema.js';
|
||||
import { awaitAll } from '@/prelude/await-all.js';
|
||||
import { DriveFile } from '@/models/entities/drive-file.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import type { DriveFile } from '@/models/entities/drive-file.js';
|
||||
import type { User } from '@/models/entities/user.js';
|
||||
import { Users, DriveFiles, PageLikes } from '../index.js';
|
||||
|
||||
export const PageRepository = db.getRepository(Page).extend({
|
||||
|
|
|
@ -1,22 +1,49 @@
|
|||
import { EntityRepository, Repository, In, Not } from 'typeorm';
|
||||
import { URL } from 'url';
|
||||
import { In, Not } from 'typeorm';
|
||||
import Ajv from 'ajv';
|
||||
import { User, ILocalUser, IRemoteUser } from '@/models/entities/user.js';
|
||||
import type { ILocalUser, IRemoteUser } from '@/models/entities/user.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import config from '@/config/index.js';
|
||||
import { Packed } from '@/misc/schema.js';
|
||||
import { awaitAll, Promiseable } from '@/prelude/await-all.js';
|
||||
import type { Packed } from '@/misc/schema.js';
|
||||
import type { Promiseable } from '@/prelude/await-all.js';
|
||||
import { awaitAll } from '@/prelude/await-all.js';
|
||||
import { populateEmojis } from '@/misc/populate-emojis.js';
|
||||
import { getAntennas } from '@/misc/antenna-cache.js';
|
||||
import { USER_ACTIVE_THRESHOLD, USER_ONLINE_THRESHOLD } from '@/const.js';
|
||||
import { Cache } from '@/misc/cache.js';
|
||||
import { db } from '@/db/postgre.js';
|
||||
import { Instance } from '../entities/instance.js';
|
||||
import { Notes, NoteUnreads, FollowRequests, Notifications, MessagingMessages, UserNotePinings, Followings, Blockings, Mutings, UserProfiles, UserSecurityKeys, UserGroupJoinings, Pages, Announcements, AnnouncementReads, Antennas, AntennaNotes, ChannelFollowings, Instances, DriveFiles } from '../index.js';
|
||||
import { isActor, getApId } from '@/remote/activitypub/type.js';
|
||||
import DbResolver from '@/remote/activitypub/db-resolver.js';
|
||||
import Resolver from '@/remote/activitypub/resolver.js';
|
||||
import { createPerson } from '@/remote/activitypub/models/person.js';
|
||||
import {
|
||||
AnnouncementReads,
|
||||
Announcements,
|
||||
AntennaNotes,
|
||||
Blockings,
|
||||
ChannelFollowings,
|
||||
DriveFiles,
|
||||
Followings,
|
||||
FollowRequests,
|
||||
Instances,
|
||||
MessagingMessages,
|
||||
Mutings,
|
||||
Notes,
|
||||
NoteUnreads,
|
||||
Notifications,
|
||||
Pages,
|
||||
UserGroupJoinings,
|
||||
UserNotePinings,
|
||||
UserProfiles,
|
||||
UserSecurityKeys,
|
||||
} from '../index.js';
|
||||
import type { Instance } from '../entities/instance.js';
|
||||
|
||||
const userInstanceCache = new Cache<Instance | null>(1000 * 60 * 60 * 3);
|
||||
|
||||
type IsUserDetailed<Detailed extends boolean> = Detailed extends true ? Packed<'UserDetailed'> : Packed<'UserLite'>;
|
||||
type IsMeAndIsUserDetailed<ExpectsMe extends boolean | null, Detailed extends boolean> =
|
||||
Detailed extends true ?
|
||||
Detailed extends true ?
|
||||
ExpectsMe extends true ? Packed<'MeDetailed'> :
|
||||
ExpectsMe extends false ? Packed<'UserDetailedNotMe'> :
|
||||
Packed<'UserDetailed'> :
|
||||
|
@ -33,12 +60,24 @@ const birthdaySchema = { type: 'string', pattern: /^([0-9]{4})-([0-9]{2})-([0-9]
|
|||
|
||||
function isLocalUser(user: User): user is ILocalUser;
|
||||
function isLocalUser<T extends { host: User['host'] }>(user: T): user is T & { host: null; };
|
||||
/**
|
||||
* Returns true if the user is local.
|
||||
*
|
||||
* @param user The user to check.
|
||||
* @returns True if the user is local.
|
||||
*/
|
||||
function isLocalUser(user: User | { host: User['host'] }): boolean {
|
||||
return user.host == null;
|
||||
}
|
||||
|
||||
function isRemoteUser(user: User): user is IRemoteUser;
|
||||
function isRemoteUser<T extends { host: User['host'] }>(user: T): user is T & { host: string; };
|
||||
/**
|
||||
* Returns true if the user is remote.
|
||||
*
|
||||
* @param user The user to check.
|
||||
* @returns True if the user is remote.
|
||||
*/
|
||||
function isRemoteUser(user: User | { host: User['host'] }): boolean {
|
||||
return !isLocalUser(user);
|
||||
}
|
||||
|
@ -156,6 +195,27 @@ export const UserRepository = db.getRepository(User).extend({
|
|||
return count > 0;
|
||||
},
|
||||
|
||||
async userFromURI(uri: string): Promise<User | null> {
|
||||
const dbResolver = new DbResolver();
|
||||
let local = await dbResolver.getUserFromApId(uri);
|
||||
if (local) {
|
||||
return local;
|
||||
}
|
||||
|
||||
// fetching Object once from remote
|
||||
const resolver = new Resolver();
|
||||
const object = await resolver.resolve(uri) as any;
|
||||
|
||||
// /@user If a URI other than the id is specified,
|
||||
// the URI is determined here
|
||||
if (uri !== object.id) {
|
||||
local = await dbResolver.getUserFromApId(object.id);
|
||||
if (local != null) return local;
|
||||
}
|
||||
|
||||
return isActor(object) ? await createPerson(getApId(object)) : null;
|
||||
},
|
||||
|
||||
async getHasUnreadAntenna(userId: User['id']): Promise<boolean> {
|
||||
const myAntennas = (await getAntennas()).filter(a => a.userId === userId);
|
||||
|
||||
|
@ -320,6 +380,8 @@ export const UserRepository = db.getRepository(User).extend({
|
|||
...(opts.detail ? {
|
||||
url: profile!.url,
|
||||
uri: user.uri,
|
||||
movedToUri: user.movedToUri ? await this.userFromURI(user.movedToUri) : null,
|
||||
alsoKnownAs: user.alsoKnownAs,
|
||||
createdAt: user.createdAt.toISOString(),
|
||||
updatedAt: user.updatedAt ? user.updatedAt.toISOString() : null,
|
||||
lastFetchedAt: user.lastFetchedAt ? user.lastFetchedAt.toISOString() : null,
|
||||
|
|
|
@ -96,6 +96,16 @@ export const packedUserDetailedNotMeOnlySchema = {
|
|||
format: 'uri',
|
||||
nullable: true, optional: false,
|
||||
},
|
||||
movedToUri: {
|
||||
type: 'string',
|
||||
format: 'uri',
|
||||
nullable: true, optional: false,
|
||||
},
|
||||
alsoKnownAs: {
|
||||
type: 'array',
|
||||
format: 'uri',
|
||||
nullable: true, optional: false,
|
||||
},
|
||||
createdAt: {
|
||||
type: 'string',
|
||||
nullable: false, optional: false,
|
||||
|
|
|
@ -20,7 +20,7 @@ import { UserPublickey } from '@/models/entities/user-publickey.js';
|
|||
|
||||
const logger = new Logger('inbox');
|
||||
|
||||
// ユーザーのinboxにアクティビティが届いた時の処理
|
||||
// Processing when an activity arrives in the user's inbox
|
||||
export default async (job: Bull.Job<InboxJobData>): Promise<string> => {
|
||||
const signature = job.data.signature; // HTTP-signature
|
||||
const activity = job.data.activity;
|
||||
|
@ -30,16 +30,15 @@ export default async (job: Bull.Job<InboxJobData>): Promise<string> => {
|
|||
delete info['@context'];
|
||||
logger.debug(JSON.stringify(info, null, 2));
|
||||
//#endregion
|
||||
|
||||
const host = toPuny(new URL(signature.keyId).hostname);
|
||||
|
||||
// ブロックしてたら中断
|
||||
// interrupt if blocked
|
||||
const meta = await fetchMeta();
|
||||
if (meta.blockedHosts.includes(host)) {
|
||||
return `Blocked request: ${host}`;
|
||||
}
|
||||
|
||||
// 非公開モードなら許可なインスタンスのみ
|
||||
// only whitelisted instances in private mode
|
||||
if (meta.privateMode && !meta.allowedHosts.includes(host)) {
|
||||
return `Blocked request: ${host}`;
|
||||
}
|
||||
|
@ -51,7 +50,7 @@ export default async (job: Bull.Job<InboxJobData>): Promise<string> => {
|
|||
|
||||
const dbResolver = new DbResolver();
|
||||
|
||||
// HTTP-Signature keyIdを元にDBから取得
|
||||
// HTTP-Signature keyId from DB
|
||||
let authUser: {
|
||||
user: CacheableRemoteUser;
|
||||
key: UserPublickey | null;
|
||||
|
@ -62,7 +61,7 @@ export default async (job: Bull.Job<InboxJobData>): Promise<string> => {
|
|||
try {
|
||||
authUser = await dbResolver.getAuthUserFromApId(getApId(activity.actor));
|
||||
} catch (e) {
|
||||
// 対象が4xxならスキップ
|
||||
// Skip if target is 4xx
|
||||
if (e instanceof StatusError) {
|
||||
if (e.isClientError) {
|
||||
return `skip: Ignored deleted actors on both ends ${activity.actor} - ${e.statusCode}`;
|
||||
|
|
|
@ -5,7 +5,7 @@ import DbResolver from '../../db-resolver.js';
|
|||
import { Users } from '@/models/index.js';
|
||||
|
||||
export default async (actor: CacheableRemoteUser, activity: IBlock): Promise<string> => {
|
||||
// ※ activity.objectにブロック対象があり、それは存在するローカルユーザーのはず
|
||||
// ※ There is a block target in activity.object, which should be a local user that exists.
|
||||
|
||||
const dbResolver = new DbResolver();
|
||||
const blockee = await dbResolver.getUserFromApId(activity.object);
|
||||
|
@ -15,7 +15,7 @@ export default async (actor: CacheableRemoteUser, activity: IBlock): Promise<str
|
|||
}
|
||||
|
||||
if (blockee.host != null) {
|
||||
return `skip: ブロックしようとしているユーザーはローカルユーザーではありません`;
|
||||
return `skip: The user you are trying to block is not a local user`;
|
||||
}
|
||||
|
||||
await block(await Users.findOneByOrFail({ id: actor.id }), await Users.findOneByOrFail({ id: blockee.id }));
|
||||
|
|
|
@ -1,5 +1,26 @@
|
|||
import { IObject, isCreate, isDelete, isUpdate, isRead, isFollow, isAccept, isReject, isAdd, isRemove, isAnnounce, isLike, isUndo, isBlock, isCollectionOrOrderedCollection, isCollection, isFlag } from '../type.js';
|
||||
import { CacheableRemoteUser } from '@/models/entities/user.js';
|
||||
import type { CacheableRemoteUser } from '@/models/entities/user.js';
|
||||
import { toArray } from '@/prelude/array.js';
|
||||
import {
|
||||
isCreate,
|
||||
isDelete,
|
||||
isUpdate,
|
||||
isRead,
|
||||
isFollow,
|
||||
isAccept,
|
||||
isReject,
|
||||
isAdd,
|
||||
isRemove,
|
||||
isAnnounce,
|
||||
isLike,
|
||||
isUndo,
|
||||
isBlock,
|
||||
isCollectionOrOrderedCollection,
|
||||
isCollection,
|
||||
isFlag,
|
||||
isMove,
|
||||
} from '../type.js';
|
||||
import { apLogger } from '../logger.js';
|
||||
import Resolver from '../resolver.js';
|
||||
import create from './create/index.js';
|
||||
import performDeleteActivity from './delete/index.js';
|
||||
import performUpdateActivity from './update/index.js';
|
||||
|
@ -14,10 +35,8 @@ import add from './add/index.js';
|
|||
import remove from './remove/index.js';
|
||||
import block from './block/index.js';
|
||||
import flag from './flag/index.js';
|
||||
import { apLogger } from '../logger.js';
|
||||
import Resolver from '../resolver.js';
|
||||
import { toArray } from '@/prelude/array.js';
|
||||
import { Users } from '@/models/index.js';
|
||||
import move from './move/index.js';
|
||||
import type { IObject } from '../type.js';
|
||||
|
||||
export async function performActivity(actor: CacheableRemoteUser, activity: IObject) {
|
||||
if (isCollectionOrOrderedCollection(activity)) {
|
||||
|
@ -68,6 +87,8 @@ async function performOneActivity(actor: CacheableRemoteUser, activity: IObject)
|
|||
await block(actor, activity);
|
||||
} else if (isFlag(activity)) {
|
||||
await flag(actor, activity);
|
||||
} else if (isMove(activity)) {
|
||||
await move(actor,activity);
|
||||
} else {
|
||||
apLogger.warn(`unrecognized activity type: ${(activity as any).type}`);
|
||||
}
|
||||
|
|
76
packages/backend/src/remote/activitypub/kernel/move/index.ts
Normal file
76
packages/backend/src/remote/activitypub/kernel/move/index.ts
Normal file
|
@ -0,0 +1,76 @@
|
|||
import type { CacheableRemoteUser } from '@/models/entities/user.js';
|
||||
import { IRemoteUser, User } from '@/models/entities/user.js';
|
||||
import DbResolver from '@/remote/activitypub/db-resolver.js';
|
||||
import { getRemoteUser } from '@/server/api/common/getters.js';
|
||||
import { updatePerson } from '@/remote/activitypub/models/person.js';
|
||||
import { Followings, Users } from '@/models/index.js';
|
||||
import { makePaginationQuery } from '@/server/api/common/make-pagination-query.js';
|
||||
import deleteFollowing from '@/services/following/delete.js';
|
||||
import create from '@/services/following/create.js';
|
||||
import { getUser } from '@/server/api/common/getters.js';
|
||||
import { IdentifiableError } from '@/misc/identifiable-error.js';
|
||||
import { ApiError } from '@/server/api/error.js';
|
||||
import { meta } from '@/server/api/endpoints/following/create.js';
|
||||
import { IObject, IActor } from '../../type.js';
|
||||
import type { IMove } from '../../type.js';
|
||||
import Resolver from '@/remote/activitypub/resolver.js';
|
||||
|
||||
export default async (actor: CacheableRemoteUser, activity: IMove): Promise<string> => {
|
||||
// ※ There is a block target in activity.object, which should be a local user that exists.
|
||||
|
||||
const dbResolver = new DbResolver();
|
||||
const resolver = new Resolver();
|
||||
let new_acc = await dbResolver.getUserFromApId(activity.target);
|
||||
let actor_new;
|
||||
if (!new_acc) actor_new = await resolver.resolve(<string>activity.target) as IActor;
|
||||
|
||||
if ((!new_acc || new_acc.uri === null) && (!actor_new || actor_new.id === null)) {
|
||||
return 'move: new acc not found';
|
||||
}
|
||||
|
||||
let newUri: string | null | undefined
|
||||
newUri = new_acc ? new_acc.uri :
|
||||
actor_new?.url?.toString();
|
||||
|
||||
if(newUri === null || newUri === undefined) return 'move: new acc not found #2';
|
||||
|
||||
await updatePerson(newUri);
|
||||
await updatePerson(actor.uri!);
|
||||
|
||||
new_acc = await dbResolver.getUserFromApId(newUri);
|
||||
let old = await dbResolver.getUserFromApId(actor.uri!);
|
||||
|
||||
if (old === null || old.uri === null || !new_acc?.alsoKnownAs?.includes(old.uri)) return 'move: accounts invalid';
|
||||
|
||||
old.movedToUri = new_acc.uri;
|
||||
|
||||
const followee = await getUser(actor.id).catch(e => {
|
||||
if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser);
|
||||
throw e;
|
||||
});
|
||||
|
||||
const followeeNew = await getUser(new_acc.id).catch(e => {
|
||||
if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser);
|
||||
throw e;
|
||||
});
|
||||
|
||||
const followings = await Followings.findBy({
|
||||
followeeId: followee.id,
|
||||
});
|
||||
|
||||
followings.forEach(async following => {
|
||||
//if follower is local
|
||||
if (!following.followerHost) {
|
||||
const follower = await getUser(following.followerId).catch(e => {
|
||||
if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser);
|
||||
throw e;
|
||||
});
|
||||
await deleteFollowing(follower!, followee);
|
||||
try {
|
||||
await create(follower!, followeeNew);
|
||||
} catch (e) { /* empty */ }
|
||||
}
|
||||
});
|
||||
|
||||
return 'ok';
|
||||
};
|
|
@ -172,6 +172,8 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<Us
|
|||
lastFetchedAt: new Date(),
|
||||
name: truncate(person.name, nameLength),
|
||||
isLocked: !!person.manuallyApprovesFollowers,
|
||||
movedToUri: person.movedTo,
|
||||
alsoKnownAs: person.alsoKnownAs,
|
||||
isExplorable: !!person.discoverable,
|
||||
username: person.preferredUsername,
|
||||
usernameLower: person.preferredUsername!.toLowerCase(),
|
||||
|
@ -277,21 +279,21 @@ export async function createPerson(uri: string, resolver?: Resolver): Promise<Us
|
|||
}
|
||||
|
||||
/**
|
||||
* Personの情報を更新します。
|
||||
* Misskeyに対象のPersonが登録されていなければ無視します。
|
||||
* Update Person data from remote.
|
||||
* If the target Person is not registered in Calckey, it is ignored.
|
||||
* @param uri URI of Person
|
||||
* @param resolver Resolver
|
||||
* @param hint Hint of Person object (この値が正当なPersonの場合、Remote resolveをせずに更新に利用します)
|
||||
* @param hint Hint of Person object (If this value is a valid Person, it is used for updating without Remote resolve)
|
||||
*/
|
||||
export async function updatePerson(uri: string, resolver?: Resolver | null, hint?: IObject): Promise<void> {
|
||||
if (typeof uri !== 'string') throw new Error('uri is not string');
|
||||
|
||||
// URIがこのサーバーを指しているならスキップ
|
||||
// Skip if the URI points to this server
|
||||
if (uri.startsWith(config.url + '/')) {
|
||||
return;
|
||||
}
|
||||
|
||||
//#region このサーバーに既に登録されているか
|
||||
//#region Already registered on this server?
|
||||
const exist = await Users.findOneBy({ uri }) as IRemoteUser;
|
||||
|
||||
if (exist == null) {
|
||||
|
@ -307,7 +309,7 @@ export async function updatePerson(uri: string, resolver?: Resolver | null, hint
|
|||
|
||||
logger.info(`Updating the Person: ${person.id}`);
|
||||
|
||||
// アバターとヘッダー画像をフェッチ
|
||||
// Fetch avatar and header image
|
||||
const [avatar, banner] = await Promise.all([
|
||||
person.icon,
|
||||
person.image,
|
||||
|
@ -317,7 +319,7 @@ export async function updatePerson(uri: string, resolver?: Resolver | null, hint
|
|||
: resolveImage(exist, img).catch(() => null),
|
||||
));
|
||||
|
||||
// カスタム絵文字取得
|
||||
// Custom pictogram acquisition
|
||||
const emojis = await extractEmojis(person.tag || [], exist.host).catch(e => {
|
||||
logger.info(`extractEmojis: ${e}`);
|
||||
return [] as Emoji[];
|
||||
|
@ -343,6 +345,8 @@ export async function updatePerson(uri: string, resolver?: Resolver | null, hint
|
|||
isBot: getApType(object) === 'Service',
|
||||
isCat: (person as any).isCat === true,
|
||||
isLocked: !!person.manuallyApprovesFollowers,
|
||||
movedToUri: person.movedTo,
|
||||
alsoKnownAs: person.alsoKnownAs,
|
||||
isExplorable: !!person.discoverable,
|
||||
} as Partial<User>;
|
||||
|
||||
|
@ -374,10 +378,10 @@ export async function updatePerson(uri: string, resolver?: Resolver | null, hint
|
|||
|
||||
publishInternalEvent('remoteUserUpdated', { id: exist.id });
|
||||
|
||||
// ハッシュタグ更新
|
||||
// Hashtag Update
|
||||
updateUsertags(exist, tags);
|
||||
|
||||
// 該当ユーザーが既にフォロワーになっていた場合はFollowingもアップデートする
|
||||
// If the user in question is a follower, followers will also be updated.
|
||||
await Followings.update({
|
||||
followerId: exist.id,
|
||||
}, {
|
||||
|
@ -388,15 +392,15 @@ export async function updatePerson(uri: string, resolver?: Resolver | null, hint
|
|||
}
|
||||
|
||||
/**
|
||||
* Personを解決します。
|
||||
* Resolve Person.
|
||||
*
|
||||
* Misskeyに対象のPersonが登録されていればそれを返し、そうでなければ
|
||||
* リモートサーバーからフェッチしてMisskeyに登録しそれを返します。
|
||||
* If the target person is registered in Calckey, it returns it;
|
||||
* otherwise, it fetches it from the remote server, registers it in Calckey, and returns it.
|
||||
*/
|
||||
export async function resolvePerson(uri: string, resolver?: Resolver): Promise<CacheableUser> {
|
||||
if (typeof uri !== 'string') throw new Error('uri is not string');
|
||||
|
||||
//#region このサーバーに既に登録されていたらそれを返す
|
||||
//#region If already registered on this server, return it.
|
||||
const exist = await fetchPerson(uri);
|
||||
|
||||
if (exist) {
|
||||
|
@ -404,7 +408,7 @@ export async function resolvePerson(uri: string, resolver?: Resolver): Promise<C
|
|||
}
|
||||
//#endregion
|
||||
|
||||
// リモートサーバーからフェッチしてきて登録
|
||||
// Fetched from remote server and registered
|
||||
if (resolver == null) resolver = new Resolver();
|
||||
return await createPerson(uri, resolver);
|
||||
}
|
||||
|
@ -482,14 +486,14 @@ export async function updateFeatured(userId: User['id'], resolver?: Resolver) {
|
|||
// Resolve and regist Notes
|
||||
const limit = promiseLimit<Note | null>(2);
|
||||
const featuredNotes = await Promise.all(items
|
||||
.filter(item => getApType(item) === 'Note') // TODO: Noteでなくてもいいかも
|
||||
.filter(item => getApType(item) === 'Note') // TODO: Maybe it doesn't have to be a Note.
|
||||
.slice(0, 5)
|
||||
.map(item => limit(() => resolveNote(item, resolver))));
|
||||
|
||||
await db.transaction(async transactionalEntityManager => {
|
||||
await transactionalEntityManager.delete(UserNotePining, { userId: user.id });
|
||||
|
||||
// とりあえずidを別の時間で生成して順番を維持
|
||||
// For now, generate the id at a different time and maintain the order.
|
||||
let td = 0;
|
||||
for (const note of featuredNotes.filter(note => note != null)) {
|
||||
td -= 1000;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import config from '@/config/index.js';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { IActivity } from '../type.js';
|
||||
import { LdSignature } from '../misc/ld-signature.js';
|
||||
import config from '@/config/index.js';
|
||||
import { getUserKeypair } from '@/misc/keypair-store.js';
|
||||
import { User } from '@/models/entities/user.js';
|
||||
import type { User } from '@/models/entities/user.js';
|
||||
import { LdSignature } from '../misc/ld-signature.js';
|
||||
import type { IActivity } from '../type.js';
|
||||
|
||||
export const renderActivity = (x: any): IActivity | null => {
|
||||
if (x == null) return null;
|
||||
|
@ -19,6 +19,7 @@ export const renderActivity = (x: any): IActivity | null => {
|
|||
{
|
||||
// as non-standards
|
||||
manuallyApprovesFollowers: 'as:manuallyApprovesFollowers',
|
||||
movedToUri: 'as:movedTo',
|
||||
sensitive: 'as:sensitive',
|
||||
Hashtag: 'as:Hashtag',
|
||||
quoteUrl: 'as:quoteUrl',
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import { URL } from 'node:url';
|
||||
import * as mfm from 'mfm-js';
|
||||
import renderImage from './image.js';
|
||||
import renderKey from './key.js';
|
||||
import config from '@/config/index.js';
|
||||
import { ILocalUser } from '@/models/entities/user.js';
|
||||
import { toHtml } from '../../../mfm/to-html.js';
|
||||
import { getEmojis } from './note.js';
|
||||
import renderEmoji from './emoji.js';
|
||||
import { IIdentifier } from '../models/identifier.js';
|
||||
import renderHashtag from './hashtag.js';
|
||||
import type { ILocalUser } from '@/models/entities/user.js';
|
||||
import { DriveFiles, UserProfiles } from '@/models/index.js';
|
||||
import { getUserKeypair } from '@/misc/keypair-store.js';
|
||||
import { toHtml } from '../../../mfm/to-html.js';
|
||||
import renderImage from './image.js';
|
||||
import renderKey from './key.js';
|
||||
import { getEmojis } from './note.js';
|
||||
import renderEmoji from './emoji.js';
|
||||
import renderHashtag from './hashtag.js';
|
||||
import type { IIdentifier } from '../models/identifier.js';
|
||||
|
||||
export async function renderPerson(user: ILocalUser) {
|
||||
const id = `${config.url}/users/${user.id}`;
|
||||
|
@ -72,16 +72,24 @@ export async function renderPerson(user: ILocalUser) {
|
|||
tag,
|
||||
manuallyApprovesFollowers: user.isLocked,
|
||||
discoverable: !!user.isExplorable,
|
||||
publicKey: renderKey(user, keypair, `#main-key`),
|
||||
publicKey: renderKey(user, keypair, '#main-key'),
|
||||
isCat: user.isCat,
|
||||
attachment: attachment.length ? attachment : undefined,
|
||||
} as any;
|
||||
|
||||
if (profile?.birthday) {
|
||||
if (user.movedToUri) {
|
||||
person.movedTo = user.movedToUri;
|
||||
}
|
||||
|
||||
if (user.alsoKnownAs) {
|
||||
person.alsoKnownAs = user.alsoKnownAs;
|
||||
}
|
||||
|
||||
if (profile.birthday) {
|
||||
person['vcard:bday'] = profile.birthday;
|
||||
}
|
||||
|
||||
if (profile?.location) {
|
||||
if (profile.location) {
|
||||
person['vcard:Address'] = profile.location;
|
||||
}
|
||||
|
||||
|
|
|
@ -156,9 +156,11 @@ export interface IActor extends IObject {
|
|||
name?: string;
|
||||
preferredUsername?: string;
|
||||
manuallyApprovesFollowers?: boolean;
|
||||
movedTo?: string;
|
||||
alsoKnownAs?: string[];
|
||||
discoverable?: boolean;
|
||||
inbox: string;
|
||||
sharedInbox?: string; // 後方互換性のため
|
||||
sharedInbox?: string; // backward compatibility.. ig
|
||||
publicKey?: {
|
||||
id: string;
|
||||
publicKeyPem: string;
|
||||
|
@ -279,6 +281,11 @@ export interface IFlag extends IActivity {
|
|||
type: 'Flag';
|
||||
}
|
||||
|
||||
export interface IMove extends IActivity {
|
||||
type: 'Move';
|
||||
target: IObject | string;
|
||||
}
|
||||
|
||||
export const isCreate = (object: IObject): object is ICreate => getApType(object) === 'Create';
|
||||
export const isDelete = (object: IObject): object is IDelete => getApType(object) === 'Delete';
|
||||
export const isUpdate = (object: IObject): object is IUpdate => getApType(object) === 'Update';
|
||||
|
@ -293,3 +300,4 @@ export const isLike = (object: IObject): object is ILike => getApType(object) ==
|
|||
export const isAnnounce = (object: IObject): object is IAnnounce => getApType(object) === 'Announce';
|
||||
export const isBlock = (object: IObject): object is IBlock => getApType(object) === 'Block';
|
||||
export const isFlag = (object: IObject): object is IFlag => getApType(object) === 'Flag';
|
||||
export const isMove = (object: IObject): object is IMove => getApType(object) === 'Move';
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { URL } from 'node:url';
|
||||
import webFinger from './webfinger.js';
|
||||
import config from '@/config/index.js';
|
||||
import { createPerson, updatePerson } from './activitypub/models/person.js';
|
||||
import { remoteLogger } from './logger.js';
|
||||
import chalk from 'chalk';
|
||||
import { User, IRemoteUser } from '@/models/entities/user.js';
|
||||
import { IsNull } from 'typeorm';
|
||||
import config from '@/config/index.js';
|
||||
import type { User, IRemoteUser } from '@/models/entities/user.js';
|
||||
import { Users } from '@/models/index.js';
|
||||
import { toPuny } from '@/misc/convert-host.js';
|
||||
import { IsNull } from 'typeorm';
|
||||
import webFinger from './webfinger.js';
|
||||
import { createPerson, updatePerson } from './activitypub/models/person.js';
|
||||
import { remoteLogger } from './logger.js';
|
||||
|
||||
const logger = remoteLogger.createSubLogger('resolve-user');
|
||||
|
||||
|
@ -49,9 +49,9 @@ export async function resolveUser(username: string, host: string | null): Promis
|
|||
return await createPerson(self.href);
|
||||
}
|
||||
|
||||
// ユーザー情報が古い場合は、WebFilgerからやりなおして返す
|
||||
// If user information is out of date, return it by starting over from WebFilger
|
||||
if (user.lastFetchedAt == null || Date.now() - user.lastFetchedAt.getTime() > 1000 * 60 * 60 * 24) {
|
||||
// 繋がらないインスタンスに何回も試行するのを防ぐ, 後続の同様処理の連続試行を防ぐ ため 試行前にも更新する
|
||||
// Prevent multiple attempts to connect to unconnected instances, update before each attempt to prevent subsequent similar attempts
|
||||
await Users.update(user.id, {
|
||||
lastFetchedAt: new Date(),
|
||||
});
|
||||
|
@ -67,7 +67,7 @@ export async function resolveUser(username: string, host: string | null): Promis
|
|||
// validate uri
|
||||
const uri = new URL(self.href);
|
||||
if (uri.hostname !== host) {
|
||||
throw new Error(`Invalid uri`);
|
||||
throw new Error('Invalid uri');
|
||||
}
|
||||
|
||||
await Users.update({
|
||||
|
|
|
@ -38,6 +38,7 @@ function inbox(ctx: Router.RouterContext) {
|
|||
return;
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
processInbox(ctx.request.body, signature);
|
||||
|
||||
ctx.status = 202;
|
||||
|
@ -86,7 +87,7 @@ router.get('/notes/:note', async (ctx, next) => {
|
|||
return;
|
||||
}
|
||||
|
||||
// リモートだったらリダイレクト
|
||||
// redirect if remote
|
||||
if (note.userHost != null) {
|
||||
if (note.uri == null || isSelfHost(note.userHost)) {
|
||||
ctx.status = 500;
|
||||
|
|
|
@ -61,7 +61,7 @@ export default async (ctx: Router.RouterContext) => {
|
|||
followerId: user.id,
|
||||
} as FindOptionsWhere<Following>;
|
||||
|
||||
// カーソルが指定されている場合
|
||||
// If a cursor is specified
|
||||
if (cursor) {
|
||||
query.id = LessThan(cursor);
|
||||
}
|
||||
|
@ -73,7 +73,7 @@ export default async (ctx: Router.RouterContext) => {
|
|||
order: { id: -1 },
|
||||
});
|
||||
|
||||
// 「次のページ」があるかどうか
|
||||
// Whether there is a "next page" or not
|
||||
const inStock = followings.length === limit + 1;
|
||||
if (inStock) followings.pop();
|
||||
|
||||
|
|
|
@ -306,6 +306,7 @@ import * as ep___users_groups_transfer from './endpoints/users/groups/transfer.j
|
|||
import * as ep___users_groups_update from './endpoints/users/groups/update.js';
|
||||
import * as ep___users_lists_create from './endpoints/users/lists/create.js';
|
||||
import * as ep___users_lists_delete from './endpoints/users/lists/delete.js';
|
||||
import * as ep___users_lists_delete_all from './endpoints/users/lists/delete-all.js';
|
||||
import * as ep___users_lists_list from './endpoints/users/lists/list.js';
|
||||
import * as ep___users_lists_pull from './endpoints/users/lists/pull.js';
|
||||
import * as ep___users_lists_push from './endpoints/users/lists/push.js';
|
||||
|
@ -324,6 +325,10 @@ import * as ep___users_stats from './endpoints/users/stats.js';
|
|||
import * as ep___fetchRss from './endpoints/fetch-rss.js';
|
||||
import * as ep___admin_driveCapOverride from './endpoints/admin/drive-capacity-override.js';
|
||||
|
||||
//Calckey Move
|
||||
import * as ep___i_move from './endpoints/i/move.js';
|
||||
import * as ep___i_known_as from './endpoints/i/known-as.js';
|
||||
|
||||
const eps = [
|
||||
['admin/meta', ep___admin_meta],
|
||||
['admin/abuse-user-reports', ep___admin_abuseUserReports],
|
||||
|
@ -488,6 +493,8 @@ const eps = [
|
|||
['hashtags/trend', ep___hashtags_trend],
|
||||
['hashtags/users', ep___hashtags_users],
|
||||
['i', ep___i],
|
||||
['i/known-as', ep___i_known_as],
|
||||
['i/move', ep___i_move],
|
||||
['i/2fa/done', ep___i_2fa_done],
|
||||
['i/2fa/key-done', ep___i_2fa_keyDone],
|
||||
['i/2fa/password-less', ep___i_2fa_passwordLess],
|
||||
|
@ -631,6 +638,7 @@ const eps = [
|
|||
['users/groups/update', ep___users_groups_update],
|
||||
['users/lists/create', ep___users_lists_create],
|
||||
['users/lists/delete', ep___users_lists_delete],
|
||||
['users/lists/delete-all', ep___users_lists_delete_all],
|
||||
['users/lists/list', ep___users_lists_list],
|
||||
['users/lists/pull', ep___users_lists_pull],
|
||||
['users/lists/push', ep___users_lists_push],
|
||||
|
|
|
@ -62,6 +62,7 @@ export const paramDef = {
|
|||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
if(user.movedToUri != null) throw new ApiError(meta.errors.noSuchUserGroup);
|
||||
let userList;
|
||||
let userGroupJoining;
|
||||
|
||||
|
|
|
@ -88,10 +88,10 @@ export default define(meta, paramDef, async (ps, me) => {
|
|||
});
|
||||
|
||||
/***
|
||||
* URIからUserかNoteを解決する
|
||||
* Resolve User or Note from URI
|
||||
*/
|
||||
async function fetchAny(uri: string, me: CacheableLocalUser | null | undefined): Promise<SchemaType<typeof meta['res']> | null> {
|
||||
// ブロックしてたら中断
|
||||
// Wait if blocked.
|
||||
const fetchedMeta = await fetchMeta();
|
||||
if (fetchedMeta.blockedHosts.includes(extractDbHost(uri))) return null;
|
||||
|
||||
|
@ -103,12 +103,12 @@ async function fetchAny(uri: string, me: CacheableLocalUser | null | undefined):
|
|||
]));
|
||||
if (local != null) return local;
|
||||
|
||||
// リモートから一旦オブジェクトフェッチ
|
||||
// fetching Object once from remote
|
||||
const resolver = new Resolver();
|
||||
const object = await resolver.resolve(uri) as any;
|
||||
|
||||
// /@user のような正規id以外で取得できるURIが指定されていた場合、ここで初めて正規URIが確定する
|
||||
// これはDBに存在する可能性があるため再度DB検索
|
||||
// /@user If a URI other than the id is specified,
|
||||
// the URI is determined here
|
||||
if (uri !== object.id) {
|
||||
local = await mergePack(me, ...await Promise.all([
|
||||
dbResolver.getUserFromApId(object.id),
|
||||
|
|
|
@ -31,6 +31,10 @@ export const paramDef = {
|
|||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
if(user && user.movedToUri != null) return await Apps.pack("", null, {
|
||||
detail: true,
|
||||
includeSecret: true,
|
||||
});;
|
||||
// Generate secret
|
||||
const secret = secureRndstr(32, true);
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import { fetchMeta } from '@/misc/fetch-meta.js';
|
|||
export const meta = {
|
||||
tags: ['federation'],
|
||||
|
||||
requireCredential: true,
|
||||
requireCredential: false,
|
||||
requireCredentialPrivateMode: true,
|
||||
|
||||
res: {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import define from '../../../define.js';
|
||||
import { GalleryPosts } from '@/models/index.js';
|
||||
import define from '../../../define.js';
|
||||
import { makePaginationQuery } from '../../../common/make-pagination-query.js';
|
||||
|
||||
export const meta = {
|
||||
|
@ -33,7 +33,7 @@ export const paramDef = {
|
|||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
const query = makePaginationQuery(GalleryPosts.createQueryBuilder('post'), ps.sinceId, ps.untilId)
|
||||
.andWhere(`post.userId = :meId`, { meId: user.id });
|
||||
.andWhere('post.userId = :meId', { meId: user.id });
|
||||
|
||||
const posts = await query
|
||||
.take(ps.limit)
|
||||
|
|
102
packages/backend/src/server/api/endpoints/i/known-as.ts
Normal file
102
packages/backend/src/server/api/endpoints/i/known-as.ts
Normal file
|
@ -0,0 +1,102 @@
|
|||
import type { User, UserDetailedNotMeOnly } from "@/models/entities/user.js";
|
||||
import { Users } from "@/models/index.js";
|
||||
import { resolveUser } from "@/remote/resolve-user.js";
|
||||
import acceptAllFollowRequests from "@/services/following/requests/accept-all.js";
|
||||
import { publishToFollowers } from "@/services/i/update.js";
|
||||
import { publishMainStream } from "@/services/stream.js";
|
||||
import { DAY } from "@/const.js";
|
||||
import { apiLogger } from "../../logger.js";
|
||||
import { UserProfiles } from "@/models/index.js";
|
||||
import config from "@/config/index.js";
|
||||
import define from "../../define.js";
|
||||
import { ApiError } from "../../error.js";
|
||||
|
||||
export const meta = {
|
||||
tags: ["users"],
|
||||
|
||||
secure: true,
|
||||
requireCredential: true,
|
||||
|
||||
limit: {
|
||||
duration: DAY,
|
||||
max: 30,
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchUser: {
|
||||
message: "No such user.",
|
||||
code: "NO_SUCH_USER",
|
||||
id: "fcd2eef9-a9b2-4c4f-8624-038099e90aa5",
|
||||
},
|
||||
notRemote: {
|
||||
message: "User is not remote. You can only migrate to other instances.",
|
||||
code: "NOT_REMOTE",
|
||||
id: "4362f8dc-731f-4ad8-a694-be2a88922a24",
|
||||
},
|
||||
uriNull: {
|
||||
message: "User ActivityPup URI is null.",
|
||||
code: "URI_NULL",
|
||||
id: "bf326f31-d430-4f97-9933-5d61e4d48a23",
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
type: "object",
|
||||
properties: {
|
||||
alsoKnownAs: { type: "string" },
|
||||
},
|
||||
required: ["alsoKnownAs"],
|
||||
} as const;
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
if (!ps.alsoKnownAs) throw new ApiError(meta.errors.noSuchUser);
|
||||
|
||||
let unfiltered: string = ps.alsoKnownAs;
|
||||
const updates = {} as Partial<User>;
|
||||
|
||||
if (!unfiltered) {
|
||||
updates.alsoKnownAs = null;
|
||||
} else {
|
||||
if (unfiltered.startsWith('acct:')) unfiltered = unfiltered.substring(5);
|
||||
if (unfiltered.startsWith("@")) unfiltered = unfiltered.substring(1);
|
||||
if (!unfiltered.includes("@")) throw new ApiError(meta.errors.notRemote);
|
||||
|
||||
const userAddress: string[] = unfiltered.split("@");
|
||||
const knownAs = await resolveUser(userAddress[0], userAddress[1]).catch(
|
||||
(e) => {
|
||||
apiLogger.warn(`failed to resolve remote user: ${e}`);
|
||||
throw new ApiError(meta.errors.noSuchUser);
|
||||
}
|
||||
);
|
||||
|
||||
let toUrl: string | null = knownAs.uri;
|
||||
if (!toUrl) {
|
||||
throw new ApiError(meta.errors.uriNull);
|
||||
}
|
||||
if (updates.alsoKnownAs == null || updates.alsoKnownAs.length === 0) {
|
||||
updates.alsoKnownAs = [toUrl];
|
||||
} else {
|
||||
updates.alsoKnownAs.push(toUrl);
|
||||
}
|
||||
}
|
||||
|
||||
await Users.update(user.id, updates);
|
||||
|
||||
const iObj = await Users.pack<true, true>(user.id, user, {
|
||||
detail: true,
|
||||
includeSecrets: true,
|
||||
});
|
||||
|
||||
// Publish meUpdated event
|
||||
publishMainStream(user.id, "meUpdated", iObj);
|
||||
|
||||
if (user.isLocked === false) {
|
||||
acceptAllFollowRequests(user);
|
||||
}
|
||||
|
||||
publishToFollowers(user.id);
|
||||
|
||||
return iObj;
|
||||
});
|
169
packages/backend/src/server/api/endpoints/i/move.ts
Normal file
169
packages/backend/src/server/api/endpoints/i/move.ts
Normal file
|
@ -0,0 +1,169 @@
|
|||
import type { User } from '@/models/entities/user.js';
|
||||
import { resolveUser } from '@/remote/resolve-user.js';
|
||||
import { DAY } from '@/const.js';
|
||||
import DeliverManager from '@/remote/activitypub/deliver-manager.js';
|
||||
import { renderActivity } from '@/remote/activitypub/renderer/index.js';
|
||||
import { genId } from '@/misc/gen-id.js';
|
||||
import define from '../../define.js';
|
||||
import { ApiError } from '../../error.js';
|
||||
import { apiLogger } from '../../logger.js';
|
||||
import deleteFollowing from '@/services/following/delete.js';
|
||||
import create from '@/services/following/create.js';
|
||||
import { getUser } from '@/server/api/common/getters.js';
|
||||
import { Followings, Users } from '@/models/index.js';
|
||||
import { UserProfiles } from '@/models/index.js';
|
||||
import config from '@/config/index.js';
|
||||
import { publishMainStream } from '@/services/stream.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['users'],
|
||||
|
||||
secure: true,
|
||||
requireCredential: true,
|
||||
|
||||
limit: {
|
||||
duration: DAY,
|
||||
max: 5,
|
||||
},
|
||||
|
||||
errors: {
|
||||
noSuchMoveTarget: {
|
||||
message: 'No such move target.',
|
||||
code: 'NO_SUCH_MOVE_TARGET',
|
||||
id: 'b5c90186-4ab0-49c8-9bba-a1f76c202ba4',
|
||||
},
|
||||
remoteAccountForbids: {
|
||||
message: 'Remote account doesn\'t have proper \'Known As\' alias. Did you remember to set it?',
|
||||
code: 'REMOTE_ACCOUNT_FORBIDS',
|
||||
id: 'b5c90186-4ab0-49c8-9bba-a1f766282ba4',
|
||||
},
|
||||
notRemote: {
|
||||
message: 'User is not remote. You can only migrate to other instances.',
|
||||
code: 'NOT_REMOTE',
|
||||
id: '4362f8dc-731f-4ad8-a694-be2a88922a24',
|
||||
},
|
||||
adminForbidden: {
|
||||
message: 'Admins cant migrate.',
|
||||
code: 'NOT_ADMIN_FORBIDDEN',
|
||||
id: '4362e8dc-731f-4ad8-a694-be2a88922a24',
|
||||
},
|
||||
noSuchUser: {
|
||||
message: 'No such user.',
|
||||
code: 'NO_SUCH_USER',
|
||||
id: 'fcd2eef9-a9b2-4c4f-8624-038099e90aa5',
|
||||
},
|
||||
uriNull: {
|
||||
message: "User ActivityPup URI is null.",
|
||||
code: "URI_NULL",
|
||||
id: "bf326f31-d430-4f97-9933-5d61e4d48a23",
|
||||
},
|
||||
localUriNull: {
|
||||
message: "Local User ActivityPup URI is null.",
|
||||
code: "URI_NULL",
|
||||
id: "95ba11b9-90e8-43a5-ba16-7acc1ab32e71",
|
||||
},
|
||||
alreadyMoved: {
|
||||
message: "Account was already moved to another account.",
|
||||
code: "ALREADY_MOVED",
|
||||
id: "b234a14e-9ebe-4581-8000-074b3c215962",
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
moveToAccount: { type: 'string' },
|
||||
},
|
||||
required: ['moveToAccount'],
|
||||
} as const;
|
||||
|
||||
function moveActivity(toUrl: string, fromUrl: string) {
|
||||
const activity = {
|
||||
id: genId(),
|
||||
actor: fromUrl,
|
||||
type: 'Move',
|
||||
object: fromUrl,
|
||||
target: toUrl,
|
||||
} as any;
|
||||
|
||||
return renderActivity(activity);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
if (!ps.moveToAccount) throw new ApiError(meta.errors.noSuchMoveTarget);
|
||||
if (user.isAdmin) throw new ApiError(meta.errors.adminForbidden);
|
||||
if (user.movedToUri) throw new ApiError(meta.errors.alreadyMoved);
|
||||
|
||||
let unfiltered: string = ps.moveToAccount;
|
||||
if (!unfiltered) {
|
||||
throw new ApiError(meta.errors.noSuchMoveTarget);
|
||||
}
|
||||
|
||||
if (unfiltered.startsWith('acct:')) unfiltered = unfiltered.substring(5);
|
||||
if (unfiltered.startsWith('@')) unfiltered = unfiltered.substring(1);
|
||||
if (!unfiltered.includes('@')) throw new ApiError(meta.errors.notRemote);
|
||||
|
||||
const userAddress: string[] = unfiltered.split('@');
|
||||
const moveTo: User = await resolveUser(userAddress[0], userAddress[1]).catch(e => {
|
||||
apiLogger.warn(`failed to resolve remote user: ${e}`);
|
||||
throw new ApiError(meta.errors.noSuchMoveTarget);
|
||||
});
|
||||
let fromUrl: string | null = user.uri;
|
||||
if(!fromUrl) {
|
||||
fromUrl = `${config.url}/users/${user.id}`;
|
||||
}
|
||||
|
||||
let toUrl: string | null = moveTo.uri;
|
||||
if(!toUrl) {
|
||||
throw new ApiError(meta.errors.uriNull);
|
||||
}
|
||||
|
||||
let allowed = false;
|
||||
|
||||
moveTo.alsoKnownAs?.forEach(element => {
|
||||
if (fromUrl!.includes(element)) allowed = true;
|
||||
});
|
||||
|
||||
if (!allowed || !toUrl || !fromUrl) throw new ApiError(meta.errors.remoteAccountForbids);
|
||||
|
||||
const updates = {} as Partial<User>;
|
||||
|
||||
if (!toUrl) toUrl = '';
|
||||
updates.movedToUri = toUrl;
|
||||
|
||||
await Users.update(user.id, updates);
|
||||
const iObj = await Users.pack<true, true>(user.id, user, {
|
||||
detail: true,
|
||||
includeSecrets: true,
|
||||
});
|
||||
|
||||
const moveAct = moveActivity(toUrl, fromUrl);
|
||||
const dm = new DeliverManager(user, moveAct);
|
||||
dm.addFollowersRecipe();
|
||||
dm.execute();
|
||||
|
||||
// Publish meUpdated event
|
||||
publishMainStream(user.id, 'meUpdated', iObj);
|
||||
|
||||
const followings = await Followings.findBy({
|
||||
followeeId: user.id,
|
||||
});
|
||||
|
||||
followings.forEach(async following => {
|
||||
//if follower is local
|
||||
if (!following.followerHost) {
|
||||
const follower = await getUser(following.followerId).catch(e => {
|
||||
if (e.id === '15348ddd-432d-49c2-8a5a-8069753becff') throw new ApiError(meta.errors.noSuchUser);
|
||||
throw e;
|
||||
});
|
||||
await deleteFollowing(follower!, user);
|
||||
try {
|
||||
await create(follower!, moveTo);
|
||||
} catch (e) { /* empty */ }
|
||||
}
|
||||
});
|
||||
|
||||
return iObj;
|
||||
});
|
|
@ -1,5 +1,5 @@
|
|||
import define from '../../define.js';
|
||||
import { PageLikes } from '@/models/index.js';
|
||||
import define from '../../define.js';
|
||||
import { makePaginationQuery } from '../../common/make-pagination-query.js';
|
||||
|
||||
export const meta = {
|
||||
|
@ -26,7 +26,7 @@ export const meta = {
|
|||
ref: 'Page',
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
|
@ -43,7 +43,7 @@ export const paramDef = {
|
|||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
const query = makePaginationQuery(PageLikes.createQueryBuilder('like'), ps.sinceId, ps.untilId)
|
||||
.andWhere(`like.userId = :meId`, { meId: user.id })
|
||||
.andWhere('like.userId = :meId', { meId: user.id })
|
||||
.leftJoinAndSelect('like.page', 'page');
|
||||
|
||||
const likes = await query
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import define from '../../define.js';
|
||||
import { Pages } from '@/models/index.js';
|
||||
import define from '../../define.js';
|
||||
import { makePaginationQuery } from '../../common/make-pagination-query.js';
|
||||
|
||||
export const meta = {
|
||||
|
@ -33,7 +33,7 @@ export const paramDef = {
|
|||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
const query = makePaginationQuery(Pages.createQueryBuilder('page'), ps.sinceId, ps.untilId)
|
||||
.andWhere(`page.userId = :meId`, { meId: user.id });
|
||||
.andWhere('page.userId = :meId', { meId: user.id });
|
||||
|
||||
const pages = await query
|
||||
.take(ps.limit)
|
||||
|
|
|
@ -78,6 +78,12 @@ export const meta = {
|
|||
code: 'YOU_HAVE_BEEN_BLOCKED',
|
||||
id: 'b390d7e1-8a5e-46ed-b625-06271cafd3d3',
|
||||
},
|
||||
|
||||
accountLocked: {
|
||||
message: 'You migrated. Your account is now locked.',
|
||||
code: 'ACCOUNT_LOCKED',
|
||||
id: 'd390d7e1-8a5e-46ed-b625-06271cafd3d3',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
|
@ -163,6 +169,7 @@ export const paramDef = {
|
|||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
if(user.movedToUri != null) throw new ApiError(meta.errors.accountLocked);
|
||||
let visibleUsers: User[] = [];
|
||||
if (ps.visibleUserIds) {
|
||||
visibleUsers = await Users.findBy({
|
||||
|
@ -250,7 +257,7 @@ export default define(meta, paramDef, async (ps, user) => {
|
|||
}
|
||||
}
|
||||
|
||||
// 投稿を作成
|
||||
// Create a post
|
||||
const note = await create(user, {
|
||||
createdAt: new Date(),
|
||||
files: files,
|
||||
|
|
|
@ -28,6 +28,11 @@ export const meta = {
|
|||
code: 'YOU_HAVE_BEEN_BLOCKED',
|
||||
id: '20ef5475-9f38-4e4c-bd33-de6d979498ec',
|
||||
},
|
||||
accountLocked: {
|
||||
message: 'You migrated. Your account is now locked.',
|
||||
code: 'ACCOUNT_LOCKED',
|
||||
id: 'd390d7e1-8a5e-46ed-b625-06271cafd3d3',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
|
@ -42,6 +47,7 @@ export const paramDef = {
|
|||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
if(user.movedToUri != null) throw new ApiError(meta.errors.accountLocked);
|
||||
const note = await getNote(ps.noteId, user).catch(err => {
|
||||
if (err.id === '9725d0ce-ba28-4dde-95a7-2cbb2c15de24') throw new ApiError(meta.errors.noSuchNote);
|
||||
throw err;
|
||||
|
|
|
@ -0,0 +1,36 @@
|
|||
import { UserLists } from '@/models/index.js';
|
||||
import define from '../../../define.js';
|
||||
import { ApiError } from '../../../error.js';
|
||||
|
||||
export const meta = {
|
||||
tags: ['lists'],
|
||||
|
||||
requireCredential: true,
|
||||
|
||||
kind: 'write:account',
|
||||
|
||||
description: 'Delete all lists of users.',
|
||||
|
||||
errors: {
|
||||
noSuchList: {
|
||||
message: 'No such list.',
|
||||
code: 'NO_SUCH_LIST',
|
||||
id: '78436795-db79-42f5-b1e2-55ea2cf19166',
|
||||
},
|
||||
},
|
||||
} as const;
|
||||
|
||||
export const paramDef = {
|
||||
type: 'object',
|
||||
} as const;
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default define(meta, paramDef, async (ps, user) => {
|
||||
while (await UserLists.findOneBy({ userId: user.id }) != null) {
|
||||
const userList = await UserLists.findOneBy({ userId: user.id });
|
||||
if (userList == null) {
|
||||
throw new ApiError(meta.errors.noSuchList);
|
||||
}
|
||||
await UserLists.delete(userList.id);
|
||||
}
|
||||
});
|
|
@ -19,7 +19,7 @@ import { genIdenticon } from '@/misc/gen-identicon.js';
|
|||
import { createTemp } from '@/misc/create-temp.js';
|
||||
import { publishMainStream } from '@/services/stream.js';
|
||||
import * as Acct from '@/misc/acct.js';
|
||||
import { envOption } from '../env.js';
|
||||
import { envOption } from '@/env.js';
|
||||
import activityPub from './activitypub.js';
|
||||
import nodeinfo from './nodeinfo.js';
|
||||
import wellKnown from './well-known.js';
|
||||
|
@ -164,5 +164,6 @@ export default () => new Promise(resolve => {
|
|||
}
|
||||
});
|
||||
|
||||
// @ts-ignore
|
||||
server.listen(config.port, resolve);
|
||||
});
|
||||
|
|
|
@ -11,11 +11,11 @@ const router = new Router();
|
|||
const nodeinfo2_1path = '/nodeinfo/2.1';
|
||||
const nodeinfo2_0path = '/nodeinfo/2.0';
|
||||
|
||||
export const links = [/* (awaiting release) {
|
||||
rel: 'http://nodeinfo.diaspora.software/ns/schema/2.1',
|
||||
export const links = [{
|
||||
rel: 'https://nodeinfo.diaspora.software/ns/schema/2.1',
|
||||
href: config.url + nodeinfo2_1path
|
||||
}, */{
|
||||
rel: 'http://nodeinfo.diaspora.software/ns/schema/2.0',
|
||||
}, {
|
||||
rel: 'https://nodeinfo.diaspora.software/ns/schema/2.0',
|
||||
href: config.url + nodeinfo2_0path,
|
||||
}];
|
||||
|
||||
|
@ -96,6 +96,7 @@ router.get(nodeinfo2_1path, async ctx => {
|
|||
router.get(nodeinfo2_0path, async ctx => {
|
||||
const base = await cache.fetch(null, () => nodeinfo2());
|
||||
|
||||
// @ts-ignore
|
||||
delete base.software.repository;
|
||||
|
||||
ctx.body = { version: '2.0', ...base };
|
||||
|
|
|
@ -22,37 +22,32 @@
|
|||
renderError('SOMETHING_HAPPENED_IN_PROMISE', e);
|
||||
};
|
||||
|
||||
const v = localStorage.getItem('v') || VERSION;
|
||||
|
||||
//#region Detect language & fetch translations
|
||||
const localeVersion = localStorage.getItem('localeVersion');
|
||||
const localeOutdated = (localeVersion == null || localeVersion !== v);
|
||||
|
||||
if (!localStorage.hasOwnProperty('locale') || localeOutdated) {
|
||||
const supportedLangs = LANGS;
|
||||
let lang = localStorage.getItem('lang');
|
||||
if (lang == null || !supportedLangs.includes(lang)) {
|
||||
if (supportedLangs.includes(navigator.language)) {
|
||||
lang = navigator.language;
|
||||
} else {
|
||||
lang = supportedLangs.find(x => x.split('-')[0] === navigator.language);
|
||||
|
||||
// Fallback
|
||||
if (lang == null) lang = 'en-US';
|
||||
}
|
||||
}
|
||||
|
||||
const res = await fetch(`/assets/locales/${lang}.${v}.json`);
|
||||
if (res.status === 200) {
|
||||
localStorage.setItem('lang', lang);
|
||||
localStorage.setItem('locale', await res.text());
|
||||
localStorage.setItem('localeVersion', v);
|
||||
const v = localStorage.getItem('v') || VERSION;
|
||||
|
||||
const supportedLangs = LANGS;
|
||||
let lang = localStorage.getItem('lang');
|
||||
if (lang == null || !supportedLangs.includes(lang)) {
|
||||
if (supportedLangs.includes(navigator.language)) {
|
||||
lang = navigator.language;
|
||||
} else {
|
||||
await checkUpdate();
|
||||
renderError('LOCALE_FETCH');
|
||||
return;
|
||||
lang = supportedLangs.find(x => x.split('-')[0] === navigator.language);
|
||||
|
||||
// Fallback
|
||||
if (lang == null) lang = 'en-US';
|
||||
}
|
||||
}
|
||||
|
||||
const res = await fetch(`/assets/locales/${lang}.${v}.json`);
|
||||
if (res.status === 200) {
|
||||
localStorage.setItem('lang', lang);
|
||||
localStorage.setItem('locale', await res.text());
|
||||
localStorage.setItem('localeVersion', v);
|
||||
} else {
|
||||
await checkUpdate();
|
||||
renderError('LOCALE_FETCH');
|
||||
return;
|
||||
}
|
||||
//#endregion
|
||||
|
||||
//#region Script
|
||||
|
|
|
@ -127,8 +127,8 @@ type Option = {
|
|||
};
|
||||
|
||||
export default async (user: { id: User['id']; username: User['username']; host: User['host']; isSilenced: User['isSilenced']; createdAt: User['createdAt']; }, data: Option, silent = false) => new Promise<Note>(async (res, rej) => {
|
||||
// チャンネル外にリプライしたら対象のスコープに合わせる
|
||||
// (クライアントサイドでやっても良い処理だと思うけどとりあえずサーバーサイドで)
|
||||
// If you reply outside the channel, match the scope of the target.
|
||||
// TODO (I think it's a process that could be done on the client side, but it's server side for now.)
|
||||
if (data.reply && data.channel && data.reply.channelId !== data.channel.id) {
|
||||
if (data.reply.channelId) {
|
||||
data.channel = await Channels.findOneBy({ id: data.reply.channelId });
|
||||
|
@ -137,8 +137,8 @@ export default async (user: { id: User['id']; username: User['username']; host:
|
|||
}
|
||||
}
|
||||
|
||||
// チャンネル内にリプライしたら対象のスコープに合わせる
|
||||
// (クライアントサイドでやっても良い処理だと思うけどとりあえずサーバーサイドで)
|
||||
// When you reply in a channel, match the scope of the target
|
||||
// TODO (I think it's a process that could be done on the client side, but it's server side for now.)
|
||||
if (data.reply && (data.channel == null) && data.reply.channelId) {
|
||||
data.channel = await Channels.findOneBy({ id: data.reply.channelId });
|
||||
}
|
||||
|
@ -150,37 +150,37 @@ export default async (user: { id: User['id']; username: User['username']; host:
|
|||
if (data.channel != null) data.visibleUsers = [];
|
||||
if (data.channel != null) data.localOnly = true;
|
||||
|
||||
// サイレンス
|
||||
// enforce silent clients on server
|
||||
if (user.isSilenced && data.visibility === 'public' && data.channel == null) {
|
||||
data.visibility = 'home';
|
||||
}
|
||||
|
||||
// Renote対象が「ホームまたは全体」以外の公開範囲ならreject
|
||||
// Reject if the target of the renote is a public range other than "Home or Entire".
|
||||
if (data.renote && data.renote.visibility !== 'public' && data.renote.visibility !== 'home' && data.renote.userId !== user.id) {
|
||||
return rej('Renote target is not public or home');
|
||||
}
|
||||
|
||||
// Renote対象がpublicではないならhomeにする
|
||||
// If the target of the renote is not public, make it home.
|
||||
if (data.renote && data.renote.visibility !== 'public' && data.visibility === 'public') {
|
||||
data.visibility = 'home';
|
||||
}
|
||||
|
||||
// Renote対象がfollowersならfollowersにする
|
||||
// If the target of Renote is followers, make it followers.
|
||||
if (data.renote && data.renote.visibility === 'followers') {
|
||||
data.visibility = 'followers';
|
||||
}
|
||||
|
||||
// 返信対象がpublicではないならhomeにする
|
||||
// If the reply target is not public, make it home.
|
||||
if (data.reply && data.reply.visibility !== 'public' && data.visibility === 'public') {
|
||||
data.visibility = 'home';
|
||||
}
|
||||
|
||||
// ローカルのみをRenoteしたらローカルのみにする
|
||||
// Renote local only if you Renote local only.
|
||||
if (data.renote && data.renote.localOnly && data.channel == null) {
|
||||
data.localOnly = true;
|
||||
}
|
||||
|
||||
// ローカルのみにリプライしたらローカルのみにする
|
||||
// If you reply to local only, make it local only.
|
||||
if (data.reply && data.reply.localOnly && data.channel == null) {
|
||||
data.localOnly = true;
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import * as childProcess from 'child_process';
|
|||
import * as http from 'node:http';
|
||||
import { SIGKILL } from 'constants';
|
||||
import WebSocket from 'ws';
|
||||
import * as misskey from 'misskey-js';
|
||||
import * as misskey from 'calckey-js';
|
||||
import fetch from 'node-fetch';
|
||||
import FormData from 'form-data';
|
||||
import { DataSource } from 'typeorm';
|
||||
|
|
|
@ -15,10 +15,11 @@
|
|||
"@vitejs/plugin-vue": "3.2.0",
|
||||
"@vue/compiler-sfc": "3.2.45",
|
||||
"autobind-decorator": "2.4.0",
|
||||
"autosize": "5.0.1",
|
||||
"autosize": "5.0.2",
|
||||
"blurhash": "1.1.5",
|
||||
"broadcast-channel": "4.18.1",
|
||||
"browser-image-resizer": "https://github.com/misskey-dev/browser-image-resizer.git#commit=0380d12c8e736788ea7f4e6e985175521ea7b23c",
|
||||
"calckey-js": "^0.0.17",
|
||||
"chart.js": "4.0.1",
|
||||
"chartjs-adapter-date-fns": "2.0.1",
|
||||
"chartjs-plugin-gradient": "0.5.1",
|
||||
|
@ -34,7 +35,6 @@
|
|||
"katex": "0.16.3",
|
||||
"matter-js": "0.18.0",
|
||||
"mfm-js": "0.23.0",
|
||||
"misskey-js": "0.0.14",
|
||||
"photoswipe": "5.3.3",
|
||||
"prismjs": "1.29.0",
|
||||
"punycode": "2.1.1",
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { defineAsyncComponent, reactive } from 'vue';
|
||||
import * as misskey from 'misskey-js';
|
||||
import * as misskey from 'calckey-js';
|
||||
import { showSuspendedDialog } from './scripts/show-suspended-dialog';
|
||||
import { i18n } from './i18n';
|
||||
import { del, get, set } from '@/scripts/idb-proxy';
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
<script setup lang="ts">
|
||||
import { ref } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import * as Misskey from 'calckey-js';
|
||||
import XWindow from '@/components/MkWindow.vue';
|
||||
import MkTextarea from '@/components/form/textarea.vue';
|
||||
import MkButton from '@/components/MkButton.vue';
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import * as Acct from 'misskey-js/built/acct';
|
||||
import * as Acct from 'calckey-js/built/acct';
|
||||
import { i18n } from '@/i18n';
|
||||
import { acct } from '@/filters/user';
|
||||
import { $i } from '@/account';
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { nextTick, onMounted } from 'vue';
|
||||
import * as misskey from 'misskey-js';
|
||||
import * as misskey from 'calckey-js';
|
||||
import Cropper from 'cropperjs';
|
||||
import tinycolor from 'tinycolor2';
|
||||
import XModalWindow from '@/components/MkModalWindow.vue';
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
<script lang="ts" setup>
|
||||
import { computed } from 'vue';
|
||||
import { length } from 'stringz';
|
||||
import * as misskey from 'misskey-js';
|
||||
import * as misskey from 'calckey-js';
|
||||
import { concat } from '@/scripts/array';
|
||||
import { i18n } from '@/i18n';
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { computed, defineAsyncComponent, ref } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import * as Misskey from 'calckey-js';
|
||||
import copyToClipboard from '@/scripts/copy-to-clipboard';
|
||||
import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue';
|
||||
import bytes from '@/filters/bytes';
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { computed, defineAsyncComponent, ref } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import * as Misskey from 'calckey-js';
|
||||
import * as os from '@/os';
|
||||
import { i18n } from '@/i18n';
|
||||
import { defaultStore } from '@/store';
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import * as Misskey from 'calckey-js';
|
||||
import * as os from '@/os';
|
||||
import { i18n } from '@/i18n';
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { markRaw, nextTick, onActivated, onBeforeUnmount, onMounted, ref, watch } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import * as Misskey from 'calckey-js';
|
||||
import MkButton from './MkButton.vue';
|
||||
import XNavFolder from '@/components/MkDrive.navFolder.vue';
|
||||
import XFolder from '@/components/MkDrive.folder.vue';
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue';
|
||||
import type * as Misskey from 'misskey-js';
|
||||
import type * as Misskey from 'calckey-js';
|
||||
import ImgWithBlurhash from '@/components/MkImgWithBlurhash.vue';
|
||||
|
||||
const props = defineProps<{
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import * as Misskey from 'calckey-js';
|
||||
import XDrive from '@/components/MkDrive.vue';
|
||||
import XModalWindow from '@/components/MkModalWindow.vue';
|
||||
import number from '@/filters/number';
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import * as Misskey from 'calckey-js';
|
||||
import XDrive from '@/components/MkDrive.vue';
|
||||
import XWindow from '@/components/MkWindow.vue';
|
||||
import { i18n } from '@/i18n';
|
||||
|
|
|
@ -79,7 +79,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { ref, computed, watch, onMounted } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import * as Misskey from 'calckey-js';
|
||||
import XSection from '@/components/MkEmojiPicker.section.vue';
|
||||
import { emojilist, UnicodeEmojiDef, unicodeEmojiCategories as categories } from '@/scripts/emojilist';
|
||||
import { getStaticImageUrl } from '@/scripts/get-static-image-url';
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import * as Misskey from 'misskey-js';
|
||||
import * as Misskey from 'calckey-js';
|
||||
import * as os from '@/os';
|
||||
|
||||
const meta = ref<Misskey.entities.DetailedInstanceMetadata>();
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { computed } from 'vue';
|
||||
import * as Acct from 'misskey-js/built/acct';
|
||||
import * as Acct from 'calckey-js/built/acct';
|
||||
import MkSwitch from '@/components/ui/switch.vue';
|
||||
import MkPagination from '@/components/MkPagination.vue';
|
||||
import MkDriveFileThumbnail from '@/components/MkDriveFileThumbnail.vue';
|
||||
|
|
|
@ -8,7 +8,8 @@
|
|||
<template v-else><i class="ph-caret-down-bold ph-lg"></i></template>
|
||||
</button>
|
||||
</header>
|
||||
<transition :name="$store.state.animation ? 'folder-toggle' : ''"
|
||||
<transition
|
||||
:name="$store.state.animation ? 'folder-toggle' : ''"
|
||||
@enter="enter"
|
||||
@after-enter="afterEnter"
|
||||
@leave="leave"
|
||||
|
@ -27,17 +28,18 @@ import tinycolor from 'tinycolor2';
|
|||
|
||||
const localStoragePrefix = 'ui:folder:';
|
||||
|
||||
// eslint-disable-next-line import/no-default-export
|
||||
export default defineComponent({
|
||||
props: {
|
||||
expanded: {
|
||||
type: Boolean,
|
||||
required: false,
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
persistKey: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: null
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
|
@ -51,7 +53,7 @@ export default defineComponent({
|
|||
if (this.persistKey) {
|
||||
localStorage.setItem(localStoragePrefix + this.persistKey, this.showBody ? 't' : 'f');
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
function getParentBg(el: Element | null): string {
|
||||
|
@ -91,7 +93,7 @@ export default defineComponent({
|
|||
afterLeave(el) {
|
||||
el.style.height = null;
|
||||
},
|
||||
}
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { onBeforeUnmount, onMounted } from 'vue';
|
||||
import type * as Misskey from 'misskey-js';
|
||||
import type * as Misskey from 'calckey-js';
|
||||
import * as os from '@/os';
|
||||
import { stream } from '@/stream';
|
||||
import { i18n } from '@/i18n';
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { } from 'vue';
|
||||
import * as misskey from 'misskey-js';
|
||||
import * as misskey from 'calckey-js';
|
||||
import bytes from '@/filters/bytes';
|
||||
import number from '@/filters/number';
|
||||
import MkModal from '@/components/MkModal.vue';
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<script lang="ts" setup>
|
||||
import { } from 'vue';
|
||||
|
||||
const props = defineProps<{
|
||||
defineProps<{
|
||||
warn?: boolean;
|
||||
}>();
|
||||
</script>
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import * as misskey from 'misskey-js';
|
||||
import * as misskey from 'calckey-js';
|
||||
import MkMiniChart from '@/components/MkMiniChart.vue';
|
||||
import * as os from '@/os';
|
||||
|
||||
|
|
|
@ -46,7 +46,7 @@
|
|||
<script lang="ts" setup>
|
||||
import { onMounted } from 'vue';
|
||||
import VuePlyr from 'vue-plyr';
|
||||
import type * as misskey from 'misskey-js';
|
||||
import type * as misskey from 'calckey-js';
|
||||
import { ColdDeviceStorage } from '@/store';
|
||||
import 'vue-plyr/dist/vue-plyr.css';
|
||||
import { i18n } from '@/i18n';
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { watch } from 'vue';
|
||||
import * as misskey from 'misskey-js';
|
||||
import * as misskey from 'calckey-js';
|
||||
import { getStaticImageUrl } from '@/scripts/get-static-image-url';
|
||||
import ImgWithBlurhash from '@/components/MkImgWithBlurhash.vue';
|
||||
import { defaultStore } from '@/store';
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { onMounted, ref } from 'vue';
|
||||
import * as misskey from 'misskey-js';
|
||||
import * as misskey from 'calckey-js';
|
||||
import PhotoSwipeLightbox from 'photoswipe/lightbox';
|
||||
import PhotoSwipe from 'photoswipe';
|
||||
import 'photoswipe/style.css';
|
||||
|
@ -46,7 +46,7 @@ onMounted(() => {
|
|||
src: media.url,
|
||||
w: media.properties.width,
|
||||
h: media.properties.height,
|
||||
alt: media.name,
|
||||
alt: media.comment,
|
||||
};
|
||||
if (media.properties.orientation != null && media.properties.orientation >= 5) {
|
||||
[item.w, item.h] = [item.h, item.w];
|
||||
|
@ -89,9 +89,38 @@ onMounted(() => {
|
|||
[itemData.w, itemData.h] = [itemData.h, itemData.w];
|
||||
}
|
||||
itemData.msrc = file.thumbnailUrl;
|
||||
itemData.alt = file.comment;
|
||||
itemData.thumbCropped = true;
|
||||
});
|
||||
|
||||
lightbox.on('uiRegister', () => {
|
||||
lightbox.pswp.ui.registerElement({
|
||||
name: 'altText',
|
||||
className: 'pwsp__alt-text-container',
|
||||
appendTo: 'wrapper',
|
||||
onInit: (el, pwsp) => {
|
||||
let textBox = document.createElement('p');
|
||||
textBox.className = 'pwsp__alt-text';
|
||||
el.appendChild(textBox);
|
||||
|
||||
let preventProp = function(ev: Event): void {
|
||||
ev.stopPropagation();
|
||||
};
|
||||
|
||||
// Allow scrolling/text selection
|
||||
el.onwheel = preventProp;
|
||||
el.onclick = preventProp;
|
||||
el.onpointerdown = preventProp;
|
||||
el.onpointercancel = preventProp;
|
||||
el.onpointermove = preventProp;
|
||||
|
||||
pwsp.on('change', () => {
|
||||
textBox.textContent = pwsp.currSlide.data.alt?.trim();
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
lightbox.init();
|
||||
});
|
||||
|
||||
|
@ -193,4 +222,35 @@ const previewable = (file: misskey.entities.DriveFile): boolean => {
|
|||
//z-index: v-bind(pswpZIndex);
|
||||
z-index: 2000000;
|
||||
}
|
||||
.pwsp__alt-text-container {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
|
||||
position: absolute;
|
||||
bottom: 30px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
|
||||
width: 75%;
|
||||
}
|
||||
|
||||
.pwsp__alt-text {
|
||||
color: white;
|
||||
margin: 0 auto;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
background: rgba(0, 0, 0, 0.5);
|
||||
border-radius: 5px;
|
||||
|
||||
max-height: 10vh;
|
||||
overflow-x: clip;
|
||||
overflow-y: auto;
|
||||
overscroll-behavior: contain;
|
||||
}
|
||||
|
||||
.pwsp__alt-text:empty {
|
||||
display: none;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<script lang="ts" setup>
|
||||
import { ref } from 'vue';
|
||||
import VuePlyr from 'vue-plyr';
|
||||
import type * as misskey from 'misskey-js';
|
||||
import type * as misskey from 'calckey-js';
|
||||
import { defaultStore } from '@/store';
|
||||
import 'vue-plyr/dist/vue-plyr.css';
|
||||
import { i18n } from '@/i18n';
|
||||
|
|
30
packages/client/src/components/MkMoved.vue
Normal file
30
packages/client/src/components/MkMoved.vue
Normal file
|
@ -0,0 +1,30 @@
|
|||
<template>
|
||||
<div class="msjugskd _block">
|
||||
<i class="ph-airplane-takeoff-bold ph-lg" style="margin-right: 8px;"/>
|
||||
{{ i18n.ts.accountMoved }}
|
||||
<MkMention class="link" :username="acct" :host="host"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
import MkMention from './MkMention.vue';
|
||||
import { i18n } from '@/i18n';
|
||||
|
||||
defineProps<{
|
||||
acct: string;
|
||||
host: string;
|
||||
}>();
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.msjugskd {
|
||||
padding: 16px;
|
||||
background: var(--infoWarnBg);
|
||||
color: var(--error);
|
||||
|
||||
> .link {
|
||||
margin-left: 4px;
|
||||
color: var(--accent);
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -107,7 +107,7 @@
|
|||
import { computed, inject, onMounted, onUnmounted, reactive, ref } from 'vue';
|
||||
import * as mfm from 'mfm-js';
|
||||
import type { Ref } from 'vue';
|
||||
import type * as misskey from 'misskey-js';
|
||||
import type * as misskey from 'calckey-js';
|
||||
import MkNoteSub from '@/components/MkNoteSub.vue';
|
||||
import XNoteHeader from '@/components/MkNoteHeader.vue';
|
||||
import XNoteSimple from '@/components/MkNoteSimple.vue';
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
<script lang="ts" setup>
|
||||
import { computed, inject, onMounted, onUnmounted, reactive, ref } from 'vue';
|
||||
import * as mfm from 'mfm-js';
|
||||
import type * as misskey from 'misskey-js';
|
||||
import type * as misskey from 'calckey-js';
|
||||
import MkNoteSub from '@/components/MkNoteSub.vue';
|
||||
import XNoteSimple from '@/components/MkNoteSimple.vue';
|
||||
import XReactionsViewer from '@/components/MkReactionsViewer.vue';
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { } from 'vue';
|
||||
import * as misskey from 'misskey-js';
|
||||
import * as misskey from 'calckey-js';
|
||||
import MkVisibility from '@/components/MkVisibility.vue';
|
||||
import { notePage } from '@/filters/note';
|
||||
import { userPage } from '@/filters/user';
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { } from 'vue';
|
||||
import * as misskey from 'misskey-js';
|
||||
import * as misskey from 'calckey-js';
|
||||
import XNoteHeader from '@/components/MkNoteHeader.vue';
|
||||
import MkSubNoteContent from '@/components/MkSubNoteContent.vue';
|
||||
import XCwButton from '@/components/MkCwButton.vue';
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { } from 'vue';
|
||||
import * as misskey from 'misskey-js';
|
||||
import * as misskey from 'calckey-js';
|
||||
import XNoteHeader from '@/components/MkNoteHeader.vue';
|
||||
import MkSubNoteContent from '@/components/MkSubNoteContent.vue';
|
||||
import XCwButton from '@/components/MkCwButton.vue';
|
||||
|
|
|
@ -74,7 +74,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { ref, onMounted, onUnmounted, watch } from 'vue';
|
||||
import * as misskey from 'misskey-js';
|
||||
import * as misskey from 'calckey-js';
|
||||
import XReactionIcon from '@/components/MkReactionIcon.vue';
|
||||
import MkFollowButton from '@/components/MkFollowButton.vue';
|
||||
import XReactionTooltip from '@/components/MkReactionTooltip.vue';
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
<script lang="ts" setup>
|
||||
import { } from 'vue';
|
||||
import { notificationTypes } from 'misskey-js';
|
||||
import { notificationTypes } from 'calckey-js';
|
||||
import MkSwitch from './form/switch.vue';
|
||||
import MkInfo from './MkInfo.vue';
|
||||
import MkButton from './MkButton.vue';
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue