Release Vulpes OS 2.7 Preview 25 for Desktop, Android and Pixel 3a

This commit is contained in:
OverSu 2026-11-28 12:20:19 +01:00
commit 3a1fba4efe

View file

@ -1,3 +1,4 @@
import {readVCards} from 'resource://vulpes/host/VCard.sys.mjs';
import {receivedMms} from 'resource://vulpes/services/mms.mjs';
import { authorizePlatform } from 'resource://vulpes/services/platform.mjs';
import {
@ -222,6 +223,7 @@ export class Platform {
return null;
}
if (Services.env.get('VULPES_TUNDRA') === '1') {
if (operation === 'contact') return this.deviceContact(app, params);
if (operation === 'capabilities') return tundraCapabilities(this.runtime.release);
if (operation === 'cameraPreview') return this.nativeCamera.request(actor, params);
if (operation === 'snapshot') return tundraSnapshot();
@ -231,6 +233,10 @@ export class Platform {
if (operation === 'mobileSettings') return tundraRadio('mobileSettings', params);
if (operation === 'bluetooth') return tundraBluetooth(params);
if (['callHistory','ackCallHistory'].includes(operation)) return this.radio(operation, params);
if (operation === 'imei') {
if (!actor.manager.documentURI.filePath.startsWith('/dialer/')) throw Error('PERMISSION_DENIED');
return tundraRadio('imei', {});
}
if (operation === 'dial') return this.radio('dial', params);
if (operation === 'hangup') return tundraRadio('hangup', params);
if (operation === 'calls') return Date.now() - this.lastCallsAt < 1500 ? this.lastCalls : this.radio('calls');
@ -326,7 +332,7 @@ export class Platform {
videos: Ci.nsIFilePicker.filterVideo,
}[kind];
if (filter) picker.appendFilters(filter);
else picker.appendFilter('vCard', '*.vcf');
else picker.appendFilter('vCard', '*.vcf; *.vcard');
if ((await new Promise((resolve) => picker.open(resolve))) !== Ci.nsIFilePicker.returnOK)
throw Error('AbortError');
return multiple
@ -348,32 +354,34 @@ export class Platform {
}
return names;
}
async deviceContact(app, params) {
// Sargo has no microSD slot or desktop file-picker service. Only list
// ordinary vCards from the user's Downloads folder inside the Gaia UI.
if (app.id !== 'communications') throw Error('PERMISSION_DENIED');
const {Downloads} = ChromeUtils.importESModule('resource://gre/modules/Downloads.sys.mjs');
const dir = file(await Downloads.getPreferredDownloadsDirectory());
const files = [];
if (dir.exists() && dir.isDirectory() && !dir.isSymlink()) {
for (const entry of dir.directoryEntries) {
const item = entry.QueryInterface(Ci.nsIFile);
if (/\.(vcf|vcard)$/i.test(item.leafName) && !item.isSymlink() && item.isFile())
files.push(item);
}
}
if (params.action === 'list') return files.map(item=>item.leafName).sort();
const selected = files.find(item=>item.leafName === params.name);
if (params.action !== 'import' || !selected) throw Error('FILE_NOT_FOUND');
return this.importContactFile(app, selected);
}
async contact(actor, app) {
const [item] = await this.select(actor, 'contact');
return this.importContactFile(app, item);
}
async importContactFile(app, item) {
if (item.fileSize > 1024 * 1024) throw Error('QuotaExceededError');
const raw = await IOUtils.readUTF8(item.path);
const lines = raw.replace(/\r?\n[ \t]/g, '').split(/\r?\n/);
const decode = (s) => s.replace(/\\n/gi, '\n').replace(/\\([,;\\])/g, '$1');
const value = { name: [], tel: [], email: [] };
let inside = false;
for (const line of lines) {
if (line.toUpperCase() === 'BEGIN:VCARD') {
inside = true;
continue;
}
if (line.toUpperCase() === 'END:VCARD') break;
if (!inside) continue;
const i = line.indexOf(':');
if (i < 0) continue;
const key = line.slice(0, i).split(';')[0].toUpperCase(),
v = decode(line.slice(i + 1));
if (key === 'FN') value.name = [v];
if (key === 'TEL') value.tel.push({ value: v.replace(/^tel:/, ''), type: ['other'] });
if (key === 'EMAIL') value.email.push({ value: v, type: ['other'] });
}
if (!value.name.length && !value.tel.length && !value.email.length)
throw Error('InvalidModificationError');
return this.runtime.contacts.request(app, { operation: 'save', contact: value });
const cards = readVCards(raw);
return this.runtime.contacts.importCards(app, cards);
}
async capture(actor, app) {
if (!app.manifest.permissions?.['device-storage:pictures']?.access?.includes('write'))