text stringlengths 14 100k | source stringclasses 1
value | repo stringclasses 810
values | language stringclasses 13
values |
|---|---|---|---|
<|fim_suffix|>nd")]
NotFound,
#[error("permission denied")]
PermissionDenied,
#[error(transparent)]
Database(#[from] sqlx::Error),
}
<|fim_prefix|>use thiserror::Error;
#[derive(Debug, Error)]
p<|fim_middle|>ub enum IdentityError {
#[error("identity record not fou<|endoftext|> | fim | BloopAI/vibe-kanban | rust |
pub mod auth_sessions;
pub mod hosts;
pub mod identity_errors;
pub mod relay_browser_sessions;
pub mod users;
use sqlx::{PgPool, postgres::PgPoolOptions};
pub async fn create_pool(database_url: &str) -> Result<PgPool, sqlx::Error> {
PgPoolOptions::new()
.max_connections(10)
.connect(database_url)
... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use chrono::{DateTime, Utc};
use sqlx::PgPool;
use uuid::Uuid;
#[derive(Debug, Clone, sqlx::FromRow)]
pub struct RelayBrowserSession {
pub id: Uuid,
pub host_id: Uuid,
pub user_id: Uuid,
pub auth_session_id: Uuid,
pub created_at: DateTime<Utc>,
pub last_used_at: Option<DateTime<Ut... | fim | BloopAI/vibe-kanban | rust |
use api_types::User;
use sqlx::{PgPool, query_as};
use uuid::Uuid;
use super::identity_errors::IdentityError;
pub struct UserRepository<'a> {
pool: &'a PgPool,
}
impl<'a> UserRepository<'a> {
pub fn new(pool: &'a PgPool) -> Self {
Self { pool }
}
pub async fn fetch_user(&self, user_id: Uuid)... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>od db;
pub mod relay_registry;
pub mod routes;
pub mod state;
<|fim_prefix|>pub mod auth;
pub mod <|fim_middle|>config;
pub m<|endoftext|> | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>//! In-memory relay registry for active tunnel connections.
//!
//! Each connected local server gets an `ActiveRelay` entry. The remote
//! relay proxy looks up relays by host ID and opens yamux streams over
//! the existing control connection. One-time auth codes are DB-backed.
use std::{collections::Ha... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|> .create(host_id, ctx.user.id, ctx.session_id)
.await
{
Ok(session) => session,
Err(error) => {
tracing::warn!(?error, "failed to create relay browser session");
return Err((
StatusCode::INTERNAL_SERVER_ERROR,
"Failed... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>nnel disconnected; keeping host online because a newer channel is active"
);
}
tracing::debug!(%host_id, "Relay control channel disconnected");
}
<|fim_prefix|>//! WebSocket control channel handler for local server connections.
use std::sync::Arc;
use axum::{
Extension,
extract::... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>mod auth_code;
pub mod connect;
pub mod path_routes;
use axum::{
Router,
http::{HeaderName, StatusCode},
middleware,
response::IntoResponse,
routing::{any, get, post},
};
use serde::Serialize;
use tower_http::{
cors<|fim_suffix|>xpose_headers(ExposeHeaders::list([
... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>//! Relay path handlers: auth code exchange and proxy.
use axum::{
extract::{Path, Request, State},
http::StatusCode,
response::{IntoResponse, Response},
};
use relay_tunnel_core::server::proxy_request_over_control;
use uuid::Uuid;
use super::super::{
auth::request_context_from_auth_sess... | fim | BloopAI/vibe-kanban | rust |
use std::sync::Arc;
use sqlx::PgPool;
use super::{auth::JwtService, config::RelayServerConfig, relay_registry::RelayRegistry};
#[derive(Clone)]
pub struct RelayAppState {
pub pool: PgPool,
pub config: RelayServerConfig,
pub jwt: Arc<JwtService>,
pub relay_registry: RelayRegistry,
}
impl RelayAppStat... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use std::{convert::Infallible, net::SocketAddr};
use anyhow::Context as _;
use axum::body::Body;
use futures_util::StreamExt;
use http::StatusCode;
use hyper::{
Request, Response, body::Incoming, client::conn::http1 as client_http1,
server::conn::http1 as server_http1, service::service_fn, upgrad... | fim | BloopAI/vibe-kanban | rust |
use std::time::Duration;
use tokio_yamux::Config as YamuxConfig;
pub mod client;
pub mod server;
pub mod tls;
/// Shared yamux configuration for both client and server sides of the relay tunnel.
///
/// Increases the stream window size and write timeout over the defaults (256 KB / 10s)
/// to handle large HTTP respo... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use std::{future::Future, sync::Arc};
use axum::{
body::Body,
extract::{Request, ws::WebSocket},
http::{StatusCode, Uri},
response::{IntoResponse, Response},
};
use futures_util::StreamExt;
use hyper::{client::conn::http1 as client_http1, upgrade};
use hyper_util::rt::TokioIo;
use tokio::... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use tokio_tungstenite::Connector;
/// Build TLS connector for th<|fim_suffix|>tAllCerts {
fn verify_server_cert(
&self,
_end_entity: &rustls::pki_types::CertificateDer<'_>,
_intermediates: &[rustls::pki_types::CertificateDer<'_>],
_server_name: &rustls::pki_types::Serv... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|> Clone)]
pub struct RemoteSession {
pub host_id: Uuid,
pub id: Uuid,
}
#[derive(Debug, Clone)]
pub struct RelayAuthState {
pub remote_session: RemoteSession,
pub signing_session_id: Uuid,
}
#[derive(Debug, Clone, Serialize, Deserialize, TS)]
pub struct StartSpake2EnrollmentRequest {
... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>aChannel>,
pending_http: &Arc<Mutex<PendingHttpMap>>,
pending_ws_open: &Arc<Mutex<PendingWsOpenMap>>,
) {
match cmd {
ClientCommand::Http(req) => {
tracing::trace!(
bytes = req.data.len(),
"[client-peer] writing HTTP request to data channel"
... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use thiserror::Error;
#[derive(Debug, Error)]
pub enum WebRtcError {
#[error("WebRTC operation failed: {0}")]
WebRtc(#[from] webrtc::Error),
#[error("ICE gathering timed out")]
IceGatheringTimedOut,
#[error("ICE gatherin<|fim_suffix|>nnelSendQueueClosed,
#[error(transparent)]
... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|> // Process first message.
for chunk in &chunks1[..chunks1.len() - 1] {
assert!(defrag.process(chunk).is_none());
}
let r1 = defrag
.process(chunks1.last().unwrap())
.expect("msg1 complete");
assert_eq!(r1, msg1);
// Process sec... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>WebRtcError::SessionNotFound {
session_id: candidate.session_id.clone(),
})?
};
let init = RTCIceCandidateInit {
candidate: candidate.candidate,
sdp_mid: candidate.sdp_mid,
sdp_mline_index: candidate.sdp_m_line_index.... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>etwork_types(vec![NetworkType::Udp4]);
webrtc::api::APIBuilder::new()
.with_setting_engine(se)
.build()
}
<|fim_prefix|>pub mod client;
pub mod error;
pub mod fragment;
pub mo<|fim_middle|>d host;
pub mod peer;
pub mod proxy;
pub mod signaling;
pub use client::{WebRtcClient, WebRtcCli... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use std::{collections::HashMap, net::SocketAddr, sync::Arc, time::Duration};
use bytes::Bytes;
use tokio::sync::{Mutex, mpsc};
use tokio_util::sync::CancellationToken;
use uuid::Uuid;
use webrtc::{
data_channel::{RTCDataChannel, data_channel_message::DataChannelMessage as RtcDcMessage},
ice_trans... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use std::{
collections::HashMap,
pin::Pin,
task::{Context, Poll, ready},
};
use base64::Engine as _;
use futures_util::{Sink, Stream};
use relay_protocol::{RelayTransportMessage, RelayWsFrame, RelayWsMessageType};
use serde::{Deserialize, Serialize};
use tokio::sync::mpsc;
use tokio_tungsteni... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>on_id: String,
}
/// A trickle ICE candidate exchanged between peers.
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct IceCandidate {
/// The ICE candidate string (SDP format).
pub candidate: String,
/// SDP media stream identification tag.
#[serde(default, skip_serializing_if =... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>//! WebSocket frame codec with Ed25519 signing and verification.
//!
//! [`WsFrameSigner::encode`] serializes and signs outgoing frames.
//! [`WsFrameVerifier::decode`] deserializes and verifies incoming frames.
//!
//! Each frame is bound to the signing session, request nonce, a monotonic
//! sequence nu... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>eric stream.
mod crypto;
mod signed;
pub use signed::{
SignedAxumSocket, SignedTungsteniteSocket, signed_axum_websocket, signed_tungstenite_websocket,
};
<|fim_prefix|>//! Signed relay <|fim_middle|>WebSocket channel wrappers.
//!
//! - [`crypto`] — [`WsFrameSigner::encode`] signs frames, [`WsFrameVe... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>//! Signed WebSocket channel.
//!
//! [`SignedWebSocket`] wraps a WS stream, encoding outgoing frames via
//! [`WsFrameSigner::encode`] and decoding incoming frames via
//! [`WsFrameVerifier::decode`].
use std::{
marker::PhantomData,
pin::Pin,
task::{Context, Poll},
};
use axum::extract::ws:... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>)
.expect("failed to build analytics HTTP client");
Self { config, client }
}
pub fn track(&self, user_id: Uuid, event_name: &str, properties: Value) {
let endpoint = format!(
"{}/capture/",
self.config.posthog_api_endpoint.trim_end_matches('/')... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use std::{net::SocketAddr, sync::Arc};
use anyhow::{Context, bail};
use secrecy::ExposeSecret;
use tracing::instrument;
use crate::{
AppState,
analytics::{AnalyticsConfig, AnalyticsService},
attachments::cleanup::spawn_cleanup_task,
auth::{
GitHubOAuthProvider, GoogleOAuthProvide... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>y::count_by_blob_id(pool, blob_id).await {
Ok(0) => {
if let Ok(Some(blob)) = BlobRepository::delete(pool, blob_id).await {
if let Err(e) = azure.delete_blob(&blob.blob_path).await {
warn!(blob_path = %blob.blob_path, error = %e, "Fai... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|> thumbnail;
<|fim_prefix|>pub(crate) mod cleanup<|fim_middle|>;
pub mod<|endoftext|> | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>DecodeError(String),
#[error("image encode error: {0}")]
EncodeError(String),
}
pub struct ThumbnailService;
impl ThumbnailService {
/// Generate a thumbnail from image bytes.
/// Returns None for non-image MIME types.
pub fn generate(
data: &[u8],
mime_type: Option<&... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use uuid::Uuid;
use crate::auth::RequestContext;
#[derive(Debug, Clone, Copy)]
pub enum AuditAction {
AuthLogin,
AuthLogout,
AuthTokenRefresh,
AuthTokenReuseDetected,
AuthSessionRevoked,
MemberInvite,
MemberAcceptInvite,
MemberRevokeInvite,
MemberRemove,
MemberRo... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>ncrypted_provider_tokens: Option<&str>,
) -> Result<IdentityUser, HandoffError> {
let account_repo = OAuthAccountRepository::new(&self.pool);
let user_repo = UserRepository::new(&self.pool);
let org_repo = OrganizationRepository::new(&self.pool);
let email = ensure_ema... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>se_secret())
.map_err(|_| JwtError::InvalidSecret)?;
let mut hasher = Sha256::new();
hasher.update(&secret_bytes);
Ok(hasher.finalize().into())
}
}
<|fim_prefix|>use std::{collections::HashSet, sync::Arc};
use aes_gcm::{
Aes256Gcm, Key, Nonce,
aead::{Aead,... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>_err(|error| {
tracing::error!(?error, "failed to persist local auth refresh token");
LocalAuthError::Internal
})?;
if let Some(analytics) = state.analytics() {
analytics.track(
user.id,
"$identify",
serde_json::json!({ "emai... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>::UNAUTHORIZED.into_response());
}
if session.inactivity_duration(Utc::now()) > MAX_SESSION_INACTIVITY_DURATION {
warn!(
"session `{}` expired due to inactivity; revoking",
session.id
);
if let Err(error) = session_repo.revoke(session.id).await {
... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>mod handoff;
mod jwt;
mod local;
mod middleware;
mod oauth_token_validator;
mod provider;
pub(crate) use handoff::{CallbackResult, HandoffError, OAuthHandoffService};
pub(cr<|fim_suffix|>n};
pub(crate) use oauth_token_validator::{OAuthTokenValidationError, OAuthTokenValidator};
pub(crate) use provider::{... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>date(
&self,
provider: &str,
user_id: Uuid,
session_id: Uuid,
) -> Result<(), OAuthTokenValidationError> {
match self.verify_inner(provider, user_id, session_id).await {
Ok(()) => Ok(()),
Err(err) => {
match &err {
... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>}
}
status => {
if status.is_server_error() && attempt <= max_retries {
tokio::time::sleep(tokio::time::Duration::from_secs(
RETRY_INTERVAL_SECONDS,
))
.a... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>unwrap();
assert_eq!(
signed_token,
"sv=2022-11-02&sp=r&sr=b&se=1970-01-08T00%3A00%3A00Z&sig=VRZjVZ1c%2FLz7IXCp17Sdx9%2BR9JDrnJdzE3NW56DMjNs%3D"
);
let parsed = url::form_urlencoded::parse(signed_token.as_bytes());
assert!(parsed.clone().any(|(k, v... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>#[cfg(feature = "<|fim_suffix|> #[cfg(feature = "vk-billing")]
{
self.provider.is_some()
}
#[cfg(not(feature = "vk-billing"))]
{
false
}
}
/// Returns the billing provider if configured.
#[cfg(feature = "vk-billing")]
pub fn... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use std::{env, fs, path::Path};
use api_types::{
Attachment, AttachmentUrlResponse, AttachmentWithBlob, Blob, CreateIss<|fim_suffix|>dit manually.\n\n");
// Generate type declarations for all Electric types
output.push_str("// Electric row types\n");
let type_decls = vec![
serde_... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>e: &str) -> Result<Vec<String>, ConfigError> {
let mut names = Vec::new();
for raw in value.split(',') {
let name = raw.trim();
if name.is_empty() {
continue;
}
if !is_valid_identifier(name) {
return Err(ConfigError::InvalidVar("ELECTRIC_PUB... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|> AS "width?",
b.height AS "height?"
FROM attachments a
INNER JOIN blobs b ON b.id = a.blob_id
WHERE a.comment_id = $1
ORDER BY a.created_at ASC
"#,
comment_id
)
.fetch_all(pool... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>pub use api_types::AuthSession;
use chrono::Duration;
use sqlx::{PgPool, query_as};
use thiserror::Error;
use uuid::<|fim_suffix|>oken_id?",
refresh_token_issued_at AS "refresh_token_issued_at?",
previous_refresh_token_id AS "previous_refresh_token_id?",
... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>ery_scalar!(
r#"
SELECT p.organization_id
FROM blobs b
INNER JOIN projects p ON p.id = b.project_id
WHERE b.id = $1
"#,
blob_id
)
.fetch_optional(pool)
.await?;
Ok(record)
}
}
<|fim_pre... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use api_types::{NotificationPayload, NotificationType};
use chrono::{DateTime, Utc};
use sqlx::{PgPool, Postgres, pool::PoolConnection};
use uuid::Uuid;
use crate::digest::DigestUser;
#[derive(Debug, Clone)]
pub struct NotificationDigestRow {
pub id: Uuid,
pub notification_type: NotificationType... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use std::collections::HashSet;
use sqlx::PgPool;
#[derive(Debug)]
struct PublicationTable {
schema_name: String,
table_name: String,
}
#[derive(Debug, Hash, PartialEq, Eq)]
struct PublicationTableRef {
pubname: String,
schema_name: String,
table_name: String,
}
pub(crate) async fn ... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|> WHERE omm.organization_id = $1
"#,
organization_id
)
.fetch_all(pool)
.await?;
Ok(users)
}
}
<|fim_prefix|>use api_types::{
AttachmentWithBlob, Issue, IssueAssignee, IssuePriority, Project, ProjectStatus, User,
};
use chrono::{DateT... | fim | BloopAI/vibe-kanban | rust |
use chrono::{DateTime, Utc};
use sqlx::{FromRow, PgPool};
use thiserror::Error;
use uuid::Uuid;
#[derive(Debug, Error)]
pub enum GitHubAppDbError {
#[error("database error: {0}")]
Database(#[from] sqlx::Error),
#[error("installation not found")]
NotFound,
#[error("pending installation not found or ... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|> CASE
WHEN h.owner_user_id = $1 THEN 'owner'
ELSE 'member'
END AS "access_role!"
FROM hosts h
LEFT JOIN organization_member_metadata om
ON om.organization_id = h.shared_with_organization_id
... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use thiserror::Error;
#[derive(Debug, Error)]
pub enum IdentityError {
<|fim_suffix|><|fim_middle|>#[error("identity record not found")]
NotFound,
#[error("permission denied: admin access required")]
PermissionDenied,
#[error("invitation error: {0}")]
InvitationError(String),
... | fim | BloopAI/vibe-kanban | rust |
pub use api_types::InvitationStatus;
use api_types::MemberRole;
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
use sqlx::PgPool;
use uuid::Uuid;
use super::{
identity_errors::IdentityError,
organization_members::{add_member, assert_admin},
organizations::{Organization, OrganizationReposi... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use api_types::{DeleteResponse, IssueAssignee, MutationResponse};
use chrono::{DateTime, Utc};
use sqlx::PgPool;
use thiserror::Error;
use uuid::Uuid;
use super::get_txid;
#[derive(Debug, Error)]
pub enum IssueAssigneeError {
#[error("database error: {0}")]
Database(#[from] sqlx::Error),
}
pub ... | fim | BloopAI/vibe-kanban | rust |
use api_types::{DeleteResponse, IssueCommentReaction, MutationResponse};
use chrono::{DateTime, Utc};
use sqlx::PgPool;
use thiserror::Error;
use uuid::Uuid;
use super::get_txid;
#[derive(Debug, Error)]
pub enum IssueCommentReactionError {
#[error("database error: {0}")]
Database(#[from] sqlx::Error),
}
pub ... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use api_types::{DeleteResponse, IssueComment, MutationResponse};
use chrono::{DateTime, Utc};
use sqlx::PgPool;
use thiserror::Error;
use uuid::Uuid;
use super::get_txid;
#[derive(Debug, Error)]
pub enum IssueCommentError {
#[error("database error: {0}")]
Database(#[from] sqlx::Error),
}
pub st... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>d",
user_id AS "user_id!: Uuid"
"#,
id,
issue_id,
user_id
)
.fetch_one(&mut *tx)
.await?;
let txid = get_txid(&mut *tx).await?;
tx.commit().await?;
Ok(MutationResponse { data, txid })
}
... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>t<MutationResponse<IssueRelationship>, IssueRelationshipError> {
let id = id.unwrap_or_else(Uuid::new_v4);
let mut tx = super::begin_tx(pool).await?;
let data = sqlx::query_as!(
IssueRelationship,
r#"
INSERT INTO issue_relationships (id, issue_id... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use api_types::{DeleteResponse, IssueTag, MutationResponse};
use sqlx::PgPool;
use thiserror::Error;
use uuid::Uuid;
use super::get_txid;
#[derive(Debug, Error)]
pub enum IssueTagError {
#[error("database error: {0}")]
Database(#[from] sqlx::Error),
}
pub struct IssueTagRepository;
impl IssueT... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use api_types::{
DeleteResponse, Issue, IssuePriority, IssueSortField, ListIssuesResponse, MutationResponse,
PullRequestStatus, SearchIssuesRequest, SortDirection,
};
use chrono::{DateTime, Utc};
use serde_json::Value;
use sqlx::{Executor, PgConnection, PgPool, Postgres};
use thiserror::Error;
use... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>pub mod attachments;
pub mod auth;
pub mod blobs;
pub mod digest;
pub mod electric_publications;
pub mod export;
pub mod github_app;
pub mod hosts;
pub mod identity_errors;
pub mod invitations;
pub mod issue_assignees;
pub mod issue_comment_reactions;
pub mod issue_comments;
pub mod issue_followers;
pub m... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|> }
pub async fn delete<'e, E>(executor: E, id: Uuid) -> Result<(), NotificationError>
where
E: Executor<'e, Database = Postgres>,
{
sqlx::query!("DELETE FROM notifications WHERE id = $1", id)
.execute(executor)
.await?;
Ok(())
}
}
<|fim_p... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use std::str::FromStr;
use chrono::{DateTime, Utc};
use sqlx::PgPool;
use thiserror::Error;
use uuid::Uuid;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum AuthorizationStatus {
Pending,
Authorized,
Redeemed,
Error,
Expired,
}
impl AuthorizationStatus {
pub fn as_str(&self... | fim | BloopAI/vibe-kanban | rust |
use chrono::{DateTime, Utc};
use sqlx::PgPool;
use thiserror::Error;
use uuid::Uuid;
#[derive(Debug, Error)]
pub enum OAuthAccountError {
#[error(transparent)]
Database(#[from] sqlx::Error),
}
#[derive(Debug, Clone, sqlx::FromRow)]
pub struct OAuthAccount {
pub id: Uuid,
pub user_id: Uuid,
pub pro... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use api_types::MemberRole;
use sqlx::{Executor, PgPool, Postgres};
use uuid::Uuid;
use super::identity_errors::IdentityError;
pub(super) async fn add_member<'a, E>(
executor: E,
organization_id: Uuid,
user_id: Uuid,
role: MemberRole,
) -> Result<(), sqlx::Error>
where
E: Executor<'a,... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>ole,
r#"
SELECT
o.id AS "id!: Uuid",
o.name AS "name!",
o.slug AS "slug!",
o.is_personal AS "is_personal!",
o.issue_prefix AS "issue_prefix!",
o.created_at A... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|> hash AS "hash!",
created_at AS "created_at!: DateTime<Utc>",
expires_at AS "expires_at!: DateTime<Utc>"
FROM pending_uploads
WHERE id = $1
"#,
id
)
.fetch_optional(pool)
.await?;
... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>_on_issue_assigned!"
FROM project_notification_preferences
WHERE project_id = $1 AND user_id = $2
"#,
project_id,
user_id
)
.fetch_optional(executor)
.await?;
Ok(record)
}
}
<|fim_prefix|>use serde::{Deseriali... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use api_types::{DeleteResponse, MutationResponse, ProjectStatus};
use chrono::{DateTime, Utc};
use sqlx::{Executor, PgPool, Postgres};
use thiserror::Error;
use uuid::Uuid;
use super::get_txid;
/// Default statuses that are created for each new project (name, color, sort_order, hidden)
/// Colors are in... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>o_string()))?;
ProjectStatusRepository::create_default_statuses(&mut *tx, project.id)
.await
.map_err(|e| ProjectError::DefaultStatusesFailed(e.to_string()))?;
let txid = get_txid(&mut *tx).await?;
tx.commit().await?;
Ok(MutationResponse {
... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use api_types::PullRequestIssue;
use sqlx::{Executor, PgPool, Postgres};
use thiserror::Error;
use uuid::Uuid;
use super::pull_requests::PullRequestRepository;
#[derive(Debug, Error)]
pub enum PullRequestIssueError {
#[error("database error: {0}")]
Database(#[from] sqlx::Error),
#[error("pul... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use api_types::{PullRequest, PullRequestStatus};
use chrono::{DateTime, Utc};
use sqlx::{Executor, Postgres};
use thiserror::Error;
use uuid::Uuid;
#[derive(Debug, Error)]
pub enum PullRequestError {
#[error("database error: {0}")]
Database(#[from] sqlx::Error),
}
pub struct PullRequestRepositor... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|> WHERE id = $1 AND deleted_at IS NULL
"#,
id
)
.fetch_optional(self.pool)
.await?
.ok_or(ReviewError::NotFound)
}
/// Count reviews from an IP address since a given timestamp.
/// Used for rate limiting.
pub async fn count_since(
... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use api_types::{DeleteResponse, MutationResponse, Tag};
use sqlx::{Executor, PgPool, Postgres};
use thiserror::Error;
use uuid::Uuid;
use super::get_txid;
#[derive(Debug, Error)]
pub enum TagError {
#[error("database error: {0}")]
Database(#[from] sqlx::Error),
}
/// Default tags that are creat... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>/// Validates that a string is in HSL format: "H S% L%"
/// where H is 0-360, S is 0-100%, L is 0-100%
pub fn is_valid_hsl_color(color: &str) -> bool {
let parts: Vec<&str> = color.split(' ').collect();
if parts.len() != 3 {
return false;
}
// Parse hue (0-360)
let Some(h) = p... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>st_name = EXCLUDED.last_name,
username = EXCLUDED.username
RETURNING
id AS "id!: Uuid",
email AS "email!",
first_name AS "first_name?",
last_name AS "last_name?",
username AS "username?",
... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|> WHERE id = $11
RETURNING
id AS "id!: Uuid",
project_id AS "project_id!: Uuid",
owner_user_id AS "owner_user_id!: Uuid",
issue_id AS "issue_id: Uuid",
local_workspa... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use std::collections::{HashMap, VecDeque};
use api_types::{NotificationPayload, NotificationType};
use uuid::Uuid;
use crate::{
db::digest::NotificationDigestRow,
mail::{DIGEST_PREVIEW_COUNT, DigestNotificationItem},
};
pub fn build_digest_items(
rows: &[NotificationDigestRow],
base_url... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>ion_ids).await?;
Ok(1)
}
fn digest_window(
now: DateTime<Utc>,
window: Duration,
) -> Result<(DateTime<Utc>, DateTime<Utc>), DigestError> {
let lookback =
chrono::Duration::from_std(window).map_err(|_| DigestError::InvalidWindowDuration)?;
let window_end = now;
let window... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use std::{panic::AssertUnwindSafe, sync::Arc, time::Duration};
use chrono::{DateTime, Days, Timelike, Utc};
use futures::FutureExt;
use sqlx::PgPool;
use tokio::task::JoinHandle;
use tracing::{error, info, warn};
use crate::{
db::digest::{DigestRepository, DigestRunLock},
digest::run_email_diges... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use base64::{Engine as _, engine::general_purpose::STANDARD as BASE64_STANDARD};
use jsonwebtoken::{Algorithm, EncodingKey, Header, encode};
use secrecy::{ExposeSecret, SecretString};
use serde::Serialize;
use thiserror::Error;
/// JWT generator for GitHub App authentication.
/// GitHub Apps authenticate... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>mod jwt;
mod pr_review;
mod service;
mod webhook;
pub use jwt::GitHubAppJwt;
pub use pr_revi<|fim_suffix|>ls, PrRef, Repository};
pub use webhook::verify_webhook_signature;
<|fim_middle|>ew::{PrReviewError, PrReviewParams, PrReviewService};
pub use service::{GitHubAppService, InstallationInfo, PrDetai<|e... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>//! PR Review service for webhook-triggered code reviews.
use std::{fs::File, path::Path};
use flate2::{Compression, write::GzEncoder};
use reqwest::Client;
use sqlx::PgPool;
use tar::Builder;
use thiserror::Error;
use tracing::{debug, error, info};
use uuid::Uuid;
use super::service::{GitHubAppError, ... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use reqwest::Client;
use secrecy::SecretString;
use serde::{Deserialize, Serialize};
use tempfile::TempDir;
use thiserror::Error;
use tokio::process::Command;
use tracing::{debug, info, warn};
use super::jwt::{GitHubAppJwt, JwtError};
use crate::config::GitHubAppConfig;
const USER_AGENT: &str = "VibeKan... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>nalize().into_bytes();
// Constant-time comparison to prevent timing attacks
computed_signature[..].ct_eq(&expected_signature).into()
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_valid_signature() {
let secret = b"test-secret";
let payload = b"test payloa... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|> = fmt::layer()
.json()
.with_target(false)
.with_span_events(FmtSpan::CLOSE)
.boxed();
let otel_layer = init_otel_layer();
let otel_enabled = otel_layer.is_some();
tracing_subscriber::registry()
.with(tracing_subscriber::EnvFilter::new(env_filter))
... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>eview ready");
}
Err(err) => {
tracing::error!(error = ?err, "Loops request error for review ready");
}
}
}
async fn send_review_failed(&self, email: &str, pr_name: &str, review_id: &str) {
if cfg!(debug_assertions) {
... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use remote::{
BillingService, SentrySource, Server, config::RemoteServerConfig, init_tracing,
sentry_init_once,
};
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Install rustls crypto provider before any TLS operations
rustls::crypto::aws_lc_rs::default_provider()
.inst... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>pub(c<|fim_suffix|>d version;
<|fim_middle|>rate) mo<|endoftext|> | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use axum::{
body::Body,
http::{Request, header::HeaderValue},
middleware::Next,
response::Response,
};
pub(crate) async fn add_version_headers(reques<|fim_suffix|>ders_mut().insert(
"X-Server-Version",
HeaderValue::from_static(env!("CARGO_PKG_VERSION")),
);
respon... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>//! Mutation definition builder for type-safe route and metadata generation.
//!
//! This module provides `MutationBuilder`, a builder that:
//! - Generates axum routers for CRUD mutation routes
//! - Captures type information for TypeScript generation
//! - Uses `HasJsonPayload` to ensure handler si<|fim... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use std::collections::HashSet;
use api_types::{Issue, NotificationPayload, NotificationType};
use sqlx::PgPool;
use uuid::Uuid;
use crate::db::{
issue_assignees::IssueAssigneeRepository, issue_followers::IssueFollowerRepository,
notifications::NotificationRepository, organization_members::is_mem... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use std::time::Duration;
use aws_credential_types::Credentials;
use aws_sdk_s3::{
Client,
<|fim_suffix|> Presign(String),
#[error("upload error: {0}")]
Upload(String),
}
impl R2Service {
pub fn new(config: &R2Config) -> Self {
let credentials = Credentials::new(
... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>
state.pool(),
None,
payload.project_id,
blob_path.clone(),
thumbnail_blob_path,
payload.filename.clone(),
payload.content_type.clone(),
payload.size_bytes,
payload.hash.clone(),
width,
... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|>de::NOT_FOUND, "Organization not found")
}
}
}
fn augment_billing_status(status: BillingStatusResponse, can_manage_billing: bool) -> Value {
let mut value = serde_json::to_value(status).unwrap_or_else(|_| {
json!({
"status": BillingStatus::Free,
"billing_en... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use std::collections::HashMap;
use axum::{
Router,
body::Body,
http::{HeaderMap, HeaderValue, StatusCode, header},
response::{IntoResponse, Response},
};
use futures::TryStreamExt;
use secrecy::ExposeSecret;
use serde::Deserialize;
use tracing::error;
use uuid::Uuid;
use crate::{AppState... | fim | BloopAI/vibe-kanban | rust |
<|fim_suffix|> }
IdentityError::Database(_) => {
ErrorResponse::new(StatusCode::INTERNAL_SERVER_ERROR, "Database error")
}
other => {
tracing::warn!(?other, "unexpected membership error");
ErrorResponse::new(StatusCode::FORBIDDEN, forbidden_message)
}... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use std::{
collections::{HashMap, HashSet},
io::{Cursor, Write},
};
use api_types::ExportRequest;
use axum::{
Json, Router,
body::Body,
extract::{Extension, State},
http::{StatusCode, header},
response::{IntoResponse, Response},
routing::post,
};
use chrono::Utc;
use traci... | fim | BloopAI/vibe-kanban | rust |
<|fim_prefix|>use axum::{
Json, Router,
body::Bytes,
extract::{Path, Query, State},
http::{HeaderMap, StatusCode},
response::{IntoResponse, Redirect, Response},
routing::{delete, get, patch, post},
};
use chrono::{Duration, Utc};
use secrecy::ExposeSecret;
use serde::{Deserialize, Serialize};
us... | fim | BloopAI/vibe-kanban | rust |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.