Merge branch 'develop' of codeberg.org:calckey/calckey into develop
This commit is contained in:
commit
0e8c30d3fa
2 changed files with 12 additions and 10 deletions
|
@ -304,17 +304,19 @@ export function apiAccountMastodon(router: Router): void {
|
||||||
const client = getClient(BASE_URL, accessTokens);
|
const client = getClient(BASE_URL, accessTokens);
|
||||||
let users;
|
let users;
|
||||||
try {
|
try {
|
||||||
const idsRaw = ctx.query["id[]"];
|
const idsRaw = ctx.request.body?["id[]"] : null;
|
||||||
const ids = typeof idsRaw === "string" ? [idsRaw] : idsRaw;
|
const ids = typeof idsRaw === "string" ? [idsRaw] : idsRaw;
|
||||||
users = ids;
|
users = ids;
|
||||||
relationshopModel.id = idsRaw?.toString() || "1";
|
relationshopModel.id = idsRaw?.toString() || "1";
|
||||||
if (!idsRaw) return [relationshopModel];
|
if (!(idsRaw && ids)) {
|
||||||
const data = (await client.getRelationships(ids ? ids : [])) as any;
|
ctx.body = [relationshopModel];
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const data = await client.getRelationships(ids);
|
||||||
ctx.body = data.data;
|
ctx.body = data.data;
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
console.error(e.response.data);
|
console.error(e.response.data);
|
||||||
e.response.data.user = users ? users : "null";
|
|
||||||
ctx.status = 401;
|
ctx.status = 401;
|
||||||
ctx.body = e.response.data;
|
ctx.body = e.response.data;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,21 +144,20 @@ onMounted(() => {
|
||||||
calcBg();
|
calcBg();
|
||||||
globalEvents.on('themeChanged', calcBg);
|
globalEvents.on('themeChanged', calcBg);
|
||||||
|
|
||||||
|
|
||||||
watch(() => [props.tab, props.tabs], () => {
|
watch(() => [props.tab, props.tabs], () => {
|
||||||
nextTick(() => {
|
nextTick(() => {
|
||||||
const tabEl = tabRefs[props.tab];
|
const tabEl = tabRefs[props.tab];
|
||||||
if (tabEl && tabHighlightEl) {
|
if (tabEl && tabHighlightEl) {
|
||||||
// offsetWidth や offsetLeft は少数を丸めてしまうため getBoundingClientRect を使う必要がある
|
// offsetWidth や offsetLeft は少数を丸めてしまうため getBoundingClientRect を使う必要がある
|
||||||
// https://developer.mozilla.org/ja/docs/Web/API/HTMLElement/offsetWidth#%E5%80%A4
|
// https://developer.mozilla.org/ja/docs/Web/API/HTMLElement/offsetWidth#%E5%80%A4
|
||||||
|
const tabSizeX = tabEl.scrollWidth + 20; // + the tab's padding
|
||||||
|
tabEl.style = `--width: ${tabSizeX}px`;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
const parentRect = tabsEl.getBoundingClientRect();
|
const parentRect = tabsEl.getBoundingClientRect();
|
||||||
const rect = tabEl.getBoundingClientRect();
|
const rect = tabEl.getBoundingClientRect();
|
||||||
const tabSizeX = tabEl.scrollWidth;
|
|
||||||
const left = (rect.left - parentRect.left + tabsEl?.scrollLeft);
|
const left = (rect.left - parentRect.left + tabsEl?.scrollLeft);
|
||||||
tabEl.style = "--width: " + tabSizeX + "px";
|
|
||||||
tabHighlightEl.style.width = tabSizeX + 'px';
|
tabHighlightEl.style.width = tabSizeX + 'px';
|
||||||
tabHighlightEl.style.transform = 'translateX(' + left + 'px)';
|
tabHighlightEl.style.transform = `translateX(${left}px)`;
|
||||||
window.requestAnimationFrame(() => {
|
window.requestAnimationFrame(() => {
|
||||||
tabsEl?.scrollTo({left: left - 60, behavior: "smooth"});
|
tabsEl?.scrollTo({left: left - 60, behavior: "smooth"});
|
||||||
})
|
})
|
||||||
|
@ -358,11 +357,12 @@ onUnmounted(() => {
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding: 0 10px;
|
border-inline: 10px solid transparent;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
opacity: 0.7;
|
opacity: 0.7;
|
||||||
width: 38px;
|
width: 38px;
|
||||||
|
--width: 38px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
transition: color .2s, opacity .2s, width .2s;
|
transition: color .2s, opacity .2s, width .2s;
|
||||||
|
|
||||||
|
@ -384,7 +384,7 @@ onUnmounted(() => {
|
||||||
margin-left: 8px;
|
margin-left: 8px;
|
||||||
}
|
}
|
||||||
> .title {
|
> .title {
|
||||||
transition: font-size .2s, opacity .2s;
|
transition: opacity .2s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue