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/devenv.yml
!/.config/docker_example.env
!/.config/docker_ci.env
!/.config/helm_values_example.yml
!/.config/LICENSE

View file

@ -28,14 +28,14 @@ services:
- postgres:15
- 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:
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:
- pnpm i --frozen-lockfile
- pnpm run build:debug
@ -51,6 +51,9 @@ dockerPush:
image: docker:latest
services:
- docker:dind
before_script:
- cp .config/ci.yml .config/default.yml
- cp .config/docker_ci.env .config/docker.env
script:
- docker build -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG .
- 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?"
deletePasskeysConfirm: "This will irreversibly delete all passkeys and security keys on this account. Proceed?"
inputNotMatch: "Input does not match"
addRe: "Add \"re:\" at the beginning of comment in reply to a post with a content warning"
_sensitiveMediaDetection:
description: "Reduces the effort of server moderation through automatically recognizing
@ -1229,6 +1230,7 @@ _aboutFirefish:
development since 2022."
contributors: "Main contributors"
allContributors: "All contributors"
misskeyContributors: "Misskey contributors"
source: "Source code"
translation: "Translate Firefish"
donate: "Donate to Firefish"

View file

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

View file

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

View file

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

View file

@ -36,7 +36,7 @@
"artifacts": "napi artifacts",
"build": "pnpm run build:napi && pnpm run build:migration",
"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",
"prepublishOnly": "napi prepublish -t npm",
"test": "pnpm run cargo:test && pnpm run build:napi && ava",

View file

@ -156,7 +156,7 @@ export function toHtml(
search(node) {
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;
return a;
},

View file

@ -27,6 +27,8 @@ export function apiStatusMastodon(router: Router): void {
let body: any = ctx.request.body;
if (body.in_reply_to_id)
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 (
(!body.poll && body["poll[options][]"]) ||
(!body.media_ids && body["media_ids[]"])

View file

@ -18,6 +18,10 @@ export function argsToBools(q: ParsedUrlQuery) {
const toBoolean = (value: string) =>
!["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;
if (q.only_media)
if (typeof q.only_media === "string")
@ -25,6 +29,13 @@ export function argsToBools(q: ParsedUrlQuery) {
if (q.exclude_replies)
if (typeof q.exclude_replies === "string")
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;
}

View file

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

View file

@ -35,10 +35,33 @@ const instance = props.instance ?? {
'meta[name="theme-color-orig"]',
) as HTMLMetaElement
)?.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 themeColor =

View file

@ -519,10 +519,23 @@ if (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
if (defaultStore.state.keepCw && props.reply && props.reply.cw) {
useCw = true;
cw = props.reply.cw;
cw =
props.reply.user.username === $i.username
? props.reply.cw
: addRe(props.reply.cw);
}
function watchForDraft() {

View file

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

View file

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

View file

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

View file

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

View file

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