Giter Club home page Giter Club logo

socketsupply / socket Goto Github PK

View Code? Open in Web Editor NEW
1.5K 25.0 66.0 35.84 MB

A cross-platform runtime for Web developers to build desktop & mobile apps for any OS using any frontend library.

Home Page: https://socketsupply.co/guides

License: Other

PowerShell 1.49% Shell 4.84% C++ 39.05% Hack 2.47% Objective-C++ 2.28% Kotlin 2.80% JavaScript 43.26% Vim Script 0.01% HTML 0.09% C 3.64% Makefile 0.09%
bluetooth cross-platform javascript localfirst p2p runtime udp ui android nodejs

socket's Introduction

image

Description

Web Developers use Socket runtime to create apps for any OS, desktop, and mobile. You can use plain old HTML, CSS, and JavaScript, as well as your favorite front-end libraries like Next.js, React, Svelte, or Vue.

The Socket runtime CLI outputs hybrid native-web apps that combine your code with the runtime. Your code is rendered using the OS's native "WebView" component. Platform features are implemented natively and made available to the JavaScript environment in a way that is secure and fully sandboxed on every platform. Native APIs like Bluetooth and UDP make local-first and peer-to-peer software design patterns as first class considerations.

Features

  • Any backend — Business logic can be written in any language, Python, Rust, Node.js, etc. The backend is even completely optional.
  • Any frontend — Use your favorite frontend framework to create your UIs: React, Svelte, Vue, and more.
  • Batteries Included — Native Add-ons are supported, but we ship everything you need for the majority of use cases.
  • Local-first — A full-featured, familiar File system API, native add-ons and full cross platform support for Bluetooth.
  • Not just Cloud — P2P helps you reliably move work out of the cloud, beyond the edge, and onto the devices that can communicate directly with each other.
  • Maintainable — Socket runtime has Zero external dependencies, and a smaller code base than any other competing project.
  • Lean & Fast — Socket runtime has a smaller memory footprint and creates smaller binaries than any other competing project.

Compatibility Matrix

Note

Socket supports many of the Node.js APIs. It is NOT a drop in replacement for Node.js, nor will it ever be since socket is for building software and node.js is for building servers. Below is a high level overview of partially supported APIs and modules.

Module Node.js Socket
assert ✔︎
async/await ✔︎ ✔︎
buffer ✔︎ ✔︎️
child_process ✔︎ ✔︎️ *
console ✔︎ ✔︎
crypto ✔︎ ✔︎ *
dgram ✔︎ ✔︎️
dns ✔︎ ✔︎️
os ✔︎ ✔︎️
encoding ✔︎ ✔︎
events ✔︎ ✔︎
fetch ✔︎ ✔︎
fs/promises ✔︎ ✔︎
fs ✔︎ ✔︎
path ✔︎ ✔︎
process ✔︎ ✔︎
streams ✔︎ ✔︎
string_decoder ✔︎
test ✔︎ ✔︎️
timers ✔︎
uuid ✔︎
vm ✔︎ ✔︎
ESM ✔︎ ✔︎
CJS ✔︎ ✔︎
URL ✔︎ ✔︎

⏱ = planned support * = Supported but Works differently; may be refactored to match the nodejs API ** = Use fetch instead

FAQ

Check the FAQs on our Website to learn more.

Building your first Socket app!

Create Socket App is similar to React's Create React App, we provide a few basic boilerplates and some strong opinions so you can get coding on a production-quality app as quickly as possible.
Please check create-socket-app Repo to get started and to learn more.
You can also check our Examples in the Examples Repo.

Documentation

The full documentation can be found on the Socket Runtime website.
The Socket Runtime documentation covers Socket APIs, includes examples, multiple guides (Apple, Desktop, and Mobile), P2P documentation, and more.

Testing

Socket provides a built-in test runner similar to node:test which outputs the test results in TAP format. You can also check test/ for the unit and integration test suite.

Contributing

We welcome contributions from everyone! Please check our Contribution Guide to learn more. Don't hesitate to stop by Discord and ask the team about your issue and if someone is already working on it.
Please connect with any current project contributors: @heapwolf, @jwerle, and @chicoxyzzy if you want to contribute to the Socket Runtime project itself.
Thank you for your interest in reporting/fixing issues and contributing to Socket!

socket's People

Contributors

aleclarson avatar atternatt avatar bcomnes avatar beeburrt avatar chicoxyzzy avatar coffeejunk avatar dominictarr avatar getify avatar heapwolf avatar humanshell avatar iefserge avatar jstarpl avatar jwerle avatar lamiazar avatar maaznadeem246 avatar missinglink avatar mribbons avatar nnnnathann avatar numonium avatar raynos avatar trevnorris avatar wujekbizon avatar yashdiniz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

socket's Issues

How to communicate between windows?

I have a couple questions here.

  1. Suppose I have a SQLite database and a multi-window application. SQLite needs to be running in a single process and shared amongst the windows. I see system.send and system.receive but I'm not sure how to specify a single process just for SQLite.
  2. Is it possible to manage windows more granularly? Suppose I want to open a separate "help" window. Ideally, I could launch a window with some args to the renderer or something.

Can you please add some detail documentation on Installation?

I watched the talk show at NodeConf EU 2022 and loved the idea so I was here to try it out but was unable to get it set up on my windows machine.

I followed the instruction but the compilation was unsuccessful. I think i am short on some packages so can you please add some detail instruction and requirements to get it setup?.

not ok - the build tool failed to compile.

Powershell Screenshot

install.sh compiler test doesn't work on windows

clang++ -x c++ - -Wno-unused-command-line-argument -stdlib=libstdc++ -std=c++2a -I/d/code/socket/socket/include -I/d/code/socket/socket/build/uv/include -I/d/code/socket/socket/build/include -I/d/code/socket/socket/ 
src -DSSC_BUILD_TIME=1675680133 -DSSC_VERSION_HASH=62576ab -DSSC_VERSION=0.1.0 -D_MT -D_DLL -DWIN32 -DWIN32_LEAN_AND_MEAN -Xlinker /NODEFAULTLIB:libcmt -Wno-nonportable-include-path -g -O0 < build/main.cc
--9b07f4.o : error LNK2019: unresolved external symbol atexit referenced in function "void __cdecl SSC::`dynamic initializer for 'platform''(void)" (??__Eplatform@SSC@@YAXXZ)
--9b07f4.o : error LNK2019: unresolved external symbol memcpy referenced in function "protected: void __cdecl std::time_get<char,class std::istreambuf_iterator<char,struct std::char_traits<char> > >::_Getvals<wchar_t>(wchar_t,class std::_Locinfo const &)" (??$_Getvals@_W@?$time_get@DV?$istreambuf_iterator@DU?$char_traits@D@std@@@std@@@std@@IEAAX_WAEBV_Locinfo@1@@Z)
--9b07f4.o : error LNK2019: unresolved external symbol __imp_wcslen referenced in function "wchar_t * __cdecl std::_Maklocwcs(wchar_t const *)" (?_Maklocwcs@std@@YAPEA_WPEB_W@Z)
--9b07f4.o : error LNK2019: unresolved external symbol __imp_calloc referenced in function "wchar_t * __cdecl std::_Maklocwcs(wchar_t const *)" (?_Maklocwcs@std@@YAPEA_WPEB_W@Z)
--9b07f4.o : error LNK2019: unresolved external symbol "void __cdecl operator delete(void *,unsigned __int64)" (??3@YAXPEAX_K@Z) referenced in function "void __cdecl std::_Deallocate<16,0>(void *,unsigned __int64)" (??$_Deallocate@$0BA@$0A@@std@@YAXPEAX_K@Z)
--9b07f4.o : error LNK2001: unresolved external symbol __CxxFrameHandler3
--9b07f4.o : error LNK2019: unresolved external symbol __std_terminate referenced in function "int `void __cdecl std::_Deallocate<16,0>(void *,unsigned __int64)'::`1'::dtor$4" (?dtor$4@?0???$_Deallocate@$0BA@$0A@@std@@YAXPEAX_K@Z@4HA)
--9b07f4.o : error LNK2019: unresolved external symbol __imp__invalid_parameter_noinfo_noreturn referenced in function "void __cdecl std::_Adjust_manually_vector_aligned(void * &,unsigned __int64 &)" (?_Adjust_manually_vector_aligned@std@@YAXAEAPEAXAEA_K@Z)
LINK : error LNK2001: unresolved external symbol mainCRTStartup
a.exe : fatal error LNK1120: 9 unresolved externals
clang++: error: linker command failed with exit code 1120 (use -v to see invocation)

Move some of Socket APIs out of `window.parent`

Thinking more about keeping all Socket APIs in window.parent, I think that this approach has a few cons:

  • it's not safe to add our own methods and properties to windows.parent, because DOM spec could potentially add methods or properties with the same name
  • keeping these properties in windows.parent could lead to a misconception that they are part of existing specs

I propose to polyfill only methods and properties that exist in the DOM spec and doesn't work in a web view. All other methods and properties should be moved to another safe namespace.

Discussion: Use POST mathod in Socket Runtime IPC

Synopsis

Theoretically, we can simplify our code by using POST method (and possibly RPC?) instead of (or additionally to) GET encoding/decoding URI. This way request body could be of any MIME type like application/json, text/plain, etc. This might be easier, faster and less error prone then using GET and URI parameters. Also, this can help with automatic generation of .d.ts for the Socket API client code or custom JS interfaces for the Socket Runtime.

Example

Lets take the window.setTitle IPC message for example. Currently the Socket IPC is a GET request which looks like this:

ipc://window.setTitle?index=1&window=0&value=Hello%20World!

Note: Hello%20World! is an encoded "Hello World!" string

Here we have to write the code in main.cc by hands, which could be error-prone, especially if there is more parameters with different types and there are multiple parameters which should use decodeURIComponent

Alternative solution is a POST message with a body with a certain content-type:

Request: ipc://window.setTitle
Method: POST
Content-Type: application/json

Body:

{
  "index": 1,
  "window": 0,
  "value": "Hello World!"
}

This is much easier to parse, but has a disadvantage: we need to have a JSON parser in the Socket Runtime.
This is an open question on how we can parse body, but one alternative is using INI parser we already use for the config. In that case request will look like this:

Request: ipc://window.setTitle
Method: POST
Content-Type: text/plain

Body:

index = 1
window = 0
value = "Hello World!"

Typing

We can define a schema to automatically generate TypeScript definitions and possibly C++ code as well. For example we have such schema.json file (could be INI, JSON Schema, etc., I use custom schema in this example):

{
  "window.setTitle": {
    "request": {
      "description": "Sets the window title"
      "properties": {
        "window" : {
          "description": "The window index"
          "optional": true,
          "default": 0,
          "type": "number"
        },
        "value": {
          "description": "The title to be set"
          "optional": false,
          "type": "string"
        }
      }
    }
  }
}

Same way the response could be specified here. This schema can help to generate types for the Socket API, which will include all the methods to use in the window__ipc.postMessage:

type Method =
  | 'window.getStatus'
  | 'window.getTitle'
  ...

and the inferred parameters for all the Method types via TypeScript's infer, so all of window.__ipc.postMessage, socket.ipc.postMessage (or socket.ipc.send, etc), socket.runtime.setTitle and their results are statically typed, have autocomplition and documentation.
This schema could generate the parts of main.cc and/or bridge.cc as well (before the push, w/ the header that this file is autogenerated)

Open questions (besides those I've mentioned earlier)

  • How useful would it be to allow binary MIME types like application/octet-stream, image/gif, audio/mpeg, video/mpeg, etc.?
  • Can we use custom content-type to add support for https://github.com/socketsupply/ltp in future?

Publish '@socketsupply/socket' on NPM (and GH)

There are two options for releasing on npm:

  1. Include all the static libraries for all supported platforms in the npm module.
  2. Post-install script to download the artifacts directly from someplace like S3.
  3. Publish npm modules for each supported architecture and use a post-install script to npm i the module for the specific architecture.

Another consideration is ensuring developers have a comprehensive list of what they need. It's very possible that they npm install ssc just to have building an application fail since they don't have everything necessary.

Proposal: move io module to the Socket Runtime repo

At the moment when we make changes in this repo, we need to update io accordingly. socket-examples doesn't gaurantee that everything works fine. We need to use io to test socket and vice versa. Both should be in sync. If we make this change, we only need one PR in this repo to make sure all tests are passing. After that we can update socket-examples to use most recent versions of socket and io.

Use static assets when building applications

All other platforms use a static build of libuv when building an application using ssc. Windows still compiles everything from scratch.

Add support in Windows for building applications using static libraries instead of building from scratch.

Define the Native API

Discuss the hypothetical native API implementation. Possible features a native API will support are:

  • Register custom methods that are called when ipc:// is intercepted.
  • Metrics gathering
  • Event notifications (like when a new window is open)

Other considerations are if it's possible to lessen the cross-platform pain of native development; how/if allowing native code to run in iOS/Andriod is possible; or how do we allow native extensions to be loaded (e.g. they compile a shared library, and we add a JS API that directs where to load it from).

Automatically log output to known location

Log all output to a known log file. Necessary for two reasons:

  1. Tests in Windows can't read normally from stdout so the log file must be checked for success.
  2. Useful for future bug reports so we can request the log file from the user.

Main question is, where is the log file supposed to go for each platform? I'm most concerned about iOS and Android.

[Feature] Customize allowed orientations on iPhone/iPad

Current defaults are here:

socket/src/cli/templates.hh

Lines 869 to 870 in c6ac97c

INFOPLIST_KEY_UISupportedInterfaceOrientations_iPad = "UIInterfaceOrientationPortrait UIInterfaceOrientationPortraitUpsideDown UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";
INFOPLIST_KEY_UISupportedInterfaceOrientations_iPhone = "UIInterfaceOrientationPortrait UIInterfaceOrientationLandscapeLeft UIInterfaceOrientationLandscapeRight";

Document `ssc.config`

Should have documentation about the file ssc.config — what fields are required, etc.

Crash when running the `ssc` from a 3rd party terminal application

What OS are you using (uname -a, or Windows version)?

$ uname -a
Darwin Julians-MacBook-Pro.fritz.box 21.6.0 Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64 x86_64

macOS 12.6

What programming language are you using (C/C++/Go/Rust)?

$ gcc --version
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ clang --version
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ go version
go version go1.18.4 darwin/amd64
$ rustc --version
zsh: command not found: rustc

What did you expect to see and what you saw instead?

$ cd desktop-node-react
$ ssc compile -r .
• warning! $CXX env var not set, assuming defaults +0ms
• preparing build for mac +9ms
• package prepared +198ms
• ran user build command +138ms
• compiled native binary +30027ms
• Creating Window#0 +2ms
• Creating Window#1 +166ms
• Showing Window#0 (seq=0) +44ms

Screenshot 2022-10-04 at 18 56 14

Full output: https://gist.github.com/juliangruber/96d4d8dab602a2393e53de45c98b295e

Set default value for 'title' field when missing from 'socket.ini'

Currently, I see {{title}} on my Android device for an app I am testing. It isn't defined in socket.ini so this makes sense. Ideally, it should fall back to a default value (name) or be a required field. name currently cannot have white spaces, while title is a friendly name that can include white space and be seen by humans. Which SHOULD require both IMO, or issue a warning that we're falling back to name.

cc @chicoxyzzy @heapwolf

Do not clear another build on `ssc build`

  1. ssc build creates a <builddir>/<os>/<name>-dev.app
  2. ssc build --prod removes <builddir>/<os>/<name>-dev.app and creates a <builddir>/<os>/<name>.app (without -dev suffix)
  3. ssc build removes <builddir>/<os>/<name>.app and creates a <builddir>/<os>/<name>-dev.app

That's a bug. We should have both.

Document exported globals

Currently, socket exports window.__args and window.__ipc. If these are going to be considered public then we should document them.

Ref: #14

Backend process and windows management improvements

We need to remove automatic process.open when we create a new window and call it manually (for the main window in most cases).

Required changes:

  • remove process.open IPC call from the window runtime preload
  • add io.backendProcess.isOpen(): boolean and related method in Socket Runtime
  • add io.backendProcess.open(force?: boolean): void and update related method in Socket Runtime. force will kill old process and open new one
  • add io.backendProcess.kill(): void

We also need to improve windows management from io

  • add io.runtime.navigate({ window, value }: { window: number, value: string }): void

Blank screen using react/svelte boilerplate

Following the docs using a Mac M1 with svelte or react boilerplate I get an empty white screen when running npm start. Vanilla boilerplate works fine.

When inspecting the console (within the white screen) react boilerplate logs:
Not allowed to load local resource: "/path/appname/dist/mac/appname.app/Contents/Resources/index.js"

With svelte I also get an error, but different:
TypeError: 'text/css' is not a valid JavaScript MIME type.

All I do is

  1. xcode-select --install (or install Xcode app).
  2. curl -s -o- https://sockets.sh/sh | bash -s
  3. npx create-socket-app svelte/react
  4. npm start

I have tried

  1. Reinstalling CommandLineTools and replacing it with Xcode app
  2. On two different M1 machines with different OS versions etc. Same issue.

Document IPC XHR API

The ipc:// API needs to be fully documented. Especially since Windows requires using http:// instead of ipc://.

The socket-api repo does exist, but it serves as a complete porcelain API. Not just simple examples of how to use the plumbing IPC commands.

Note: After discussion, it was decided that the IPC XHR API would be kept private for the time being. Making it an officially supported API this early would bring a lot of pain in the future. This should still be documented, but the priority has dropped because of this.

Verify minimal requirements for build

Verify the minimal possible requirements for performing a build in Windows. Will start with a clean system and create a checklist of what's necessary so it can be documented online.

'window.__ipc.postMessage' does not consider the Android implementation

I see this error when testing an application on Android:

VM4:61 Uncaught (in promise) TypeError: Could not determine UserMessageHandler.postMessage in Window
    at Object.value [as postMessage] (<anonymous>:61:13)
    at console.<computed> [as error] (index.js:56115:25)
    at index.js:52122:15

This is thrown in an "else" situation of this global VM script:

Object.defineProperties(window.__ipc, {                                   
  postMessage: {                                                          
    value: (...args) => {                                                 
      if (window?.webkit?.messageHandlers?.external?.postMessage) {       
        return window.webkit.messageHandlers.external.postMessage(...args)
      }                                                                   
      if (window?.chrome?.webview?.postMessage) {                         
        return window.chrome.webview.postMessage(...args)                 
      }                                                                   
      throw new TypeError(                                                
        'Could not determine UserMessageHandler.postMessage in Window'    
      )                                                                   
    },                                                                    
    enumerable: true                                                      
  }                                                                       
}) 

The Android implementation makes postMessage available on window.external, so this should be the fix:

    if (window?.external?.postMessage) {                         
        return window.external.postMessage(...args)                 
      }

android / install.ps1 - Ensure libuv src copied to correct folders

As part of resolving android build for windows, I resolved an issue where libuv src wasn't copied to SOCKET_HOME in order to be available for Android NDK build.
This resulted in a silent drop out of ssc.exe during npm build.
I resolved the issue:
00e2e6d

The change has been reverted as part of a separate libuv issue, this single line can be undone without affecting windows build:
abade8b#diff-e9a96fb537f64b60e955f6d260d0d3c697cb45050752cf4d834833486b4d8530L88

-   Copy-Item -Path "$WORKING_BUILD_PATH\libuv\src" -Destination "$ASSET_PATH\uv\src" -Recurse -Force

iOS app icon & app store validation

image

Do I need to manually fix these every time I run ssc build --platform=ios or is there a setting in ssc.config that handles it?

edit: I'm using this as a workaround.

commit d6631891d2e0e305c7b4d29a5ee0b0c1945e0799
Author: Alec Larson <[email protected]>
Date:   Fri Dec 9 13:42:47 2022 -0500

    fix: use CFBundleIcons in iOS plist

diff --git a/src/cli/templates.hh b/src/cli/templates.hh
index faabbbe..89ff587 100644
--- a/src/cli/templates.hh
+++ b/src/cli/templates.hh
@@ -895,8 +895,20 @@ constexpr auto gXCodePlist = R"XML(<?xml version="1.0" encoding="UTF-8"?>
 <dict>
   <key>CFBundleIdentifier</key>
   <string>{{bundle_identifier}}</string>
-  <key>CFBundleIconFile</key>
-  <string>ui/icon.png</string>
+  <key>XCAssetsFolderPath</key>
+  <string>ui/Assets.xcassets</string>
+  <key>CFBundleIcons</key>
+  <dict>
+    <key>CFBundlePrimaryIcon</key>
+    <dict>
+      <key>CFBundleIconFiles</key>
+      <array>
+        <string>AppIcon</string>
+      </array>
+      <key>UIPrerenderedIcon</key>
+      <false/>
+    </dict>
+  </dict>
   <key>NSAppTransportSecurity</key>
   <dict>
     <key>NSAllowsArbitraryLoads</key>

Then I'm copying my Assets.xcassets folder into the dist/<platform>/ui folder in my build script.

Code Assessment/Cleanup

The current state of the code is functional, but slowing down development on adding new features. We'll need some dedicated time to do some cleanup and code restructuring. The primary goals are to:

  1. Prevent issues like 78e2e2e from coming up that are easy to miss but difficult to find.
  2. Make it easier for community contributors to help out.
  3. Generalize how things are done.

This issue will track and discuss specifics.

Config versioning

We can add versioning to the config, so when people update the version of ssc and run it, we can know the version of config.ini is not compatible with the version of ssc and throw a readable error and maybe even provide an update script.

I think we can add an ungrouped field like this:

[config]
revision: 20220130

[build]
# ...

[meta]
# ...

Then,

  • if ssc wants a newer version of config, we print something like Current version of config is outdated and not compatible with your version of 'ssc'
  • if ssc version is too old, we print Current version of config is newer than installed 'ssc' can use. Please update your version of 'ssc'.

Automatic updates

We can add something like ssc config update to automatically update the config version

"Migrations" should provide the change for every field in such manner

// from non-versioned to 20220130

// [] build -> [build] script; identity
// [] env -> [build] env; identity
// [] executable -> x
// [] flags -> [build] flags; identity
// [] headless -> [build] headless; identity
// [] name -> [build] name; identity
// [] input -> [build] input; identity
// [] output -> [build] output; identity
// [] bundle_identifier -> [meta] bundle_identifier; identity
// [] copyright -> [meta] copyright; identity
// [] description -> [meta] description; identity
// [] file_limit -> [meta] file_limit; identity
// [] lang -> [meta] lang; identity
// [] maintainer -> [meta] maintainer; identity
// [] title -> [meta] title; identity
// [] version -> [meta] version; identity

Left value is a current value which we should move or delete
Right value is a new field and optional mapping function when we need to change a value (the mapping function isstd::identity by default)

This way we can create a chain of transformations for each config field for any old version to the latest version

Comments above reflect the recent changes made in #124

Improve testing experience

Currently we use https://github.com/socketsupply/ssc-test to add test script to the document's <head>

We can implement feature in the Socket Runtime, so developers don't have to add an extra dependancy. Also test files don't need to be in the production bundle. That should be implemented as a condition in the build script.

ssc build --test=test.js should:

  • copy test files to the <builddir>/<os>/<name>-dev.app (that's the task for a build script, nothing to do here)
  • inject the test.js script on ssc build -r --test=test.js or ssc run --test=test.js
  • ...or warn when there's no test.js file in the resources directory

One thing I'm not sure is whether should a value for the --test option be mandatory (currently it's not)

OS dialog API

Things like the native open file dialog would be great.

Support ccache

For some reason when building with ccache the binary doesn't end up in the build folder.

install.ps1 / libuv build/config output behaviour

install.ps1 has been reverted as per:
abade8b

The now reverted change which removed $LIBUV_BUILD_TYPE from the Copy-Item commands was due to the fact that I observed libuv building directly to $WORKING_BUILD_PATH\libuv\build on two separate Windows systems.

I have done some investigation and can't see how the cmake --config switch does anything other than govern which config is used for build, it does not influence the output folder.

https://cmake.org/cmake/help/latest/manual/cmake.1.html:

--config <cfg>
For multi-configuration tools, choose configuration <cfg>.

Testing has been performed against libuv 1.44.2 (tag) and 1.x (branch).

cmake --version
cmake version 3.13.4

clang --version
clang version 15.0.1
Target: x86_64-pc-windows-msvc
Thread model: posix
InstalledDir: C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Tools\Llvm\x64\bin

Note that with the now reverted code, install.ps1 operates as follows on my workstation:

ok - built libuv
Copy-Item : Cannot find path 'D:\code\socket\socket\build\libuv\build\Release\uv_a.lib' because it does not exist.
At D:\code\socket\socket\bin\install.ps1:49 char:3
+   Copy-Item "$WORKING_BUILD_PATH\libuv\build\$LIBUV_BUILD_TYPE\uv_a.l ...
+   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (D:\code\socket\...elease\uv_a.lib:String) [Copy-Item], ItemNotFoundException
    + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.CopyItemCommand

@trevnorris Can your versions and we can start comparing from there...

Automatically generate nightly builds

Some other requirements for having a stable nightly build:

  • Guidelines on how dev branches land in master to prevent breaking changes.
  • The website will need a place to host the nightly build.
  • Will need an official list of supported platforms and architectures.
  • Check that all tests pass before doing the nightly build.

Path to the executable is wrong on Linux

Example: https://github.com/socketsupply/serverless-studio/actions/runs/3274841554/jobs/5388902283

• compiled native binary +51939ms
[20](https://github.com/socketsupply/serverless-studio/actions/runs/3274841554/jobs/5388902283#step:9:21)
• 'ssc compile' is deprecated, use 'ssc build' instead +0ms
[21](https://github.com/socketsupply/serverless-studio/actions/runs/3274841554/jobs/5388902283#step:9:22)
• executable not found: /home/runner/work/serverless-studio/serverless-studio/./dist/linux/serverless-studio-dev_v0.3.71-_amd64/opt/Serverless-Studio-dev/serverless-studio-dev +0ms
[22](https://github.com/socketsupply/serverless-studio/actions/runs/3274841554/jobs/5388902283#step:9:23)
Error: Process completed with exit code 1.

Bundle instead of building an application

Instead of building a binary using an application's files, bundle them and pass that to ssc to be run. The a few advantages of doing it this way are:

  1. Building apps takes far less time
  2. Users are not required to install build tools (especially painful to do on Windows)
  3. Native addon development becomes possible by allowing the user to build a shared library then having the app include that using a JS API.

self update

add ssc update command to cli to update the ssc command

Implement CoreWebView2CustomSchemeRegistration for custom IPC schema

@heapwolf started work implementing CoreWebView2CustomSchemeRegistration for custom schemas in e77bbc5, but was removed in 35467ec to get around compilation errors.

Investigate bringing back CoreWebView2CustomSchemeRegistration so Windows can use ipc:// instead of http:// to intercept requests.

Example implementation: https://github.com/MicrosoftEdge/WebView2Samples/blob/main/SampleApps/WebView2APISample/AppWindow.cpp#LL1208C28-L1208C71

How to securely display a webview of external URL?

I see in your documentation about security "NEVER try to build a browser. NEVER evaluate arbitrary code.".

But is there a way to securely display a webview that loads an external website? My use case is currently just for displaying a checkout process for purchasing the app. But I can also imagine wanting to display website previews, etc.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.