mirror of
https://github.com/HeyPuter/puter.git
synced 2026-02-22 22:48:58 -06:00
dev: option to follow old app names in get_app
This commit is contained in:
@@ -299,6 +299,20 @@ async function refresh_associations_cache(){
|
||||
|
||||
const log = services.get('log-service').create('get_app');
|
||||
let app = [];
|
||||
|
||||
// This condition should be updated if the code below is re-ordered.
|
||||
if ( options.follow_old_names && ! options.uid && options.name ) {
|
||||
const svc_oldAppName = services.get('old-app-name');
|
||||
const old_name = await svc_oldAppName.check_app_name(options.name);
|
||||
if ( old_name ) {
|
||||
options.uid = old_name.app_uid;
|
||||
|
||||
// The following line is technically pointless, but may avoid a bug
|
||||
// if the if...else chain below is re-ordered.
|
||||
delete options.name;
|
||||
}
|
||||
}
|
||||
|
||||
if(options.uid){
|
||||
// try cache first
|
||||
app[0] = kv.get(`apps:uid:${options.uid}`);
|
||||
|
||||
@@ -341,7 +341,10 @@ router.all('*', async function(req, res, next) {
|
||||
// /app/
|
||||
else if(path.startsWith('/app/')){
|
||||
app_name = path.replace('/app/', '');
|
||||
const app = await get_app({name: app_name});
|
||||
const app = await get_app({
|
||||
follow_old_names: true,
|
||||
name: app_name,
|
||||
});
|
||||
|
||||
|
||||
if(app){
|
||||
|
||||
Reference in New Issue
Block a user