Compare commits
No commits in common. "b7921ddb36c836ae2f89f79839c4792d6c8d6678" and "8fc179c40680791bba757a66bb8e445347795968" have entirely different histories.
b7921ddb36
...
8fc179c406
2 changed files with 1 additions and 35 deletions
10
README.md
10
README.md
|
|
@ -34,13 +34,3 @@ And enable WebAssembly:
|
||||||
```bash
|
```bash
|
||||||
dotnet workload install wasi-experimental
|
dotnet workload install wasi-experimental
|
||||||
```
|
```
|
||||||
|
|
||||||
```bash
|
|
||||||
bun server:up
|
|
||||||
```
|
|
||||||
|
|
||||||
Add the spacetime docker server to your cli
|
|
||||||
|
|
||||||
```bash
|
|
||||||
spacetime server add --url http://localhost:3000 massive
|
|
||||||
```
|
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,6 @@ public static partial class Module
|
||||||
[PrimaryKey]
|
[PrimaryKey]
|
||||||
public Identity Identity;
|
public Identity Identity;
|
||||||
public string? Name;
|
public string? Name;
|
||||||
public string? Color;
|
|
||||||
public bool Online;
|
public bool Online;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,30 +42,6 @@ public static partial class Module
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Reducer]
|
|
||||||
public static void SetColor(ReducerContext ctx, string color)
|
|
||||||
{
|
|
||||||
color = ValidateColor(color);
|
|
||||||
|
|
||||||
var user = ctx.Db.User.Identity.Find(ctx.Sender);
|
|
||||||
|
|
||||||
if (user is null)
|
|
||||||
{
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
user.Color = color;
|
|
||||||
ctx.Db.User.Identity.Update(user);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string ValidateColor(string color)
|
|
||||||
{
|
|
||||||
if (color[0] == '#' && color.Length != 4 || color.Length != 7)
|
|
||||||
{
|
|
||||||
throw new Exception("Invalid Hex color code");
|
|
||||||
}
|
|
||||||
return color;
|
|
||||||
}
|
|
||||||
|
|
||||||
[Reducer]
|
[Reducer]
|
||||||
public static void SendMessage(ReducerContext ctx, string text)
|
public static void SendMessage(ReducerContext ctx, string text)
|
||||||
{
|
{
|
||||||
|
|
@ -138,3 +113,4 @@ public static partial class Module
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue