1
0
Fork 0
mirror of https://github.com/cheeaun/phanpy.git synced 2025-04-02 12:01:36 +02:00

Merge pull request from cheeaun/main

Update from main
This commit is contained in:
Chee Aun 2023-10-12 01:34:30 +08:00 committed by GitHub
commit cd68aee186
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 18 deletions

View file

@ -126,11 +126,13 @@ function App() {
setUIState('default'); setUIState('default');
})(); })();
} else { } else {
window.__IGNORE_GET_ACCOUNT_ERROR__ = true;
const account = getCurrentAccount(); const account = getCurrentAccount();
if (account) { if (account) {
store.session.set('currentAccount', account.info.id); store.session.set('currentAccount', account.info.id);
const { masto, instance } = api({ account }); const { masto, instance } = api({ account });
console.log('masto', masto); console.log('masto', masto);
initStates();
initPreferences(masto); initPreferences(masto);
setUIState('loading'); setUIState('loading');
(async () => { (async () => {

View file

@ -99,10 +99,12 @@
text-shadow: 0 var(--hairline-width) var(--bg-color); text-shadow: 0 var(--hairline-width) var(--bg-color);
width: 100%; width: 100%;
@media (hover: hover) {
&:is(:hover, :focus) { &:is(:hover, :focus) {
color: var(--text-color); color: var(--text-color);
} }
} }
}
#shortcuts .tab-bar li a:active { #shortcuts .tab-bar li a:active {
transform: scale(0.95); transform: scale(0.95);
transition: none; transition: none;

View file

@ -18,7 +18,7 @@ const states = proxy({
homeLast: null, // Last item in 'home' list homeLast: null, // Last item in 'home' list
homeLastFetchTime: null, homeLastFetchTime: null,
notifications: [], notifications: [],
notificationsLast: store.account.get('notificationsLast') || null, // Last read notification notificationsLast: null, // Last read notification
notificationsNew: [], notificationsNew: [],
notificationsShowNew: false, notificationsShowNew: false,
notificationsLastFetchTime: null, notificationsLastFetchTime: null,
@ -46,23 +46,18 @@ const states = proxy({
showGenericAccounts: false, showGenericAccounts: false,
showMediaAlt: false, showMediaAlt: false,
// Shortcuts // Shortcuts
shortcuts: store.account.get('shortcuts') ?? [], shortcuts: [],
// Settings // Settings
settings: { settings: {
autoRefresh: store.account.get('settings-autoRefresh') ?? false, autoRefresh: false,
shortcutsViewMode: store.account.get('settings-shortcutsViewMode') ?? null, shortcutsViewMode: null,
shortcutsColumnsMode: shortcutsColumnsMode: false,
store.account.get('settings-shortcutsColumnsMode') ?? false, boostsCarousel: true,
boostsCarousel: store.account.get('settings-boostsCarousel') ?? true, contentTranslation: true,
contentTranslation: contentTranslationTargetLanguage: null,
store.account.get('settings-contentTranslation') ?? true, contentTranslationHideLanguages: [],
contentTranslationTargetLanguage: contentTranslationAutoInline: false,
store.account.get('settings-contentTranslationTargetLanguage') || null, cloakMode: false,
contentTranslationHideLanguages:
store.account.get('settings-contentTranslationHideLanguages') || [],
contentTranslationAutoInline:
store.account.get('settings-contentTranslationAutoInline') ?? false,
cloakMode: store.account.get('settings-cloakMode') ?? false,
}, },
}); });

View file

@ -11,6 +11,11 @@ export function getAccountByAccessToken(accessToken) {
} }
export function getCurrentAccount() { export function getCurrentAccount() {
if (!window.__IGNORE_GET_ACCOUNT_ERROR__) {
// Track down getCurrentAccount() calls before account-based states are initialized
console.error('getCurrentAccount() called before states are initialized');
if (import.meta.env.DEV) console.trace();
}
const currentAccount = store.session.get('currentAccount'); const currentAccount = store.session.get('currentAccount');
const account = getAccount(currentAccount); const account = getAccount(currentAccount);
return account; return account;