Add configuration for full res on zoom and full res always for public shares

pull/672/head
Rhys Tyers 2023-05-31 12:35:40 +01:00
parent ac862da3d3
commit 1be43bdeeb
7 changed files with 46 additions and 7 deletions

View File

@ -94,6 +94,9 @@ class OtherController extends GenericApiController
'sort_folder_month' => 'true' === $getAppConfig('sortFolderMonth', false),
'sort_album_month' => 'true' === $getAppConfig('sortAlbumMonth', 'true'),
'enable_top_memories' => 'true' === $getAppConfig('enableTopMemories', 'true'),
'public_full_res_on_zoom' => Util::getSystemConfig('memories.public_full_res_on_zoom'),
'public_full_res_always' => Util::getSystemConfig('memories.public_full_res_always'),
], Http::STATUS_OK);
});
}

View File

@ -69,4 +69,7 @@ return [
'preview_max_y' => 4096,
'preview_max_memory' => 128,
'preview_max_filesize_image' => 50,
'memories.public_full_res_on_zoom' => true,
'memories.public_full_res_always' => false,
];

View File

@ -28,6 +28,9 @@ export type ISystemConfig = {
preview_max_y: number;
preview_max_memory: number;
preview_max_filesize_image: number;
'memories.public_full_res_on_zoom': boolean;
'memories.public_full_res_always': boolean;
};
export type IBinaryStatus = 'ok' | 'not_found' | 'not_executable' | 'test_ok' | string;

View File

@ -62,6 +62,27 @@
:value="String(config['preview_max_filesize_image'])"
@change="update('preview_max_filesize_image', Number($event.target.value))"
/>
<br />
{{ t('memories', 'You can set the image viewer to always request a full size image when an image is opened for public folders (there is seperate user setting for logged in users).') }}
{{ t('memories', 'This is not recommended if the images require transcoding (i.e. heic images) because it will cause a large amount of CPU usage.') }}
<br />
<NcCheckboxRadioSwitch
:checked.sync="config['memories.public_full_res_on_zoom']"
@update:checked="update('memories.public_full_res_on_zoom',)"
type="switch"
>
{{ t('memories', 'Load full size image on zoom for public folders') }}
</NcCheckboxRadioSwitch>
<NcCheckboxRadioSwitch
:checked.sync="config['memories.public_full_res_always']"
@update:checked="update('memories.public_full_res_always',)"
type="switch"
>
{{ t('memories', 'Always load full size image for public folders') }}
</NcCheckboxRadioSwitch>
</div>
</template>

View File

@ -797,7 +797,10 @@ export default defineComponent({
: photo.flag & this.c.FLAG_IS_LOCAL
? nativex.API.IMAGE_FULL(photo.fileid)
: API.IMAGE_DECODABLE(photo.fileid, photo.etag);
const fullLoadCond = this.config.full_res_always ? 'always' : this.config.full_res_on_zoom ? 'zoom' : 'never';
const fullResOnZoom = this.routeIsPublic ? this.config.public_full_res_on_zoom : this.config.full_res_on_zoom;
const fullResAlways = this.routeIsPublic ? this.config.public_full_res_always : this.config.full_res_always;
const fullLoadCond = fullResAlways ? 'always' : fullResOnZoom ? 'zoom' : 'never';
return {
src: previewUrl,

View File

@ -1,12 +1,13 @@
import axios from '@nextcloud/axios';
import { showInfo, showError } from '@nextcloud/dialogs';
import { API } from './API';
import { IConfig } from '../types';
import { getBuilder } from '@nextcloud/browser-storage';
import { translate as t } from '@nextcloud/l10n';
import * as utils from './Utils';
import { showError, showInfo } from '@nextcloud/dialogs';
import { API } from './API';
import { IConfig } from '../types';
import type Storage from '@nextcloud/browser-storage/dist/storage';
import axios from '@nextcloud/axios';
import { getBuilder } from '@nextcloud/browser-storage';
import { translate as t } from '@nextcloud/l10n';
class StaticConfig {
private config: IConfig | null = null;
@ -120,6 +121,9 @@ class StaticConfig {
full_res_always: false,
show_face_rect: false,
album_list_sort: 1,
public_full_res_on_zoom: true,
public_full_res_always: false,
};
for (const key in config) {

View File

@ -254,6 +254,8 @@ export type IConfig = {
square_thumbs: boolean;
full_res_on_zoom: boolean;
full_res_always: boolean;
public_full_res_on_zoom: boolean;
public_full_res_always: boolean;
show_face_rect: boolean;
album_list_sort: 1 | 2;
};