Skip to content

Commit

Permalink
Merge pull request #25 from fosslife/feature
Browse files Browse the repository at this point in the history
hotfix: remove image as it's breaking
  • Loading branch information
Sparkenstein authored Sep 20, 2022
2 parents e0b4d53 + 03b2359 commit ec8647f
Show file tree
Hide file tree
Showing 16 changed files with 10 additions and 16,281 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ rest of the features are pretty straightforward.

DevTools-X comes with following features (with demo video):

### Image Compressor with preview
### Image Compressor with preview [REMOVED TEMPORARILY]

https://user-images.githubusercontent.com/24642451/184826392-6378ee66-187b-4bf0-8c08-fcacbb3836c1.mp4

Expand Down
88 changes: 0 additions & 88 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,94 +4,6 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite App</title>
<!-- VIPS -->
<script src="./src/vips/vips.js"></script>
<script type="module">
window.vips = await Vips({
print: (stdout) => console.log(stdout.replace(/\033\[[0-9;]*m/g, "")),
preRun: (module) => {
return;
module.ENV.VIPS_INFO = "1";
// FIXME: not require preload
// module.FS.createPreloadedFile(
// "/",
// "owl.jpg",
// "/owl.jpg",
// true,
// false
// );
},
postRun: (module) => {
return;
const pad = 30;
const have = (name) =>
module.Utils.typeFind("VipsOperation", name) !== 0;

console.log("vips version:".padEnd(pad), module.version());
console.log(
"Emscripten version:".padEnd(pad),
module.emscriptenVersion()
);
//console.log(module.config());
console.log("Concurrency:".padEnd(pad), module.concurrency());

console.log("Cache max mem:".padEnd(pad), module.Cache.maxMem());
console.log("Cache max operations:".padEnd(pad), module.Cache.max());
console.log(
"Cache current operations:".padEnd(pad),
module.Cache.size()
);
console.log(
"Cache max open files:".padEnd(pad),
module.Cache.maxFiles()
);

console.log(
"Memory allocations:".padEnd(pad),
module.Stats.allocations()
);
console.log(
"Memory currently allocated:".padEnd(pad),
module.Stats.mem()
);
console.log(
"Memory high water:".padEnd(pad),
module.Stats.memHighwater()
);
console.log("Open files:".padEnd(pad), module.Stats.files());

console.log(
"JPEG support:".padEnd(pad),
have("jpegload") ? "yes" : "no"
);
console.log(
"PNG support:".padEnd(pad),
have("pngload") ? "yes" : "no"
);
console.log(
"TIFF support:".padEnd(pad),
have("tiffload") ? "yes" : "no"
);
console.log(
"WebP support:".padEnd(pad),
have("webpload") ? "yes" : "no"
);
console.log(
"GIF support:".padEnd(pad),
have("gifload") ? "yes" : "no"
);

console.log("SVG load:".padEnd(pad), have("svgload") ? "yes" : "no");

console.log(
"Text rendering support:".padEnd(pad),
have("text") ? "yes" : "no"
);

window.parent.postMessage("vipsInitialized", "*");
},
});
</script>
<!-- React-editor -->
<script>
const global = globalThis;
Expand Down
5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "dev-tools",
"version": "1.7.0",
"version": "1.7.1",
"license": "MIT",
"scripts": {
"start": "tauri dev",
Expand Down Expand Up @@ -39,8 +39,7 @@
"react-icons": "^4.4.0",
"react-live": "^2.4.1",
"react-router-dom": "6.4.0",
"simple-base-converter": "^1.0.16",
"wasm-vips": "^0.0.3"
"simple-base-converter": "^1.0.16"
},
"devDependencies": {
"@tauri-apps/cli": "^1.1.1",
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "app"
version = "1.7.0"
version = "1.7.1"
description = "Developer tools desktop application"
authors = [ "Sparkenstein" ]
license = "MIT"
Expand Down
46 changes: 1 addition & 45 deletions src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,8 @@
windows_subsystem = "windows"
)]

use std::collections::HashMap;
use std::convert::TryInto;
use std::env;
use tauri::{
http::header::HeaderValue,
utils::config::{Csp, CspDirectiveSources},
Manager, WindowBuilder, WindowUrl,
};
use tauri::{Manager, WindowBuilder, WindowUrl};

fn main() {
tauri::Builder::default()
Expand All @@ -20,44 +14,6 @@ fn main() {
.inner_size(1000.0, 650.0)
.resizable(true)
.fullscreen(false)
.on_web_resource_request(|request, response| {
// println!("Request {:?}\n\n", req.headers());
// println!("Response {:?}\n\n", res.headers());

// FIXME:
if request.uri().starts_with("tauri://") {
// if we have a CSP header, Tauri is loading an HTML file
// for this example, let's dynamically change the CSP
if let Some(csp) = response.headers_mut().get_mut("Content-Security-Policy") {
// use the tauri helper to parse the CSP policy to a map
let mut csp_map: HashMap<String, CspDirectiveSources> =
Csp::Policy(csp.to_str().unwrap().to_string()).into();
csp_map
.entry("script-src".to_string())
.or_insert_with(Default::default)
.push("https: 'unsafe-eval' 'unsafe-inline'");

csp_map.insert(
"worker-src".to_string(),
CspDirectiveSources::Inline("'self' blob: https://tauri.localhost/".to_string()), // "'self' blob: https://tauri.localhost/",
);

// use the tauri helper to get a CSP string from the map
let csp_string = Csp::from(csp_map).to_string();

*csp = HeaderValue::from_str(&csp_string).unwrap();
}
}

response.headers_mut().insert(
"Cross-Origin-Embedder-Policy",
"require-corp".try_into().unwrap(),
);
response.headers_mut().append(
"Cross-Origin-Opener-Policy",
"same-origin".try_into().unwrap(),
);
})
.build()?;
// #[cfg(debug_assertions)]
let process_arg: Vec<String> = env::args().collect();
Expand Down
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"package": {
"productName": "dev-tools",
"version": "1.7.0"
"version": "1.7.1"
},
"build": {
"distDir": "../dist",
Expand Down
4 changes: 2 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Markdown = loadable(() => import("./Features/markdown/Markdown"));
const YamlJson = loadable(() => import("./Features/yaml-json/Yaml"));
const Pastebin = loadable(() => import("./Features/pastebin/Pastebin"));
const Repl = loadable(() => import("./Features/repl/Repl"));
const Image = loadable(() => import("./Features/image/Image"));
// const Image = loadable(() => import("./Features/image/Image"));
const Playground = loadable(() => import("./Features/playground/Playground"));
const Rest = loadable(() => import("./Features/rest/Rest"));
const UnitConverter = loadable(
Expand Down Expand Up @@ -139,7 +139,7 @@ function App() {
<Route path="/yamljson" element={<YamlJson />}></Route>
<Route path="/pastebin" element={<Pastebin />}></Route>
<Route path="/repl" element={<Repl />}></Route>
<Route path="/image" element={<Image />}></Route>
{/* <Route path="/image" element={<Image />}></Route> */}
<Route path="/units" element={<UnitConverter />}></Route>
<Route path="/playground" element={<Playground />}></Route>
<Route path="/rest" element={<Rest />}></Route>
Expand Down
Loading

0 comments on commit ec8647f

Please sign in to comment.