-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Lower browsers to level 1, begin setting up for refactor
Browser profiles have been lowered to level 1 to allow hardware keys to function (#14) and I've began setting up for a code refactor All databases will be moved out of the code directly, into JSON files where it'll be much easier to maintain and audit
- Loading branch information
Showing
24 changed files
with
546 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
{ | ||
"TODO": "Read this file in isspooky.go", | ||
"paths": [ | ||
"/", | ||
"/etc", | ||
"/home", | ||
"${HOME}", | ||
"${HOME}/.profile", | ||
"${HOME}/.bashrc", | ||
"${HOME}/.zshrc" | ||
], | ||
"trees": [ | ||
"${HOME}/apps", | ||
"${HOME}/Apps", | ||
"${HOME}/AppImages", | ||
"${HOME}/appimages", | ||
"${HOME}/Applications", | ||
"${HOME}/applications", | ||
"${HOME}/go", | ||
"${HOME}/.ssh", | ||
"${HOME}/.vim", | ||
"${HOME}/.gnupg", | ||
"${HOME}/.firefox", | ||
"${HOME}/.mozilla", | ||
"$HOME/.cache", | ||
"$HOME/.local", | ||
"$HOME/.config", | ||
"/run", | ||
"/tmp", | ||
"${XDG_CACHE_DIR}", | ||
"${XDG_DATA_DIR}", | ||
"${XDG_CONFIG_DIR}", | ||
"${XDG_RUNTIME_DIR}", | ||
"${TMPDIR}" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Currently undergoing a re-write that will prioritize simplicity |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,145 +1,46 @@ | ||
const std = @import("std"); | ||
|
||
pub const LinkOptions = struct { | ||
enable_zstd: bool = true, | ||
enable_lz4: bool = true, | ||
enable_lzo: bool = false, | ||
enable_zlib: bool = true, | ||
enable_xz: bool = true, | ||
|
||
enable_fuse: bool = true, | ||
use_system_fuse: bool = true, | ||
|
||
use_libdeflate: bool = true, | ||
}; | ||
|
||
// Although this function looks imperative, note that its job is to | ||
// declaratively construct a build graph that will be executed by an external | ||
// runner. | ||
pub fn build(b: *std.Build) void { | ||
// Standard target options allows the person running `zig build` to choose | ||
// what target to build for. Here we do not override the defaults, which | ||
// means any target is allowed, and the default is native. Other options | ||
// for restricting supported target set are available. | ||
const target = b.standardTargetOptions(.{}); | ||
|
||
// Standard optimization options allow the person running `zig build` to select | ||
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. Here we do not | ||
// set a preferred release mode, allowing the user to decide how to optimize. | ||
const optimize = b.standardOptimizeOption(.{}); | ||
|
||
const lib_options = b.addOptions(); | ||
lib_options.addOption(bool, "enable_xz", true); | ||
//lib_options.addOption(bool, "enable_zlib", true); | ||
//lib_options.addOption(bool, "use_libdeflate", false); | ||
lib_options.addOption(bool, "enable_lzo", false); | ||
lib_options.addOption(bool, "enable_lz4", true); | ||
lib_options.addOption(bool, "enable_zstd", true); | ||
lib_options.addOption(bool, "use_zig_zstd", false); | ||
|
||
const lib = b.addStaticLibrary(.{ | ||
.name = "aisap", | ||
// In this case the main source file is merely a path, however, in more | ||
// complicated build scripts, this could be a generated file. | ||
.root_source_file = b.path("lib/c_api.zig"), | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
|
||
lib.addIncludePath(b.path("../include")); | ||
|
||
// const known_folders_module = b.addModule("known-folders", .{ | ||
// .root_source_file = b.path("known-folders/known-folders.zig"), | ||
// }); | ||
|
||
const squashfuse_dep = b.dependency("squashfuse", .{ | ||
.target = target, | ||
.optimize = optimize, | ||
|
||
// These options will be renamed in the future | ||
.@"enable-fuse" = true, | ||
.@"enable-zlib" = true, | ||
//.@"use-zig-zlib" = true, | ||
.@"use-libdeflate" = true, | ||
.@"enable-xz" = true, | ||
.@"enable-lzma" = true, | ||
.@"enable-lzo" = false, | ||
.@"enable-lz4" = true, | ||
.@"enable-zstd" = true, | ||
}); | ||
|
||
const fuse_dep = b.dependency("fuse", .{ | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
|
||
const known_folders_dep = b.dependency("known_folders", .{ | ||
.target = target, | ||
.optimize = optimize, | ||
.zlib_decompressor = .libdeflate_static, | ||
.zstd_decompressor = .libzstd_static, | ||
.lz4_decompressor = .liblz4_static, | ||
.xz_decompressor = .liblzma_static, | ||
}); | ||
|
||
lib.root_module.addImport( | ||
"squashfuse", | ||
squashfuse_dep.module("squashfuse"), | ||
); | ||
|
||
lib.root_module.addImport( | ||
"known-folders", | ||
known_folders_dep.module("known-folders"), | ||
); | ||
|
||
_ = b.addModule("aisap", .{ | ||
.root_source_file = b.path("lib.zig"), | ||
const aisap_module = b.addModule("aisap", .{ | ||
.root_source_file = b.path("lib/AppImage.zig"), | ||
.imports = &.{ | ||
.{ | ||
.name = "squashfuse", | ||
.module = squashfuse_dep.module("squashfuse"), | ||
}, | ||
.{ | ||
.name = "known-folders", | ||
.module = known_folders_dep.module("known-folders"), | ||
}, | ||
.{ | ||
.name = "fuse", | ||
.module = fuse_dep.module("fuse"), | ||
}, | ||
}, | ||
}); | ||
|
||
lib.root_module.addImport( | ||
"fuse", | ||
fuse_dep.module("fuse"), | ||
); | ||
|
||
// lib.root_module.addImport("known-folders", known_folders_module); | ||
|
||
// const pie = b.option(bool, "pie", "build as a PIE (position independent executable)") orelse true; | ||
// lib.pie = pie; | ||
|
||
lib.linkLibC(); | ||
|
||
// This declares intent for the library to be installed into the standard | ||
// location when the user invokes the "install" step (the default step when | ||
// running `zig build`). | ||
b.installArtifact(lib); | ||
b.installArtifact(squashfuse_dep.artifact("deflate")); | ||
b.installArtifact(squashfuse_dep.artifact("zstd")); | ||
b.installArtifact(squashfuse_dep.artifact("lz4")); | ||
b.installArtifact(fuse_dep.artifact("fuse")); | ||
|
||
// Creates a step for unit testing. This only builds the test executable | ||
// but does not run it. | ||
const main_tests = b.addTest(.{ | ||
.root_source_file = b.path("lib.zig"), | ||
const exe = b.addExecutable(.{ | ||
.name = "aisap", | ||
.root_source_file = b.path("src/main.zig"), | ||
.target = target, | ||
.optimize = optimize, | ||
}); | ||
|
||
const run_main_tests = b.addRunArtifact(main_tests); | ||
exe.linkLibC(); | ||
|
||
exe.root_module.addImport( | ||
"aisap", | ||
aisap_module, | ||
); | ||
|
||
exe.linkLibrary(squashfuse_dep.artifact("zstd")); | ||
exe.linkLibrary(squashfuse_dep.artifact("deflate")); | ||
//exe.linkLibrary(squashfuse_dep.artifact("deflate")); | ||
|
||
// This creates a build step. It will be visible in the `zig build --help` menu, | ||
// and can be selected like this: `zig build test` | ||
// This will evaluate the `test` step rather than the default, which is "install". | ||
const test_step = b.step("test", "Run library tests"); | ||
test_step.dependOn(&run_main_tests.step); | ||
b.installArtifact(exe); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,20 @@ | ||
.{ | ||
.name = "aisap", | ||
.version = "0.10.2-alpha", | ||
.paths = [][]const u8 {""}, | ||
.version = "0.10.3-alpha", | ||
.minimum_zig_version = "0.13.0", | ||
|
||
.dependencies = .{ | ||
.squashfuse = .{ | ||
.url = "https://github.com/mgord9518/squashfuse-zig/archive/refs/tags/continuous.tar.gz", | ||
.hash = "12209f047e1b7dcaaa3335cb2ae4167b1062f308c409d8be24ce99edd17e1a0fc7d1", | ||
}, | ||
.fuse = .{ | ||
.url = "https://github.com/mgord9518/libfuse-zig/archive/refs/tags/continuous.tar.gz", | ||
.hash = "12205592f7dc4b4c7256abd657a50bd9784459a0e9b8bfe8b0d1bbcc153a6d0f650a", | ||
}, | ||
.known_folders = .{ | ||
.url = "https://github.com/ziglibs/known-folders/archive/cdcc6137ed2e92096b27d394db917d1861f156b3.tar.gz", | ||
.hash = "1220863f0fc3e97cfd47a8edb28c7a3d109c42143235042fb513207b5c5a032fb93f", | ||
.hash = "1220e783b731a8fb6825fc1e2652ccd56890b8d7451d668064ed85b2fbddb790f8fa", | ||
}, | ||
}, | ||
|
||
.paths = .{ | ||
"build.zig", | ||
"build.zig.zon", | ||
"src", | ||
"lib", | ||
"README.md", | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const std = @import("std"); | ||
const testing = std.testing; | ||
const squashfuse = @import("squashfuse"); | ||
const SquashFs = squashfuse.SquashFs; | ||
|
||
pub const AppImage = @This(); | ||
|
||
sqfs: SquashFs, | ||
kind: Kind, | ||
allocator: std.mem.Allocator, | ||
|
||
pub const Kind = enum { | ||
shimg, | ||
type1, | ||
type2, | ||
}; | ||
|
||
pub fn open(allocator: std.mem.Allocator, path: []const u8) !AppImage { | ||
const cwd = std.fs.cwd(); | ||
const file = try cwd.openFile(path, .{}); | ||
|
||
std.debug.print("offset {d}\n", .{try offsetFromElf(file)}); | ||
|
||
return .{ | ||
.sqfs = undefined, | ||
.kind = undefined, | ||
.allocator = allocator, | ||
}; | ||
} | ||
|
||
pub fn close(appimage: *AppImage) void { | ||
_ = appimage; | ||
return; | ||
} | ||
|
||
fn offsetFromElf(file: std.fs.File) !u64 { | ||
const header = try std.elf.Header.read(file); | ||
|
||
return header.shoff + (header.shentsize * header.shnum); | ||
} | ||
|
||
//fn offsetFromShimg(path: []const u8) u64 {} |
Oops, something went wrong.