mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-18 05:25:40 +09:00
fix(app): shrink stored favorite gifs and raise their budget (#2643)
This commit is contained in:
1 parent
5fea319f4e
commit
905af5dd5a
13 files changed
+191
-215
No files matched your search
@@ -2,7 +2,11 @@
|
||||
|
||||
import {create} from '@bufbuild/protobuf';
|
||||
import {MAX_GROUP_DM_OTHER_RECIPIENTS} from '@fluxer/constants/src/LimitConstants';
|
||||
import {encodeSyncedPreferences, SyncedPreferencesSchema} from '@fluxer/schema/src/domains/user/SyncedPreferencesCodec';
|
||||
import {
|
||||
encodeSyncedPreferences,
|
||||
SYNCED_PREFERENCES_MAX_ENCODED_LENGTH,
|
||||
SyncedPreferencesSchema,
|
||||
} from '@fluxer/schema/src/domains/user/SyncedPreferencesCodec';
|
||||
import {
|
||||
CreatePrivateChannelRequest,
|
||||
CustomStatusPayload,
|
||||
@@ -60,8 +64,12 @@ describe('UserSettingsUpdateRequest synced_preferences', () => {
|
||||
false,
|
||||
);
|
||||
});
|
||||
it('accepts a string at exactly the size cap', () => {
|
||||
const atCap = 'A'.repeat(SYNCED_PREFERENCES_MAX_ENCODED_LENGTH);
|
||||
expect(UserSettingsUpdateRequest.safeParse({synced_preferences: atCap}).success).toBe(true);
|
||||
});
|
||||
it('rejects strings exceeding the size cap', () => {
|
||||
const oversized = 'A'.repeat(400000);
|
||||
const oversized = 'A'.repeat(SYNCED_PREFERENCES_MAX_ENCODED_LENGTH + 1);
|
||||
expect(UserSettingsUpdateRequest.safeParse({synced_preferences: oversized}).success).toBe(false);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -11,7 +11,7 @@ export type {SyncedPreferences} from '@fluxer/schema/src/gen/fluxer/user/prefere
|
||||
export {SyncedPreferencesSchema} from '@fluxer/schema/src/gen/fluxer/user/preferences/v1/preferences_pb';
|
||||
|
||||
export const EMPTY_SYNCED_PREFERENCES_ENCODED = '';
|
||||
export const SYNCED_PREFERENCES_MAX_BYTES = 256 * 1024;
|
||||
export const SYNCED_PREFERENCES_MAX_BYTES = 512 * 1024;
|
||||
export const SYNCED_PREFERENCES_MAX_ENCODED_LENGTH = Math.ceil(SYNCED_PREFERENCES_MAX_BYTES / 3) * 4;
|
||||
const BASE64_PATTERN = /^[A-Za-z0-9+/_-]*={0,2}$/;
|
||||
|
||||
|
||||
Reference in new issue
Block a user