Files
Leeksov 4647310322 GLEGram 12.5 — Initial public release
Based on Swiftgram 12.5 (Telegram iOS 12.5).
All GLEGram features ported and organized in GLEGram/ folder.

Features: Ghost Mode, Saved Deleted Messages, Content Protection Bypass,
Font Replacement, Fake Profile, Chat Export, Plugin System, and more.

See CHANGELOG_12.5.md for full details.
2026-04-06 09:48:12 +03:00

38 lines
1.8 KiB
Swift
Executable File
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// MARK: Swiftgram Plugin bridge (Swift Python runtime for exteraGram .plugin files)
//
// This module provides a bridge to run or query exteraGram-style .plugin files (Python).
// - Default: metadata and settings detection via regex (PluginMetadataParser), works on iOS/macOS.
// - Optional: when PythonKit (https://github.com/pvieito/PythonKit) is available, use
// PythonPluginRuntime to execute plugin code in a sandbox and read metadata from Python.
//
// swift-bridge (https://github.com/chinedufn/swift-bridge) is for RustSwift; for SwiftPython
// we use PythonKit. This protocol allows swapping implementations (regex-only vs PythonKit).
import Foundation
/// Runtime used to parse or execute .plugin file content (exteraGram Python format).
public protocol PluginRuntime: Sendable {
/// Parses plugin metadata (__name__, __id__, __description__, etc.) from file content.
func parseMetadata(content: String) -> PluginMetadata?
/// Returns true if the plugin defines create_settings or __settings__ = True.
func hasCreateSettings(content: String) -> Bool
}
/// Default implementation using regex-based parsing (no Python required). Works on iOS and macOS.
public final class DefaultPluginRuntime: PluginRuntime, @unchecked Sendable {
public static let shared = DefaultPluginRuntime()
public init() {}
public func parseMetadata(content: String) -> PluginMetadata? {
PluginMetadataParser.parse(content: content)
}
public func hasCreateSettings(content: String) -> Bool {
PluginMetadataParser.hasCreateSettings(content: content)
}
}
/// Current runtime used by the app. Set to a PythonKit-based runtime when Python is available.
public var currentPluginRuntime: PluginRuntime = DefaultPluginRuntime.shared