Skip to content

Commit

Permalink
renamed; app now working
Browse files Browse the repository at this point in the history
  • Loading branch information
cool-ant committed Sep 19, 2024
1 parent 5a316ee commit 7c2701f
Show file tree
Hide file tree
Showing 85 changed files with 57 additions and 5,495 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#[crate::service(name = "webmail", dispatch = false, psibase_mod = "crate")]
#[crate::service(name = "chainmail", dispatch = false, psibase_mod = "crate")]
#[allow(non_snake_case, unused_variables)]
mod service {
use crate::{http::HttpRequest, AccountNumber, Hex};
Expand Down
2 changes: 1 addition & 1 deletion rust/psibase/src/services/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
pub mod accounts;
pub mod auth_delegate;
pub mod auth_sig;
pub mod chainmail;
pub mod common_api;
pub mod cpu_limit;
pub mod events;
Expand All @@ -18,4 +19,3 @@ pub mod setcode;
pub mod sites;
pub mod tokens;
pub mod transact;
pub mod webmail;
2 changes: 1 addition & 1 deletion services/user/Branding/ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const App = () => {
const init = async () => {
await supervisor.onLoaded();
supervisor.preLoadPlugins([{ service: "branding" }]);
await getNetworkName();
setTimeout(getNetworkName, 1500);
};

useEffect(() => {
Expand Down

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

Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ homepage = "https://psibase.io"
publish = false

[package]
name = "webmail_package"
name = "chainmail_package"

[profile.release]
codegen-units = 1
Expand All @@ -21,13 +21,13 @@ strip = true
lto = true

[package.metadata.psibase]
package-name = "Webmail"
package-name = "Chainmail"
description = "Basic email app"
services = ["webmail"]
services = ["chainmail"]

[lib]
crate-type = ["rlib"]

[dependencies]
webmail = { path = "service" }
chainmail = { path = "service" }
plugin = { path = "plugin" }
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

namespace UserService
{
class Webmail : public psibase::Service<Webmail>
class Chainmail : public psibase::Service<Chainmail>
{
public:
using Tables = psibase::ServiceTables<InitTable, psibase::WebContentTable>;

static constexpr auto service = psibase::AccountNumber("webmail");
static constexpr auto service = psibase::AccountNumber("chainmail");

Webmail(psio::shared_view_ptr<psibase::Action> action);
Chainmail(psio::shared_view_ptr<psibase::Action> action);

void init();

Expand All @@ -38,18 +38,18 @@ namespace UserService
};

// clang-format off
PSIO_REFLECT(Webmail,
PSIO_REFLECT(Chainmail,
method(init),
method(send, receiver, subject, body),
method(serveSys, request),
method(storeSys, path, contentType, content)
);
PSIBASE_REFLECT_EVENTS(Webmail);
PSIBASE_REFLECT_HISTORY_EVENTS(Webmail,
PSIBASE_REFLECT_EVENTS(Chainmail);
PSIBASE_REFLECT_HISTORY_EVENTS(Chainmail,
method(sent, sender, receiver, subject, body),
);
PSIBASE_REFLECT_UI_EVENTS(Webmail);
PSIBASE_REFLECT_MERKLE_EVENTS(Webmail);
PSIBASE_REFLECT_UI_EVENTS(Chainmail);
PSIBASE_REFLECT_MERKLE_EVENTS(Chainmail);
// clang-format on

} // namespace UserService
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ publish = false
[dependencies]
wit-bindgen-rt = { version = "0.28.0", features = ["bitflags"] }
psibase = { path = "../../../../rust/psibase/" }
webmail = { path = "../service/" }
chainmail = { path = "../service/" }

[lib]
crate-type = ["cdylib"]

[package.metadata.component]
package = "webmail:plugin"
package = "chainmail:plugin"

[package.metadata.component.target]
world = "impl"
Expand All @@ -26,4 +26,4 @@ world = "impl"
"transact:plugin" = { path = "../../../system/Transact/plugin/wit/world.wit" }

[dev-dependencies]
webmail_package = { path = ".." }
chainmail_package = { path = ".." }
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
#[allow(warnings)]
mod bindings;

use bindings::exports::webmail::plugin::api::{Error, Guest as API};
use bindings::exports::chainmail::plugin::api::{Error, Guest as API};
use bindings::transact::plugin::intf as Transact;
use psibase::fracpack::Pack;
use psibase::services::webmail;
use psibase::services::chainmail;
use psibase::AccountNumber;

struct WebmailPlugin;
struct ChainmailPlugin;

impl API for WebmailPlugin {
impl API for ChainmailPlugin {
fn send(receiver: String, subject: String, body: String) -> Result<(), Error> {
Transact::add_action_to_transaction(
"send",
&webmail::action_structs::send {
&chainmail::action_structs::send {
receiver: AccountNumber::from(receiver.as_str()),
subject,
body,
Expand All @@ -24,4 +24,4 @@ impl API for WebmailPlugin {
}
}

bindings::export!(WebmailPlugin with_types_in bindings);
bindings::export!(ChainmailPlugin with_types_in bindings);
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webmail:plugin;
package chainmail:plugin;

world impl {
include host:common/imports;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package webmail:plugin;
package chainmail:plugin;

interface api {
use host:common/types.{error};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "webmail"
name = "chainmail"
version.workspace = true
rust-version.workspace = true
repository.workspace = true
Expand All @@ -8,7 +8,7 @@ edition.workspace = true
publish = false

[package.metadata.psibase]
server = "webmail"
server = "chainmail"
plugin = "plugin"

[dependencies]
Expand All @@ -17,4 +17,4 @@ async-graphql = "7.0.7"
serde = { version = "1.0.209", features = ["derive"] }

[dev-dependencies]
webmail_package = { path = ".." }
chainmail_package = { path = ".." }
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ fn serve_rest_api(request: &HttpRequest) -> Option<HttpReply> {
let mq = make_query(
request,
format!(
"SELECT * FROM \"history.webmail.sent\" {} ORDER BY ROWID",
"SELECT * FROM \"history.chainmail.sent\" {} ORDER BY ROWID",
where_clause
),
);
Expand Down
2 changes: 2 additions & 0 deletions services/user/Chainmail/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
pub use chainmail;
pub use plugin;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "webmail",
"name": "chainmail",
"private": true,
"version": "0.0.0",
"type": "module",
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ export const ComposeDialog = ({
const supervisor = await getSupervisor();
// TODO: Improve error detection. This promise resolves with success before the transaction is pushed.
await supervisor.functionCall({
service: "webmail",
service: "chainmail",
intf: "api",
method: "send",
params: [draft.to, draft.subject, draft.body],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ const psibase = (service: string, isServing?: boolean) => {
export default defineConfig(({ command }) => ({
plugins: [
react(),
psibase("webmail", command === "serve"),
psibase("chainmail", command === "serve"),
wasm(),
topLevelAwait(),
tsconfigPaths(),
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion services/user/Homepage/ui/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const App = () => {
<AppItem
name="Chain mail"
description="Send mail between accounts."
service="webmail"
service="chainmail"
/>
<AppItem
name="Doc"
Expand Down
2 changes: 1 addition & 1 deletion services/user/Homepage/ui/src/pages/Dashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const App = () => {
<AppItem
name="Chain mail"
description="Send mail between accounts."
service="webmail"
service="chainmail"
/>
<AppItem
name="Doc"
Expand Down
Loading

0 comments on commit 7c2701f

Please sign in to comment.