Merge branch 'HeyPuter:main' into i18n_gui_french

This commit is contained in:
Noah 2024-11-21 11:05:36 +01:00 committed by GitHub
commit 6992ce06cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 106 additions and 64 deletions

View File

@ -84,11 +84,14 @@ module.exports = eggspress('/open_item', {
// Note: We always grant write permission here. If the user only // Note: We always grant write permission here. If the user only
// has read permission this is still safe; user permissions // has read permission this is still safe; user permissions
// are always checked during an app access. // are always checked during an app access.
const permission = `fs:${subject.uid}:write`; const PERMS = action === 'write' ? ['read', 'write'] : ['read'];
const svc_permission = Context.get('services').get('permission'); for ( const perm of PERMS ) {
await svc_permission.grant_user_app_permission( const permission = `fs:${subject.uid}:${perm}`;
actor, app.uid, permission, {}, { reason: 'open_item' } const svc_permission = Context.get('services').get('permission');
); await svc_permission.grant_user_app_permission(
actor, app.uid, permission, {}, { reason: 'open_item' }
);
}
// Generate user-app token // Generate user-app token
const svc_auth = Context.get('services').get('auth'); const svc_auth = Context.get('services').get('auth');

View File

@ -168,7 +168,7 @@ async function UIDesktop(options){
let round_icon = false; let round_icon = false;
if(notification.template === "file-shared-with-you" && notification.fields?.username){ if(notification.template === "file-shared-with-you" && notification.fields?.username){
let profile_pic = await get_profile_picture(notification.fields.username); let profile_pic = await get_profile_picture(notification.fields?.username);
if(profile_pic){ if(profile_pic){
icon = profile_pic; icon = profile_pic;
round_icon = true; round_icon = true;
@ -208,16 +208,26 @@ async function UIDesktop(options){
}); });
window.__already_got_unreads = false; window.__already_got_unreads = false;
window.socket.on('notif.unreads', ({ unreads }) => { window.socket.on('notif.unreads', async ({ unreads }) => {
if ( window.__already_got_unreads ) return; if ( window.__already_got_unreads ) return;
window.__already_got_unreads = true; window.__already_got_unreads = true;
for ( const notif_info of unreads ) { for ( const notif_info of unreads ) {
const notification = notif_info.notification; const notification = notif_info.notification;
const icon = window.icons[notification.icon]; let icon = window.icons[notification.icon];
let round_icon = false;
if(notification.template === "file-shared-with-you" && notification.fields?.username){
let profile_pic = await get_profile_picture(notification.fields?.username);
if(profile_pic){
icon = profile_pic;
round_icon = true;
}
}
UINotification({ UINotification({
icon, icon,
round_icon,
title: notification.title, title: notification.title,
text: notification.text ?? notification.title, text: notification.text ?? notification.title,
uid: notif_info.uid, uid: notif_info.uid,
@ -233,6 +243,18 @@ async function UIDesktop(options){
}), }),
}); });
}, },
click: async (notif) => {
if(notification.template === "file-shared-with-you"){
let item_path = '/' + notification.fields?.username;
UIWindow({
path: '/' + notification.fields?.username,
title: path.basename(item_path),
icon: await item_icon({is_dir: true, path: item_path}),
is_dir: true,
app: 'explorer',
});
}
},
}); });
} }
}); });
@ -1282,7 +1304,33 @@ async function UIDesktop(options){
.then(response => response.json()) .then(response => response.json())
.then(data => { .then(data => {
if(data && data.result && data.result.length > 0){ if(data && data.result && data.result.length > 0){
data.data?.forEach(notification => { data.data?.forEach(async notification => {
let icon = window.icons['puter-logo.svg'];
let round_icon = false;
if(notification.template === "file-shared-with-you" && notification.fields?.username){
let profile_pic = await get_profile_picture(notification.fields?.username);
if(profile_pic){
icon = profile_pic;
round_icon = true;
notification.round_icon = round_icon;
}
}
notification.icon = icon;
notification.click = async (notif) => {
if(notification.template === "file-shared-with-you"){
let item_path = '/' + notification.fields?.username;
UIWindow({
path: '/' + notification.fields?.username,
title: path.basename(item_path),
icon: await item_icon({is_dir: true, path: item_path}),
is_dir: true,
app: 'explorer',
});
}
}
UINotification(notification); UINotification(notification);
}) })
} }

View File

@ -347,23 +347,20 @@ const br = {
"login2fa_recovery_back": "Voltar", "login2fa_recovery_back": "Voltar",
"login2fa_recovery_placeholder": "XXXXXXXX", "login2fa_recovery_placeholder": "XXXXXXXX",
// *********************************** "change": "Alterar", // In English: "Change"
// Missing translations "clock_visibility": "Visibilidade do relógio", // In English: "Clock Visibility"
// *********************************** "reading": "Lendo %strong%", // In English: "Reading %strong%"
"change": undefined, // In English: "Change" "writing": "Escrevendo %strong%", // In English: "Writing %strong%"
"clock_visibility": undefined, // In English: "Clock Visibility" "unzipping": "Descompactando %strong%", // In English: "Unzipping %strong%"
"reading": undefined, // In English: "Reading %strong%" "sequencing": "Sequenciando %strong%", // In English: "Sequencing %strong%"
"writing": undefined, // In English: "Writing %strong%" "zipping": "Compactando %strong%", // In English: "Zipping %strong%"
"unzipping": undefined, // In English: "Unzipping %strong%" "Editor": "Editor", // In English: "Editor"
"sequencing": undefined, // In English: "Sequencing %strong%" "Viewer": "Visualizador", // In English: "Viewer"
"zipping": undefined, // In English: "Zipping %strong%" "People with access": "Pessoas com acesso", // In English: "People with access"
"Editor": undefined, // In English: "Editor" "Share With…": "Compartilhar com...", // In English: "Share With…"
"Viewer": undefined, // In English: "Viewer" "Owner": "Proprietário", // In English: "Owner"
"People with access": undefined, // In English: "People with access" "You can't share with yourself.": "Vocẽ não pode compartilhar com você mesmo", // In English: "You can't share with yourself."
"Share With…": undefined, // In English: "Share With…" "This user already has access to this item": "Esse usuário já tem acesso a esse item", // In English: "This user already has access to this item"
"Owner": undefined, // In English: "Owner"
"You can't share with yourself.": undefined, // In English: "You can't share with yourself."
"This user already has access to this item": undefined, // In English: "This user already has access to this item"
} }
}; };

View File

@ -347,24 +347,21 @@ const vi = {
login2fa_recovery_back: 'Quay lại', login2fa_recovery_back: 'Quay lại',
login2fa_recovery_placeholder: 'XXXXXXXX', login2fa_recovery_placeholder: 'XXXXXXXX',
// *********************************** "change": 'Thay đổi', // In English: "Change"
// Missing translations "clock_visibility": 'ẩn/hiện đồng hồ', // In English: "Clock Visibility"
// *********************************** "plural_suffix": 'các', // In English: "s"
"change": undefined, // In English: "Change" "reading": 'Đang đọc %strong%', // In English: "Reading %strong%"
"clock_visibility": undefined, // In English: "Clock Visibility" "writing": 'Đang ghi dữ liệu %strong%', // In English: "Writing %strong%"
"plural_suffix": undefined, // In English: "s" "unzipping": 'Đang giải nén %strong%', // In English: "Unzipping %strong%"
"reading": undefined, // In English: "Reading %strong%" "sequencing": 'Đang đánh thứ tự %strong%', // In English: "Sequencing %strong%"
"writing": undefined, // In English: "Writing %strong%" "zipping": 'Đang nén %strong%', // In English: "Zipping %strong%"
"unzipping": undefined, // In English: "Unzipping %strong%" "Editor": 'Người chỉnh sửa', // In English: "Editor"
"sequencing": undefined, // In English: "Sequencing %strong%" "Viewer": 'Người xem', // In English: "Viewer"
"zipping": undefined, // In English: "Zipping %strong%" "People with access": 'Người dùng có quyền truy cập', // In English: "People with access"
"Editor": undefined, // In English: "Editor" "Share With…": 'Chia sẻ với...', // In English: "Share With…"
"Viewer": undefined, // In English: "Viewer" "Owner": 'Người sở hữu', // In English: "Owner"
"People with access": undefined, // In English: "People with access" "You can't share with yourself.": 'Bạn không thể tự chia sẻ với chính mình', // In English: "You can't share with yourself."
"Share With…": undefined, // In English: "Share With…" "This user already has access to this item": 'Người dùng này đã có sẵn quyền truy cập cho mục này', // In English: "This user already has access to this item"
"Owner": undefined, // In English: "Owner"
"You can't share with yourself.": undefined, // In English: "You can't share with yourself."
"This user already has access to this item": undefined, // In English: "This user already has access to this item"
} }
}; };

View File

@ -346,23 +346,20 @@ const zhtw = {
login2fa_recovery_back: '返回', login2fa_recovery_back: '返回',
login2fa_recovery_placeholder: 'XXXXXXXX', login2fa_recovery_placeholder: 'XXXXXXXX',
// *********************************** "change": '更改', // In English: "Change"
// Missing translations "clock_visibility": '時鐘可視性', // In English: "Clock Visibility"
// *********************************** "reading": '正在讀取 %strong%', // In English: "Reading %strong%"
"change": undefined, // In English: "Change" "writing": '正在寫入 %strong%', // In English: "Writing %strong%"
"clock_visibility": undefined, // In English: "Clock Visibility" "unzipping": '正在解壓 %strong%', // In English: "Unzipping %strong%"
"reading": undefined, // In English: "Reading %strong%" "sequencing": '正在排序 %strong%', // In English: "Sequencing %strong%"
"writing": undefined, // In English: "Writing %strong%" "zipping": '正在壓縮 %strong%', // In English: "Zipping %strong%"
"unzipping": undefined, // In English: "Unzipping %strong%" "Editor": '編輯器', // In English: "Editor"
"sequencing": undefined, // In English: "Sequencing %strong%" "Viewer": '檢視者', // In English: "Viewer"
"zipping": undefined, // In English: "Zipping %strong%" "People with access": '有權限的人', // In English: "People with access"
"Editor": undefined, // In English: "Editor" "Share With…": '分享給……', // In English: "Share With…"
"Viewer": undefined, // In English: "Viewer" "Owner": '所有者', // In English: "Owner"
"People with access": undefined, // In English: "People with access" "You can't share with yourself.": '您不能與自己分享。', // In English: "You can't share with yourself."
"Share With…": undefined, // In English: "Share With…" "This user already has access to this item": '該用戶已有訪問此項的權限', // In English: "This user already has access to this item"
"Owner": undefined, // In English: "Owner"
"You can't share with yourself.": undefined, // In English: "You can't share with yourself."
"This user already has access to this item": undefined, // In English: "This user already has access to this item"
} }
}; };