You've already forked pigallery2
mirror of
https://github.com/bpatrik/pigallery2.git
synced 2025-11-25 22:32:52 +02:00
remove 'pr:' prefix from projection key to fit into 32 chars
This commit is contained in:
@@ -15,7 +15,7 @@ export class VersionMWs {
|
|||||||
try {
|
try {
|
||||||
// DB version from the client perspective depends on the projection and if the DB was updated
|
// DB version from the client perspective depends on the projection and if the DB was updated
|
||||||
const version = await ObjectManagers.getInstance().VersionManager.getDataVersion();
|
const version = await ObjectManagers.getInstance().VersionManager.getDataVersion();
|
||||||
const projectionKey = req.session.context?.user?.projectionKey ?? '';
|
const projectionKey = 'pr:' + (req.session.context?.user?.projectionKey ?? '');
|
||||||
res.header(
|
res.header(
|
||||||
CustomHeaders.dataVersion,
|
CustomHeaders.dataVersion,
|
||||||
version + projectionKey
|
version + projectionKey
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ const LOG_TAG = '[SessionManager]';
|
|||||||
|
|
||||||
export class SessionManager {
|
export class SessionManager {
|
||||||
|
|
||||||
public static readonly NO_PROJECTION_KEY = 'pr:' + crypto.createHash('md5').update('No Key').digest('hex');
|
public static readonly NO_PROJECTION_KEY = crypto.createHash('md5').update('No Key').digest('hex');
|
||||||
|
|
||||||
private getQueryForUser(user: ContextUser) {
|
private getQueryForUser(user: ContextUser) {
|
||||||
let blockQuery = user.overrideAllowBlockList ? user.blockQuery : Config.Users.blockQuery;
|
let blockQuery = user.overrideAllowBlockList ? user.blockQuery : Config.Users.blockQuery;
|
||||||
@@ -55,7 +55,7 @@ export class SessionManager {
|
|||||||
|
|
||||||
public createProjectionKey(q: SearchQueryDTO) {
|
public createProjectionKey(q: SearchQueryDTO) {
|
||||||
const canonical = SearchQueryUtils.stringifyForComparison(q);
|
const canonical = SearchQueryUtils.stringifyForComparison(q);
|
||||||
return 'pr:' + crypto.createHash('md5').update(canonical).digest('hex');
|
return crypto.createHash('md5').update(canonical).digest('hex');
|
||||||
}
|
}
|
||||||
|
|
||||||
public async buildContext(user: ContextUser): Promise<SessionContext> {
|
public async buildContext(user: ContextUser): Promise<SessionContext> {
|
||||||
|
|||||||
Reference in New Issue
Block a user