mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-26 01:43:09 +02:00
Compare commits
5 commits
aabf168d05
...
990e53fee4
Author | SHA1 | Date | |
---|---|---|---|
|
990e53fee4 | ||
|
ea44895b6b | ||
|
2e0557c90c | ||
|
6516370251 | ||
|
132bf2d200 |
21 changed files with 315 additions and 270 deletions
|
@ -1,58 +0,0 @@
|
|||
name: Publish Docker image (develop)
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
paths:
|
||||
- packages/**
|
||||
- locales/**
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: git.joinsharkey.org
|
||||
|
||||
jobs:
|
||||
push_to_registry:
|
||||
name: Push Docker image to GHCR
|
||||
runs-on: docker
|
||||
steps:
|
||||
- name: install packages
|
||||
run: apt-get update && apt-get install -y wget git curl
|
||||
- uses: https://code.forgejo.org/actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Install docker
|
||||
run: |
|
||||
echo deb http://deb.debian.org/debian bullseye-backports main | tee /etc/apt/sources.list.d/backports.list && apt-get -qq update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -qq -y -t bullseye-backports docker.io
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v4.1.1
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: https://github.com/docker/setup-buildx-action@v3.0.0
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: https://github.com/docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/sharkey/sharkey
|
||||
- name: Log in to GHCR
|
||||
uses: https://github.com/docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: Marie
|
||||
password: ${{ secrets.TOKEN }}
|
||||
- name: Build and Push to GHCR
|
||||
id: build
|
||||
uses: https://github.com/docker/build-push-action@v5
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
context: .
|
||||
push: true
|
||||
platforms: ${{ steps.buildx.outputs.platforms }}
|
||||
provenance: false
|
||||
tags: ${{ env.REGISTRY }}/sharkey/sharkey:develop
|
||||
labels: develop
|
||||
build-args: NODE_ENV=development
|
|
@ -1,61 +0,0 @@
|
|||
name: Publish Docker image
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
workflow_dispatch:
|
||||
|
||||
env:
|
||||
REGISTRY: git.joinsharkey.org
|
||||
|
||||
jobs:
|
||||
push_to_registry:
|
||||
name: Push Docker image to GHCR
|
||||
runs-on: docker
|
||||
|
||||
steps:
|
||||
- name: install packages
|
||||
run: apt-get update && apt-get install -y wget git curl
|
||||
- uses: https://code.forgejo.org/actions/setup-node@v3
|
||||
with:
|
||||
node-version: 20
|
||||
- name: Install docker
|
||||
run: |
|
||||
echo deb http://deb.debian.org/debian bullseye-backports main | tee /etc/apt/sources.list.d/backports.list && apt-get -qq update
|
||||
DEBIAN_FRONTEND=noninteractive apt-get install --no-install-recommends -qq -y -t bullseye-backports docker.io
|
||||
- name: Check out the repo
|
||||
uses: actions/checkout@v4.1.1
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: https://github.com/docker/setup-buildx-action@v3.0.0
|
||||
with:
|
||||
platforms: linux/amd64,linux/arm64
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: https://github.com/docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/sharkey/sharkey
|
||||
tags: |
|
||||
type=edge
|
||||
type=ref,event=pr
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=raw,value=stable
|
||||
- name: Log in to GHCR
|
||||
uses: https://github.com/docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: Marie
|
||||
password: ${{ secrets.TOKEN }}
|
||||
- name: Build and Push to GHCR
|
||||
id: build
|
||||
uses: https://github.com/docker/build-push-action@v5
|
||||
with:
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
context: .
|
||||
push: true
|
||||
platforms: ${{ steps.buildx.outputs.platforms }}
|
||||
provenance: false
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
|
@ -1,97 +0,0 @@
|
|||
name: 🐛 Bug Report
|
||||
description: Create a report to help us improve
|
||||
title: 'bug: '
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: |
|
||||
Thanks for reporting!
|
||||
First, in order to avoid duplicate Issues, please search to see if the problem you found has already been reported.
|
||||
Also, If you are NOT owner/admin of server, PLEASE DONT REPORT SERVER SPECIFIC ISSUES TO HERE! (e.g. feature XXX is not working in misskey.example) Please try with another misskey servers, and if your issue is only reproducible with specific server, contact your server's owner/admin first.
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: 💡 Summary
|
||||
description: Tell us what the bug is
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: 🥰 Expected Behavior
|
||||
description: Tell us what should happen
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: 🤬 Actual Behavior
|
||||
description: |
|
||||
Tell us what happens instead of the expected behavior.
|
||||
Please include errors from the developer console and/or server log files if you have access to them.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: 📝 Steps to Reproduce
|
||||
placeholder: |
|
||||
1.
|
||||
2.
|
||||
3.
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: 💻 Frontend Environment
|
||||
description: |
|
||||
Tell us where on the platform it happens
|
||||
DO NOT WRITE "latest". Please provide the specific version.
|
||||
|
||||
Examples:
|
||||
* Model and OS of the device(s): MacBook Pro (14inch, 2021), macOS Ventura 13.4
|
||||
* Browser: Chrome 113.0.5672.126
|
||||
* Server URL: misskey.io
|
||||
* Misskey: 13.x.x
|
||||
value: |
|
||||
* Model and OS of the device(s):
|
||||
* Browser:
|
||||
* Server URL:
|
||||
* Misskey:
|
||||
render: markdown
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: 🛰 Backend Environment (for server admin)
|
||||
description: |
|
||||
Tell us where on the platform it happens
|
||||
DO NOT WRITE "latest". Please provide the specific version.
|
||||
If you are using a managed service, put that after the version.
|
||||
|
||||
Examples:
|
||||
* Installation Method or Hosting Service: docker compose, k8s/docker, systemd, "Misskey install shell script", development environment
|
||||
* Misskey: 13.x.x
|
||||
* Node: 20.x.x
|
||||
* PostgreSQL: 15.x.x
|
||||
* Redis: 7.x.x
|
||||
* OS and Architecture: Ubuntu 22.04.2 LTS aarch64
|
||||
value: |
|
||||
* Installation Method or Hosting Service:
|
||||
* Misskey:
|
||||
* Node:
|
||||
* PostgreSQL:
|
||||
* Redis:
|
||||
* OS and Architecture:
|
||||
render: markdown
|
||||
validations:
|
||||
required: false
|
||||
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Do you want to address this bug yourself?
|
||||
options:
|
||||
- label: Yes, I will patch the bug myself and send a pull request
|
|
@ -1,22 +0,0 @@
|
|||
name: ✨ Feature Request
|
||||
description: Suggest an idea for this project
|
||||
title: 'feat: '
|
||||
|
||||
body:
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Summary
|
||||
description: Tell us what the suggestion is
|
||||
validations:
|
||||
required: true
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Purpose
|
||||
description: Describe the specific problem or need you think this feature will solve, and who it will help.
|
||||
validations:
|
||||
required: true
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
label: Do you want to implement this feature yourself?
|
||||
options:
|
||||
- label: Yes, I will implement this by myself and send a pull request
|
|
@ -1,4 +0,0 @@
|
|||
contact_links:
|
||||
- name: 💬 Transfem.org Discord
|
||||
url: https://discord.gg/HJcAanTR6H
|
||||
about: Chat freely about Sharkey
|
|
@ -1,24 +0,0 @@
|
|||
<!-- ℹ お読みください / README
|
||||
PRありがとうございます! PRを作成する前に、コントリビューションガイドをご確認ください:
|
||||
Thank you for your PR! Before creating a PR, please check the contribution guide:
|
||||
https://github.com/misskey-dev/misskey/blob/develop/CONTRIBUTING.md
|
||||
-->
|
||||
|
||||
## What
|
||||
<!-- このPRで何をしたのか? どう変わるのか? -->
|
||||
<!-- What did you do with this PR? How will it change things? -->
|
||||
|
||||
## Why
|
||||
<!-- なぜそうするのか? どういう意図なのか? 何が困っているのか? -->
|
||||
<!-- Why do you do it? What are your intentions? What is the problem? -->
|
||||
|
||||
## Additional info (optional)
|
||||
<!-- テスト観点など -->
|
||||
<!-- Test perspective, etc -->
|
||||
|
||||
## Checklist
|
||||
- [ ] Read the [contribution guide](https://github.com/misskey-dev/misskey/blob/develop/CONTRIBUTING.md)
|
||||
- [ ] Test working in a local environment
|
||||
- [ ] (If needed) Add story of storybook
|
||||
- [ ] (If needed) Update CHANGELOG.md
|
||||
- [ ] (If possible) Add tests
|
|
@ -55,7 +55,6 @@ getImageTag:
|
|||
only:
|
||||
- stable
|
||||
- develop
|
||||
- tags
|
||||
buildDocker:
|
||||
stage: deploy
|
||||
needs:
|
||||
|
@ -79,7 +78,6 @@ buildDocker:
|
|||
only:
|
||||
- stable
|
||||
- develop
|
||||
- tags
|
||||
mergeManifests:
|
||||
stage: deploy
|
||||
needs:
|
||||
|
@ -105,4 +103,3 @@ mergeManifests:
|
|||
only:
|
||||
- stable
|
||||
- develop
|
||||
- tags
|
||||
|
|
29
.gitlab/issue_templates/bug.md
Normal file
29
.gitlab/issue_templates/bug.md
Normal file
|
@ -0,0 +1,29 @@
|
|||
<!-- 💖 Thanks for taking the time to fill out this bug report!
|
||||
💁 Having trouble with deployment? [Ask the support chat.](https://discord.gg/4qUhaeeHmm)
|
||||
🔒 Found a security vulnerability? [Please disclose it responsibly.](https://activitypub.software/TransFem-org/Sharkey/-/blob/develop/SECURITY.md)
|
||||
🤝 By submitting this feature request, you agree to follow our [Contribution Guidelines.](https://activitypub.software/TransFem-org/Sharkey/-/blob/develop/CONTRIBUTING.md) -->
|
||||
|
||||
**What happened?** _(Please give us a brief description of what happened.)_
|
||||
|
||||
**What did you expect to happen?** _(Please give us a brief description of what you expected to happen.)_
|
||||
|
||||
**Version** _(What version of Sharkey is your instance running? You can find this by clicking your instance's logo at the top left and then clicking instance information.)_
|
||||
|
||||
**Instance** _(What instance of Sharkey are you using?)_
|
||||
|
||||
**What type of issue is this?** _(If this happens on your device and has to do with the user interface, it's client-side. If this happens on either with the API or the backend, or you got a server-side error in the client, it's server-side.)_
|
||||
|
||||
**What browser are you using? (Client-side issues only)**
|
||||
|
||||
**What operating system are you using? (Client-side issues only)**
|
||||
|
||||
**How do you deploy Sharkey on your server? (Server-side issues only)**
|
||||
|
||||
**What operating system are you using? (Server-side issues only)**
|
||||
|
||||
**Relevant log output** _(Please copy and paste any relevant log output. You can find your log by inspecting the page, and going to the "console" tab. This will be automatically formatted into code, so no need for backticks.)_
|
||||
|
||||
**Contribution Guidelines**
|
||||
By submitting this issue, you agree to follow our [Contribution Guidelines](https://activitypub.software/TransFem-org/Sharkey/-/blob/develop/CONTRIBUTING.md)
|
||||
- [ ] I agree to follow this project's Contribution Guidelines
|
||||
- [ ] I have searched the issue tracker for similar issues, and this is not a duplicate.
|
17
.gitlab/issue_templates/feature.md
Normal file
17
.gitlab/issue_templates/feature.md
Normal file
|
@ -0,0 +1,17 @@
|
|||
<!-- 💖 Thanks for taking the time to fill out this bug report!
|
||||
💁 Having trouble with deployment? [Ask the support chat.](https://discord.gg/4qUhaeeHmm)
|
||||
🔒 Found a security vulnerability? [Please disclose it responsibly.](https://activitypub.software/TransFem-org/Sharkey/-/blob/develop/SECURITY.md)
|
||||
🤝 By submitting this feature request, you agree to follow our [Contribution Guidelines.](https://activitypub.software/TransFem-org/Sharkey/-/blob/develop/CONTRIBUTING.md) -->
|
||||
|
||||
**What feature would you like implemented?** _(Please give us a brief description of what you'd like.)_
|
||||
|
||||
**Why should we add this feature?** _(Please give us a brief description of why your feature is important.)_
|
||||
|
||||
**Version** _(What version of Sharkey is your instance running? You can find this by clicking your instance's logo at the top left and then clicking instance information.)_
|
||||
|
||||
**Instance** _(What instance of Sharkey are you using?)_
|
||||
|
||||
**Contribution Guidelines**
|
||||
By submitting this issue, you agree to follow our [Contribution Guidelines](https://activitypub.software/TransFem-org/Sharkey/-/blob/develop/CONTRIBUTING.md)
|
||||
- [ ] I agree to follow this project's Contribution Guidelines
|
||||
- [ ] I have searched the issue tracker for similar requests, and this is not a duplicate.
|
11
.gitlab/merge_request_templates/default.md
Normal file
11
.gitlab/merge_request_templates/default.md
Normal file
|
@ -0,0 +1,11 @@
|
|||
<!-- Thanks for taking the time to make Sharkey better! -->
|
||||
|
||||
**What does this PR do?** _(Please give us a brief description of what this PR does.)_
|
||||
|
||||
**Contribution Guidelines**
|
||||
By submitting this merge request, you agree to follow our [Contribution Guidelines](https://activitypub.software/TransFem-org/Sharkey/-/blob/develop/CONTRIBUTING.md)
|
||||
- [ ] I agree to follow this project's Contribution Guidelines
|
||||
- [ ] I have made sure to test this pull request
|
||||
|
||||
<!-- Uncomment if your merge request has multiple authors -->
|
||||
<!-- Co-authored-by: Name <email@email.com> -->
|
|
@ -4,6 +4,6 @@ If you discover a security issue in Sharkey, please report it by sending an
|
|||
email to [admin@transfem.org](mailto:admin@transfem.org).
|
||||
|
||||
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 GitLab repository.
|
||||
|
||||
Thanks for helping make Sharkey safe for everyone.
|
||||
|
|
|
@ -1095,6 +1095,7 @@ accountMoved: "This user has moved to a new account:"
|
|||
accountMovedShort: "This account has been migrated."
|
||||
operationForbidden: "Operation forbidden"
|
||||
forceShowAds: "Always show ads"
|
||||
oneko: "Cat friend :3"
|
||||
addMemo: "Add memo"
|
||||
editMemo: "Edit memo"
|
||||
reactionsList: "Reactions"
|
||||
|
|
4
locales/index.d.ts
vendored
4
locales/index.d.ts
vendored
|
@ -4425,6 +4425,10 @@ export interface Locale extends ILocale {
|
|||
* 常に広告を表示する
|
||||
*/
|
||||
"forceShowAds": string;
|
||||
/**
|
||||
* 猫友達 :3
|
||||
*/
|
||||
"oneko": string;
|
||||
/**
|
||||
* メモを追加
|
||||
*/
|
||||
|
|
|
@ -1102,6 +1102,7 @@ accountMoved: "このユーザーは新しいアカウントに移行しまし
|
|||
accountMovedShort: "このアカウントは移行されています"
|
||||
operationForbidden: "この操作はできません"
|
||||
forceShowAds: "常に広告を表示する"
|
||||
oneko: "猫友達 :3"
|
||||
addMemo: "メモを追加"
|
||||
editMemo: "メモを編集"
|
||||
reactionsList: "リアクション一覧"
|
||||
|
|
BIN
packages/frontend/assets/oneko.gif
Normal file
BIN
packages/frontend/assets/oneko.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 3.2 KiB |
240
packages/frontend/src/components/SkOneko.vue
Normal file
240
packages/frontend/src/components/SkOneko.vue
Normal file
|
@ -0,0 +1,240 @@
|
|||
<template>
|
||||
<div ref="nekoEl" :class="$style.oneko" aria-hidden="true"></div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
// oneko.js: https://github.com/adryd325/oneko.js
|
||||
// modified to be a vue component by ShittyKopper :3
|
||||
|
||||
import { shallowRef, onMounted } from 'vue';
|
||||
|
||||
const nekoEl = shallowRef<HTMLDivElement>();
|
||||
|
||||
let nekoPosX = 32;
|
||||
let nekoPosY = 32;
|
||||
|
||||
let mousePosX = 0;
|
||||
let mousePosY = 0;
|
||||
|
||||
let frameCount = 0;
|
||||
let idleTime = 0;
|
||||
let idleAnimation: string|null = null;
|
||||
let idleAnimationFrame = 0;
|
||||
let lastFrameTimestamp;
|
||||
|
||||
const nekoSpeed = 10;
|
||||
const spriteSets = {
|
||||
idle: [[-3, -3]],
|
||||
alert: [[-7, -3]],
|
||||
scratchSelf: [
|
||||
[-5, 0],
|
||||
[-6, 0],
|
||||
[-7, 0],
|
||||
],
|
||||
scratchWallN: [
|
||||
[0, 0],
|
||||
[0, -1],
|
||||
],
|
||||
scratchWallS: [
|
||||
[-7, -1],
|
||||
[-6, -2],
|
||||
],
|
||||
scratchWallE: [
|
||||
[-2, -2],
|
||||
[-2, -3],
|
||||
],
|
||||
scratchWallW: [
|
||||
[-4, 0],
|
||||
[-4, -1],
|
||||
],
|
||||
tired: [[-3, -2]],
|
||||
sleeping: [
|
||||
[-2, 0],
|
||||
[-2, -1],
|
||||
],
|
||||
N: [
|
||||
[-1, -2],
|
||||
[-1, -3],
|
||||
],
|
||||
NE: [
|
||||
[0, -2],
|
||||
[0, -3],
|
||||
],
|
||||
E: [
|
||||
[-3, 0],
|
||||
[-3, -1],
|
||||
],
|
||||
SE: [
|
||||
[-5, -1],
|
||||
[-5, -2],
|
||||
],
|
||||
S: [
|
||||
[-6, -3],
|
||||
[-7, -2],
|
||||
],
|
||||
SW: [
|
||||
[-5, -3],
|
||||
[-6, -1],
|
||||
],
|
||||
W: [
|
||||
[-4, -2],
|
||||
[-4, -3],
|
||||
],
|
||||
NW: [
|
||||
[-1, 0],
|
||||
[-1, -1],
|
||||
],
|
||||
};
|
||||
|
||||
function init() {
|
||||
if (!nekoEl.value) return;
|
||||
|
||||
nekoEl.value.style.left = `${nekoPosX - 16}px`;
|
||||
nekoEl.value.style.top = `${nekoPosY - 16}px`;
|
||||
|
||||
document.addEventListener('mousemove', (event) => {
|
||||
mousePosX = event.clientX;
|
||||
mousePosY = event.clientY;
|
||||
});
|
||||
|
||||
window.requestAnimationFrame(onAnimationFrame);
|
||||
}
|
||||
|
||||
function onAnimationFrame(timestamp) {
|
||||
// Stops execution if the neko element is removed from DOM
|
||||
if (!nekoEl.value?.isConnected) {
|
||||
return;
|
||||
}
|
||||
if (!lastFrameTimestamp) {
|
||||
lastFrameTimestamp = timestamp;
|
||||
}
|
||||
if (timestamp - lastFrameTimestamp > 100) {
|
||||
lastFrameTimestamp = timestamp;
|
||||
frame();
|
||||
}
|
||||
window.requestAnimationFrame(onAnimationFrame);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line no-shadow
|
||||
function setSprite(name, frame) {
|
||||
if (!nekoEl.value) return;
|
||||
|
||||
const sprite = spriteSets[name][frame % spriteSets[name].length];
|
||||
nekoEl.value.style.backgroundPosition = `${sprite[0] * 32}px ${sprite[1] * 32}px`;
|
||||
}
|
||||
|
||||
function resetIdleAnimation() {
|
||||
idleAnimation = null;
|
||||
idleAnimationFrame = 0;
|
||||
}
|
||||
|
||||
function idle() {
|
||||
idleTime += 1;
|
||||
|
||||
// every ~ 20 seconds
|
||||
if (
|
||||
idleTime > 10 &&
|
||||
Math.floor(Math.random() * 200) === 0 &&
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
idleAnimation == null
|
||||
) {
|
||||
let avalibleIdleAnimations = ['sleeping', 'scratchSelf'];
|
||||
if (nekoPosX < 32) {
|
||||
avalibleIdleAnimations.push('scratchWallW');
|
||||
}
|
||||
if (nekoPosY < 32) {
|
||||
avalibleIdleAnimations.push('scratchWallN');
|
||||
}
|
||||
if (nekoPosX > window.innerWidth - 32) {
|
||||
avalibleIdleAnimations.push('scratchWallE');
|
||||
}
|
||||
if (nekoPosY > window.innerHeight - 32) {
|
||||
avalibleIdleAnimations.push('scratchWallS');
|
||||
}
|
||||
idleAnimation =
|
||||
avalibleIdleAnimations[Math.floor(Math.random() * avalibleIdleAnimations.length)];
|
||||
}
|
||||
|
||||
switch (idleAnimation) {
|
||||
case 'sleeping':
|
||||
if (idleAnimationFrame < 8) {
|
||||
setSprite('tired', 0);
|
||||
break;
|
||||
}
|
||||
setSprite('sleeping', Math.floor(idleAnimationFrame / 4));
|
||||
if (idleAnimationFrame > 192) {
|
||||
resetIdleAnimation();
|
||||
}
|
||||
break;
|
||||
case 'scratchWallN':
|
||||
case 'scratchWallS':
|
||||
case 'scratchWallE':
|
||||
case 'scratchWallW':
|
||||
case 'scratchSelf':
|
||||
setSprite(idleAnimation, idleAnimationFrame);
|
||||
if (idleAnimationFrame > 9) {
|
||||
resetIdleAnimation();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
setSprite('idle', 0);
|
||||
return;
|
||||
}
|
||||
idleAnimationFrame += 1;
|
||||
}
|
||||
|
||||
function frame() {
|
||||
if (!nekoEl.value) return;
|
||||
|
||||
frameCount += 1;
|
||||
const diffX = nekoPosX - mousePosX;
|
||||
const diffY = nekoPosY - mousePosY;
|
||||
const distance = Math.sqrt(diffX ** 2 + diffY ** 2);
|
||||
|
||||
if (distance < nekoSpeed || distance < 48) {
|
||||
idle();
|
||||
return;
|
||||
}
|
||||
|
||||
idleAnimation = null;
|
||||
idleAnimationFrame = 0;
|
||||
|
||||
if (idleTime > 1) {
|
||||
setSprite('alert', 0);
|
||||
// count down after being alerted before moving
|
||||
idleTime = Math.min(idleTime, 7);
|
||||
idleTime -= 1;
|
||||
return;
|
||||
}
|
||||
|
||||
let direction;
|
||||
direction = diffY / distance > 0.5 ? 'N' : '';
|
||||
direction += diffY / distance < -0.5 ? 'S' : '';
|
||||
direction += diffX / distance > 0.5 ? 'W' : '';
|
||||
direction += diffX / distance < -0.5 ? 'E' : '';
|
||||
setSprite(direction, frameCount);
|
||||
|
||||
nekoPosX -= (diffX / distance) * nekoSpeed;
|
||||
nekoPosY -= (diffY / distance) * nekoSpeed;
|
||||
|
||||
nekoPosX = Math.min(Math.max(16, nekoPosX), window.innerWidth - 16);
|
||||
nekoPosY = Math.min(Math.max(16, nekoPosY), window.innerHeight - 16);
|
||||
|
||||
nekoEl.value.style.left = `${nekoPosX - 16}px`;
|
||||
nekoEl.value.style.top = `${nekoPosY - 16}px`;
|
||||
}
|
||||
|
||||
onMounted(init);
|
||||
</script>
|
||||
|
||||
<style module>
|
||||
.oneko {
|
||||
width: 32px;
|
||||
height: 32px;
|
||||
position: fixed;
|
||||
pointer-events: none;
|
||||
image-rendering: pixelated;
|
||||
z-index: 2147483647;
|
||||
background-image: url(/client-assets/oneko.gif);
|
||||
}
|
||||
</style>
|
|
@ -145,6 +145,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<MkSwitch v-model="useSystemFont">{{ i18n.ts.useSystemFont }}</MkSwitch>
|
||||
<MkSwitch v-model="disableDrawer">{{ i18n.ts.disableDrawer }}</MkSwitch>
|
||||
<MkSwitch v-model="forceShowAds">{{ i18n.ts.forceShowAds }}</MkSwitch>
|
||||
<MkSwitch v-model="oneko">{{ i18n.ts.oneko }}</MkSwitch>
|
||||
<MkSwitch v-model="enableSeasonalScreenEffect">{{ i18n.ts.seasonalScreenEffect }}</MkSwitch>
|
||||
</div>
|
||||
<div>
|
||||
|
@ -332,6 +333,7 @@ const emojiStyle = computed(defaultStore.makeGetterSetter('emojiStyle'));
|
|||
const disableDrawer = computed(defaultStore.makeGetterSetter('disableDrawer'));
|
||||
const disableShowingAnimatedImages = computed(defaultStore.makeGetterSetter('disableShowingAnimatedImages'));
|
||||
const forceShowAds = computed(defaultStore.makeGetterSetter('forceShowAds'));
|
||||
const oneko = computed(defaultStore.makeGetterSetter('oneko'));
|
||||
const loadRawImages = computed(defaultStore.makeGetterSetter('loadRawImages'));
|
||||
const highlightSensitiveMedia = computed(defaultStore.makeGetterSetter('highlightSensitiveMedia'));
|
||||
const imageNewTab = computed(defaultStore.makeGetterSetter('imageNewTab'));
|
||||
|
|
|
@ -98,6 +98,7 @@ const defaultStoreSaveKeys: (keyof typeof defaultStore['state'])[] = [
|
|||
'showClipButtonInNoteFooter',
|
||||
'reactionsDisplaySize',
|
||||
'forceShowAds',
|
||||
'oneko',
|
||||
'numberOfReplies',
|
||||
'aiChanMode',
|
||||
'devMode',
|
||||
|
|
|
@ -407,6 +407,10 @@ export const defaultStore = markRaw(new Storage('base', {
|
|||
where: 'device',
|
||||
default: false,
|
||||
},
|
||||
oneko: {
|
||||
where: 'device',
|
||||
default: false,
|
||||
},
|
||||
clickToOpen: {
|
||||
where: 'device',
|
||||
default: true,
|
||||
|
|
|
@ -42,6 +42,8 @@ SPDX-License-Identifier: AGPL-3.0-only
|
|||
<div v-if="dev" id="devTicker"><span>DEV BUILD</span></div>
|
||||
|
||||
<div v-if="$i && $i.isBot" id="botWarn"><span>{{ i18n.ts.loggedInAsBot }}</span></div>
|
||||
|
||||
<SkOneko v-if="defaultStore.state.oneko"/>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
|
@ -59,6 +61,8 @@ import { i18n } from '@/i18n.js';
|
|||
import { defaultStore } from '@/store.js';
|
||||
import { globalEvents } from '@/events.js';
|
||||
|
||||
const SkOneko = defineAsyncComponent(() => import('@/components/SkOneko.vue'));
|
||||
|
||||
const XStreamIndicator = defineAsyncComponent(() => import('./stream-indicator.vue'));
|
||||
const XUpload = defineAsyncComponent(() => import('./upload.vue'));
|
||||
|
||||
|
|
Loading…
Reference in a new issue