Merge branch 'develop' into feat/scylladb

This commit is contained in:
Namekuji 2023-08-02 03:37:59 -04:00
commit 91c2aa4715
No known key found for this signature in database
GPG key ID: 1D62332C07FBA532
20 changed files with 1584 additions and 545 deletions

4
.config/docker_ci.env Normal file
View file

@ -0,0 +1,4 @@
# db settings
POSTGRES_PASSWORD=test
POSTGRES_USER=postgres
POSTGRES_DB=postgres

1
.gitignore vendored
View file

@ -25,6 +25,7 @@ coverage
!/.config/example.yml !/.config/example.yml
!/.config/devenv.yml !/.config/devenv.yml
!/.config/docker_example.env !/.config/docker_example.env
!/.config/docker_ci.env
!/.config/helm_values_example.yml !/.config/helm_values_example.yml
!/.config/LICENSE !/.config/LICENSE

View file

@ -28,14 +28,14 @@ services:
- postgres:15 - postgres:15
- redis - redis
before_script:
- apk add --no-cache cargo python3 make g++
- cp .config/ci.yml .config/default.yml
- corepack enable
- corepack prepare pnpm@latest --activate
testCommit: testCommit:
stage: build stage: build
before_script:
- apk add --no-cache cargo python3 make g++
- cp .config/ci.yml .config/default.yml
- corepack enable
- corepack prepare pnpm@latest --activate
script: script:
- pnpm i --frozen-lockfile - pnpm i --frozen-lockfile
- pnpm run build:debug - pnpm run build:debug
@ -51,6 +51,9 @@ dockerPush:
image: docker:latest image: docker:latest
services: services:
- docker:dind - docker:dind
before_script:
- cp .config/ci.yml .config/default.yml
- cp .config/docker_ci.env .config/docker.env
script: script:
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG . - docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG .
- echo $CI_JOB_TOKEN | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY - echo $CI_JOB_TOKEN | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY

File diff suppressed because it is too large Load diff

View file

@ -1134,6 +1134,7 @@ deletePasskeys: "Delete passkeys"
delete2faConfirm: "This will irreversibly delete 2FA on this account. Proceed?" delete2faConfirm: "This will irreversibly delete 2FA on this account. Proceed?"
deletePasskeysConfirm: "This will irreversibly delete all passkeys and security keys on this account. Proceed?" deletePasskeysConfirm: "This will irreversibly delete all passkeys and security keys on this account. Proceed?"
inputNotMatch: "Input does not match" inputNotMatch: "Input does not match"
addRe: "Add \"re:\" at the beginning of comment in reply to a post with a content warning"
_sensitiveMediaDetection: _sensitiveMediaDetection:
description: "Reduces the effort of server moderation through automatically recognizing description: "Reduces the effort of server moderation through automatically recognizing
@ -1229,6 +1230,7 @@ _aboutFirefish:
development since 2022." development since 2022."
contributors: "Main contributors" contributors: "Main contributors"
allContributors: "All contributors" allContributors: "All contributors"
misskeyContributors: "Misskey contributors"
source: "Source code" source: "Source code"
translation: "Translate Firefish" translation: "Translate Firefish"
donate: "Donate to Firefish" donate: "Donate to Firefish"

View file

@ -987,6 +987,7 @@ showWithSparkles: "タイトルをキラキラさせる"
youHaveUnreadAnnouncements: "未読のお知らせがあります" youHaveUnreadAnnouncements: "未読のお知らせがあります"
neverShow: "今後表示しない" neverShow: "今後表示しない"
remindMeLater: "また後で" remindMeLater: "また後で"
addRe: "閲覧注意の投稿への返信で、注釈の先頭に\"re:\"を追加する"
_sensitiveMediaDetection: _sensitiveMediaDetection:
description: "機械学習を使って自動でセンシティブなメディアを検出し、モデレーションに役立てられます。サーバーの負荷が少し増えます。" description: "機械学習を使って自動でセンシティブなメディアを検出し、モデレーションに役立てられます。サーバーの負荷が少し増えます。"
@ -1066,6 +1067,7 @@ _aboutFirefish:
about: "Firefishは、2022年に生まれたThatOneCalculatorによるMisskeyのforkです。" about: "Firefishは、2022年に生まれたThatOneCalculatorによるMisskeyのforkです。"
contributors: "主なコントリビューター" contributors: "主なコントリビューター"
allContributors: "全てのコントリビューター" allContributors: "全てのコントリビューター"
misskeyContributors: "フォーク元のMisskeyの主なコントリビューター"
source: "ソースコード" source: "ソースコード"
translation: "Firefishを翻訳" translation: "Firefishを翻訳"
donate: "Firefishに寄付" donate: "Firefishに寄付"

View file

@ -1,6 +1,6 @@
{ {
"name": "firefish", "name": "firefish",
"version": "1.0.4-dev6", "version": "1.0.4-dev10",
"codename": "aqua", "codename": "aqua",
"repository": { "repository": {
"type": "git", "type": "git",

View file

@ -42,13 +42,15 @@ async fn main() {
None => "redis", None => "redis",
Some(_) => "rediss", Some(_) => "rediss",
}; };
let redis_uri_userpass = match redis_conf.user { let redis_user = redis_conf.user.unwrap_or("default".to_string());
None => "".to_string(), let redis_uri_userpass = format!(
Some(user) => format!("{}:{}@", user, encode(&redis_conf.pass.unwrap_or_default())), "{}:{}",
}; redis_user,
encode(&redis_conf.pass.unwrap_or_default())
);
let redis_uri_hostport = format!("{}:{}", redis_conf.host, redis_conf.port); let redis_uri_hostport = format!("{}:{}", redis_conf.host, redis_conf.port);
let redis_uri = format!( let redis_uri = format!(
"{}://{}{}/{}", "{}://{}@{}/{}",
redis_proto, redis_uri_userpass, redis_uri_hostport, redis_conf.db redis_proto, redis_uri_userpass, redis_uri_hostport, redis_conf.db
); );
env::set_var(CACHE_URL_ENV, redis_uri); env::set_var(CACHE_URL_ENV, redis_uri);

View file

@ -36,7 +36,7 @@
"artifacts": "napi artifacts", "artifacts": "napi artifacts",
"build": "pnpm run build:napi && pnpm run build:migration", "build": "pnpm run build:napi && pnpm run build:migration",
"build:napi": "napi build --features napi --platform --release ./built/", "build:napi": "napi build --features napi --platform --release ./built/",
"build:migration": "cargo build --locked --release --manifest-path ./migration/Cargo.toml && cp ./target/release/migration ./built/migration", "build:migration": "cargo build --locked --release --manifest-path ./migration/Cargo.toml && cp -v ./target/release/migration ./built/migration",
"build:debug": "napi build --features napi --platform ./built/ && cargo build --locked --manifest-path ./migration/Cargo.toml && cp -v ./target/debug/migration ./built/migration", "build:debug": "napi build --features napi --platform ./built/ && cargo build --locked --manifest-path ./migration/Cargo.toml && cp -v ./target/debug/migration ./built/migration",
"prepublishOnly": "napi prepublish -t npm", "prepublishOnly": "napi prepublish -t npm",
"test": "pnpm run cargo:test && pnpm run build:napi && ava", "test": "pnpm run cargo:test && pnpm run build:napi && ava",

View file

@ -156,7 +156,7 @@ export function toHtml(
search(node) { search(node) {
const a = doc.createElement("a"); const a = doc.createElement("a");
a.href = `https://search.annoyingorange.xyz/search?q=${node.props.query}`; a.href = `/search/${node.props.query}`;
a.textContent = node.props.content; a.textContent = node.props.content;
return a; return a;
}, },

View file

@ -27,6 +27,8 @@ export function apiStatusMastodon(router: Router): void {
let body: any = ctx.request.body; let body: any = ctx.request.body;
if (body.in_reply_to_id) if (body.in_reply_to_id)
body.in_reply_to_id = convertId(body.in_reply_to_id, IdType.FirefishId); body.in_reply_to_id = convertId(body.in_reply_to_id, IdType.FirefishId);
if (body.quote_id)
body.quote_id = convertId(body.quote_id, IdType.FirefishId);
if ( if (
(!body.poll && body["poll[options][]"]) || (!body.poll && body["poll[options][]"]) ||
(!body.media_ids && body["media_ids[]"]) (!body.media_ids && body["media_ids[]"])

View file

@ -18,6 +18,10 @@ export function argsToBools(q: ParsedUrlQuery) {
const toBoolean = (value: string) => const toBoolean = (value: string) =>
!["0", "f", "F", "false", "FALSE", "off", "OFF"].includes(value); !["0", "f", "F", "false", "FALSE", "off", "OFF"].includes(value);
// Keys taken from:
// - https://docs.joinmastodon.org/methods/accounts/#statuses
// - https://docs.joinmastodon.org/methods/timelines/#public
// - https://docs.joinmastodon.org/methods/timelines/#tag
let object: any = q; let object: any = q;
if (q.only_media) if (q.only_media)
if (typeof q.only_media === "string") if (typeof q.only_media === "string")
@ -25,6 +29,13 @@ export function argsToBools(q: ParsedUrlQuery) {
if (q.exclude_replies) if (q.exclude_replies)
if (typeof q.exclude_replies === "string") if (typeof q.exclude_replies === "string")
object.exclude_replies = toBoolean(q.exclude_replies); object.exclude_replies = toBoolean(q.exclude_replies);
if (q.exclude_reblogs)
if (typeof q.exclude_reblogs === "string")
object.exclude_reblogs = toBoolean(q.exclude_reblogs);
if (q.pinned)
if (typeof q.pinned === "string") object.pinned = toBoolean(q.pinned);
if (q.local)
if (typeof q.local === "string") object.local = toBoolean(q.local);
return q; return q;
} }

View file

@ -11,6 +11,9 @@
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from "vue"; import { ref } from "vue";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import { useRouter } from "@/router";
const router = useRouter();
const props = defineProps<{ const props = defineProps<{
q: string; q: string;
@ -19,10 +22,7 @@ const props = defineProps<{
const query = ref(props.q); const query = ref(props.q);
const search = () => { const search = () => {
window.open( router.push(`/search/${query.value}`);
`https://search.annoyingorange.xyz/search?q=${query.value}`,
"_blank",
);
}; };
</script> </script>

View file

@ -35,10 +35,33 @@ const instance = props.instance ?? {
'meta[name="theme-color-orig"]', 'meta[name="theme-color-orig"]',
) as HTMLMetaElement ) as HTMLMetaElement
)?.content, )?.content,
softwareName: Instance.softwareName || "Firefish", softwareName: Instance.softwareName ?? "Firefish",
}; };
const capitalize = (s: string) => s && s[0].toUpperCase() + s.slice(1); const commonNames = new Map<string, string>([
["birdsitelive", "BirdsiteLIVE"],
["bookwyrm", "BookWyrm"],
["bridgy-fed", "Bridgy Fed"],
["foundkey", "FoundKey"],
["gnusocial", "GNU Social"],
["gotosocial", "GoToSocial"],
["microblogpub", "microblog.pub"],
["nextcloud social", "Nextcloud Social"],
["peertube", "PeerTube"],
["snac", "snac"],
["snac2", "snac2"],
["takahe", "Takahē"],
["wafrn", "WAFRN"],
["wordpress", "WordPress"],
["writefreely", "WriteFreely"],
["wxwclub", "wxwClub"],
]);
const capitalize = (s: string) => {
if (s == null) return "Unknown";
if (commonNames.has(s)) return commonNames.get(s);
return s[0].toUpperCase() + s.slice(1);
};
const computedStyle = getComputedStyle(document.documentElement); const computedStyle = getComputedStyle(document.documentElement);
const themeColor = const themeColor =

View file

@ -519,10 +519,23 @@ if (props.specified) {
pushVisibleUser(props.specified); pushVisibleUser(props.specified);
} }
const addRe = (s: string) => {
if (
!defaultStore.state.addRe ||
s.trim() === "" ||
s.slice(0, 3).toLowerCase() === "re:"
)
return s;
return `re: ${s}`;
};
// keep cw when reply // keep cw when reply
if (defaultStore.state.keepCw && props.reply && props.reply.cw) { if (defaultStore.state.keepCw && props.reply && props.reply.cw) {
useCw = true; useCw = true;
cw = props.reply.cw; cw =
props.reply.user.username === $i.username
? props.reply.cw
: addRe(props.reply.cw);
} }
function watchForDraft() { function watchForDraft() {

View file

@ -176,12 +176,12 @@ watch(
} }
&:before { &:before {
border-radius: 0 75% 75%; border-radius: 25% 75% 75%;
transform: rotate(37.5deg) skew(30deg); transform: rotate(37.5deg) skew(30deg);
} }
&:after { &:after {
border-radius: 75% 0 75% 75%; border-radius: 75% 25% 75% 75%;
transform: rotate(-37.5deg) skew(-30deg); transform: rotate(-37.5deg) skew(-30deg);
} }

View file

@ -64,7 +64,7 @@
><i class="ph-code ph-bold ph-lg"></i ><i class="ph-code ph-bold ph-lg"></i
></template> ></template>
{{ i18n.ts._aboutFirefish.source }} {{ i18n.ts._aboutFirefish.source }}
<template #suffix>Codeberg</template> <template #suffix>GitLab</template>
</FormLink> </FormLink>
<FormLink <FormLink
to="https://opencollective.com/firefish" to="https://opencollective.com/firefish"
@ -106,26 +106,52 @@
:text="'@namekuji@firefish.social (Backend)'" :text="'@namekuji@firefish.social (Backend)'"
/></FormLink> /></FormLink>
<FormLink to="/@dev@post.naskya.net" <FormLink to="/@dev@post.naskya.net"
><Mfm :text="'@dev@post.naskya.net (Backend)'" ><Mfm :text="'@dev@post.naskya.net (Fullstack)'"
/></FormLink> /></FormLink>
<FormLink to="/@panos@firefish.social" <FormLink to="/@panos@firefish.social"
><Mfm ><Mfm
:text="'@panos@firefish.social (Project Coordinator)'" :text="'@panos@firefish.social (Project Coordinator)'"
/></FormLink> /></FormLink>
<FormLink <FormLink to="/@blackspike@mastodon.cloud"
to="https://www.youtube.com/c/Henkiwashere" ><Mfm
external :text="'@blackspike@mastodon.cloud (Logo Design)'"
>Henki (error images artist)</FormLink /></FormLink>
>
</div> </div>
<template #caption <h3
><MkLink style="
url="https://git.joinfirefish.org/firefish/firefish/activity" font-weight: 700;
>{{ margin: 1.5em 0 16px;
i18n.ts._aboutFirefish.allContributors font-size: 1em;
}}</MkLink "
></template
> >
{{ i18n.ts._aboutFirefish.misskeyContributors }}
</h3>
<div class="_formLinks">
<FormLink to="/@syuilo@misskey.io"
><Mfm :text="'@syuilo@misskey.io'"
/></FormLink>
<FormLink to="/@aqz@p1.a9z.dev"
><Mfm :text="'@aqz@p1.a9z.dev'"
/></FormLink>
<FormLink to="/@ac@misskey.cloud"
><Mfm :text="'@ac@misskey.cloud'"
/></FormLink>
<FormLink to="/@rinsuki@mstdn.rinsuki.net"
><Mfm :text="'@rinsuki@mstdn.rinsuki.net'"
/></FormLink>
<FormLink to="/@mei23@misskey.m544.net"
><Mfm :text="'@mei23@misskey.m544.net'"
/></FormLink>
<FormLink to="/@robflop@misskey.io"
><Mfm :text="'@robflop@misskey.io'"
/></FormLink>
</div>
<h3>
<MkLink
url="https://git.joinfirefish.org/firefish/firefish/activity"
>{{ i18n.ts._aboutFirefish.allContributors }}
</MkLink>
</h3>
</FormSection> </FormSection>
<FormSection> <FormSection>
<template #label <template #label

View file

@ -218,6 +218,7 @@ definePageMetadata(
> .users { > .users {
> .inputs { > .inputs {
display: flex; display: flex;
gap: 0.4rem;
margin-bottom: 16px; margin-bottom: 16px;
> * { > * {

View file

@ -130,6 +130,12 @@
@update:modelValue="save()" @update:modelValue="save()"
>{{ i18n.ts.keepCw }}</FormSwitch >{{ i18n.ts.keepCw }}</FormSwitch
> >
<FormSwitch
v-model="addRe"
class="_formBlock"
@update:modelValue="save()"
>{{ i18n.ts.addRe }}
</FormSwitch>
</div> </div>
</template> </template>
@ -164,6 +170,7 @@ let rememberNoteVisibility = $computed(
defaultStore.makeGetterSetter("rememberNoteVisibility"), defaultStore.makeGetterSetter("rememberNoteVisibility"),
); );
let keepCw = $computed(defaultStore.makeGetterSetter("keepCw")); let keepCw = $computed(defaultStore.makeGetterSetter("keepCw"));
let addRe = $computed(defaultStore.makeGetterSetter("addRe"));
function save() { function save() {
os.api("i/update", { os.api("i/update", {

View file

@ -342,6 +342,10 @@ export const defaultStore = markRaw(
where: "device", where: "device",
default: false, default: false,
}, },
addRe: {
where: "account",
default: true,
},
}), }),
); );