StilauGamer
StilauGamer
Explore posts from servers
CDCloudflare Developers
Created by StilauGamer on 2/23/2025 in #general-help
Nested OIDC Claims???
Hey, So I am currently integrating my OIDC Provider into CF Zero Trust, but having issues with Nested OIDC claims.. I have this:
{
"email": "[email protected]",
"oidc_fields": {
"email": "[email protected]",
"accesses": {
"git-access": true
}
}
}
{
"email": "[email protected]",
"oidc_fields": {
"email": "[email protected]",
"accesses": {
"git-access": true
}
}
}
I want to make a Zero Trust Policy that allows access if the git-access is set to true, This is a pretty simple and test subject to what I actually want to do, but I need to know if its possible to work with nested claims..
3 replies
CDCloudflare Developers
Created by StilauGamer on 2/9/2025 in #general-help
Run Database through Zero Trust Tunnels
Hey, I was wondering how I can run a database through Cloudflare Zero Trust Tunnels πŸ˜… I've tried setting up to go to a TCP connection internally, db.example.com -> tcp://10.10.10.11:3306, but its not working.. It works if I try setting it up to go to https://10.10.10.11:443 for example, but not if I go to a TCP port like MariaDB. I get a weird socketopt error inside Datagrip, and just a "can't connect" in HeidiSQL. Anyone have any ideas?
3 replies
CC#
Created by StilauGamer on 1/30/2025 in #help
βœ… Groups & Clients in SignalR not taking requests.
I have 2 Hub tasks, 1. Connect 2. Send I save all connections that are being sent to connect with a game code, and store them in a group.. Like this:
public async Task Connect(string gameId)
{
await Groups.AddToGroupAsync(Context.ConnectionId, gameId)
}

public async Task Send(string gameId)
{
await Clients.Group(gameId).SendAsync("Testing");
}
public async Task Connect(string gameId)
{
await Groups.AddToGroupAsync(Context.ConnectionId, gameId)
}

public async Task Send(string gameId)
{
await Clients.Group(gameId).SendAsync("Testing");
}
I tried doing this, but it simply won't work? I also tried storing away a client connection ID and not go through groups, but I am not able to send any requests down to my Javascript part? It works if I use Clients.All.SendAsync(), but nothing else..?
15 replies
CC#
Created by StilauGamer on 11/22/2024 in #help
xUnit and Dependency Injection
Hello, I have not ran too many unit testings up through my time, but recently getting into a bit more of a heavy program where unit testing will be crucial. The project is dependent on Dependency Injection, and I was wondering if its possible to run unit tests on methods from DI services...? I have currently a Core Project and a Test Project, and I want to be able to get a DI service from the Core Project and run a test with it inside the test project. How would I be able to do this? Any help is appreciated, Thanks 😊
6 replies
CC#
Created by StilauGamer on 11/13/2024 in #help
Inject IDbContextFactory or DbContext directly?
Hey, I was working with a project earlier that I've made and I saw I was injecting the db context with IDbContextFactory<ApplicationDbContext> and then manually creating a db context every time I was going to use it. I was doing this: await using var dbContext = await _dbContextFactory.CreateDbContextAsync(); I read somewhere that you should just inject the DB Context directly, and let the DI handle the lifetime of it, but I was unsure if this was bs or not? Does anyone have any tips surrounding this? Thanks πŸ™‚
15 replies
NNuxt
Created by StilauGamer on 5/14/2024 in #❓・help
Cookie not set when returning from OAuth callback
Hey! So I currently have a API route as the callback when the discord oauth has been completed and is callbacking to my website.. In there I make a JWT token that I want to set as a cookie, and that works. But the issue I am having is that when I redirect to the main page /.
setCookie(event, "jwt-token", token, {
httpOnly: true,
secure: true,
sameSite: "strict",
maxAge: timeBeforeExpiration,
});

res.writeHead(302, {
Location: `/`,
});
res.end();
setCookie(event, "jwt-token", token, {
httpOnly: true,
secure: true,
sameSite: "strict",
maxAge: timeBeforeExpiration,
});

res.writeHead(302, {
Location: `/`,
});
res.end();
So when I come back to the / page I need to refresh for the vue component to detect the cookie. I simply do:
const cookie = useCookie("jwt-token");
console.log("cookie: " + cookie.value);
const cookie = useCookie("jwt-token");
console.log("cookie: " + cookie.value);
And this returns undefined when I first get redirected from the callback. But gives me the cookie when I refresh? How can I fix this?
2 replies
NNuxt
Created by StilauGamer on 5/10/2024 in #❓・help
Localstorage + JWT
Hello! So I am currently working on a project where I want to store a JWT Token in localstorage... But I am having some issues finding out how I can use it? Is there a better way than storing it in the localstorage, and how would I store it in the localstorage?
15 replies
CC#
Created by StilauGamer on 4/18/2024 in #help
gRPC with HTTP/2.0
No description
1 replies
CC#
Created by StilauGamer on 1/21/2024 in #help
Is Inside a polygon algorithm..
No description
3 replies
CC#
Created by StilauGamer on 11/23/2023 in #help
UniTask VS Task
Idk if this is the correct place to ask, but I am modding for some Unity games and one of the frameworks there is utilizing UniTask. What does that benefit from using Task? Should I use UniTask when working with shit I want to await, etc? I cannot find any good examples on the differences between them, so I figured I'd ask here lol
1 replies
CC#
Created by StilauGamer on 11/20/2023 in #help
Discord.Net + MagicOnion, heheh
Hey! So I am working on a discord bot that I want to intergrate into a server using websockets, I found MagicOnion and wanted to test it out, but I can only find documentation to how to use it with Asp.Net. Does anyone know how I would implement it with Discord.Net? I have a test service that uses the ServiceBase<> and IService<> This is my current code for my bot:
public static Task Main()
=> new Program().MainAsync();

private async Task MainAsync()
{
try
{
var client = new DiscordSocketClient();

using var host = Host.CreateDefaultBuilder()
.ConfigureServices((_, services) =>
{
services
.AddSingleton(client)
.AddSingleton(i => new InteractionService(i.GetRequiredService<DiscordSocketClient>()))
.AddSingleton<InteractionHandler>()
.AddTransient<ITestService, TestService>();

services.AddGrpc();
services.AddMagicOnion();
}
).Build();

await RunAsync(host);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}

private async Task RunAsync(IHost host)
{
using var serviceScope = host.Services.CreateScope();
var serviceProvider = serviceScope.ServiceProvider;


var commands = serviceProvider
.GetRequiredService<InteractionService>();
var client = serviceProvider
.GetRequiredService<DiscordSocketClient>();

await serviceProvider
.GetRequiredService<InteractionHandler>()
.InitializeAsync();


await client.LoginAsync(TokenType.Bot, Token);
await client.StartAsync();

client.Log += Log;
client.Ready += async () =>
{
await commands.RegisterCommandsToGuildAsync(DiscordGuildId);
};

await Task.Delay(-1);
}
public static Task Main()
=> new Program().MainAsync();

private async Task MainAsync()
{
try
{
var client = new DiscordSocketClient();

using var host = Host.CreateDefaultBuilder()
.ConfigureServices((_, services) =>
{
services
.AddSingleton(client)
.AddSingleton(i => new InteractionService(i.GetRequiredService<DiscordSocketClient>()))
.AddSingleton<InteractionHandler>()
.AddTransient<ITestService, TestService>();

services.AddGrpc();
services.AddMagicOnion();
}
).Build();

await RunAsync(host);
}
catch (Exception ex)
{
Console.WriteLine(ex);
}
}

private async Task RunAsync(IHost host)
{
using var serviceScope = host.Services.CreateScope();
var serviceProvider = serviceScope.ServiceProvider;


var commands = serviceProvider
.GetRequiredService<InteractionService>();
var client = serviceProvider
.GetRequiredService<DiscordSocketClient>();

await serviceProvider
.GetRequiredService<InteractionHandler>()
.InitializeAsync();


await client.LoginAsync(TokenType.Bot, Token);
await client.StartAsync();

client.Log += Log;
client.Ready += async () =>
{
await commands.RegisterCommandsToGuildAsync(DiscordGuildId);
};

await Task.Delay(-1);
}
137 replies
CCoder.com
Created by StilauGamer on 8/31/2022 in #help
Problems with installing
root@StilauVPS:/etc/coder.d# /usr/bin/coder server
Coder v0.8.10+01a06e1 - Remote development on your infrastucture
Using built-in PostgreSQL (/root/.config/coderv2/postgres)
The built-in PostgreSQL cannot run as the root user. Create a non-root user and run again!
Run 'coder server --help' for usage.
root@StilauVPS:/etc/coder.d# /usr/bin/coder server
Coder v0.8.10+01a06e1 - Remote development on your infrastucture
Using built-in PostgreSQL (/root/.config/coderv2/postgres)
The built-in PostgreSQL cannot run as the root user. Create a non-root user and run again!
Run 'coder server --help' for usage.
119 replies