Пример #1
0
 public EditCountCommand(
     string commandSource,
     IUser user,
     IList <string> arguments,
     ILogger logger,
     IFlagService flagService,
     IConfigurationProvider configurationProvider,
     IIrcClient client,
     ISession databaseSession,
     IUrlShorteningService urlShorteningService,
     IMediaWikiApiHelper apiHelper,
     IResponder responder) : base(
         commandSource,
         user,
         arguments,
         logger,
         flagService,
         configurationProvider,
         client)
 {
     this.databaseSession      = databaseSession;
     this.urlShorteningService = urlShorteningService;
     this.apiHelper            = apiHelper;
     this.responder            = responder;
 }
Пример #2
0
        public CategoryWatcherHelperService(
            ILinkerService linkerService,
            IUrlShorteningService urlShorteningService,
            ISession session,
            ILogger logger,
            ICommandParser commandParser,
            IMediaWikiApiHelper apiHelper,
            IResponder responder)
        {
            this.linkerService        = linkerService;
            this.urlShorteningService = urlShorteningService;
            this.session   = session;
            this.logger    = logger;
            this.apiHelper = apiHelper;
            this.responder = responder;

            lock (this.session)
            {
                this.watchedCategories = this.session.CreateCriteria <WatchedCategory>().List <WatchedCategory>();

                this.ignoredPages = this.session.CreateCriteria <IgnoredPage>()
                                    .List <IgnoredPage>()
                                    .Select(x => x.Title)
                                    .ToList();
            }

            logger.DebugFormat("Registering CategoryWatcher keys in CommandParser");
            foreach (var category in this.watchedCategories)
            {
                commandParser.RegisterCommand(category.Keyword, typeof(ForceUpdateCommand));
            }
        }
Пример #3
0
        public BlockMonitoringService(
            ILogger logger,
            ILinkerService linkerService,
            IUrlShorteningService urlShorteningService,
            ISession globalSession,
            IMediaWikiApiHelper apiHelper,
            BotConfiguration botConfiguration,
            IWebServiceClient webServiceClient,
            IIrcClient client,
            ITrollMonitoringService trollMonitoringService)
        {
            this.logger                 = logger;
            this.linkerService          = linkerService;
            this.urlShorteningService   = urlShorteningService;
            this.globalSession          = globalSession;
            this.apiHelper              = apiHelper;
            this.botConfiguration       = botConfiguration;
            this.webServiceClient       = webServiceClient;
            this.client                 = client;
            this.trollMonitoringService = trollMonitoringService;

            this.trollMonitoringService.BlockMonitoringService = this;

            // initialise the store
            foreach (var blockMonitor in globalSession.CreateCriteria <BlockMonitor>().List <BlockMonitor>())
            {
                if (!this.monitors.ContainsKey(blockMonitor.MonitorChannel))
                {
                    this.monitors[blockMonitor.MonitorChannel] = new HashSet <string>();
                }

                this.monitors[blockMonitor.MonitorChannel].Add(blockMonitor.ReportChannel);
            }
        }
Пример #4
0
 public IndexModel(
     IUrlShorteningService shorteningService,
     ITinyUrlRepository repository)
 {
     this.shorteningService = shorteningService;
     this.repository        = repository;
 }
Пример #5
0
 public DraftStatusCommand(
     string commandSource,
     IUser user,
     IList <string> arguments,
     ILogger logger,
     IFlagService flagService,
     IConfigurationProvider configurationProvider,
     IIrcClient client,
     AfcCategoryConfiguration categoryConfiguration,
     IMediaWikiApiHelper apiHelper,
     ISession databaseSession,
     IDraftStatusService draftStatusService, ILinkerService linkerService, IUrlShorteningService urlShorteningService) : base(
         commandSource,
         user,
         arguments,
         logger,
         flagService,
         configurationProvider,
         client)
 {
     this.categoryConfiguration = categoryConfiguration;
     this.apiHelper             = apiHelper;
     this.databaseSession       = databaseSession;
     this.draftStatusService    = draftStatusService;
     this.linkerService         = linkerService;
     this.urlShorteningService  = urlShorteningService;
 }
Пример #6
0
 public SlackService(ILogger <SlackService> logger, IOptionsMonitor <AppSettings> appSettings,
                     IGoogleSearchService googleSearchService, IUrlShorteningService urlShorteningService)
 {
     _logger               = logger;
     _appSettings          = appSettings.CurrentValue;
     _googleSearchService  = googleSearchService;
     _urlShorteningService = urlShorteningService;
 }
Пример #7
0
 public RedirectMiddleware(RequestDelegate next
                           , IUrlShorteningService urlShortService
                           , IAppSettings appSettings
                           , ILogger <RedirectMiddleware> logger)
 {
     _next              = next;
     _urlShortService   = urlShortService;
     _settings          = appSettings;
     _logger            = logger;
     _urlAnalyticsQueue = CloudStorageAccount
                          .Parse(_settings.DbConnectionString)
                          ?.CreateCloudQueueClient()
                          ?.GetQueueReference(UrlAnalyticsQueueName);
 }
Пример #8
0
 public ShortenUrlCommand(
     string commandSource,
     IUser user,
     IList <string> arguments,
     ILogger logger,
     IFlagService flagService,
     IConfigurationProvider configurationProvider,
     IIrcClient client,
     IUrlShorteningService urlShorteningService) : base(
         commandSource,
         user,
         arguments,
         logger,
         flagService,
         configurationProvider,
         client)
 {
     this.urlShorteningService = urlShorteningService;
 }
        public WikimediaUrlShorteningService(
            ILogger logger,
            IShortUrlCacheService shortUrlCacheService,
            IMediaWikiApiTypedFactory apiTypedFactory,
            BotConfiguration configuration,
            IUrlShorteningService secondaryShortener,
            WikimediaUrlShortnerConfiguration shortenerConfiguration)
            : base(logger, shortUrlCacheService)
        {
            this.logger             = logger;
            this.apiTypedFactory    = apiTypedFactory;
            this.secondaryShortener = (UrlShorteningServiceBase)secondaryShortener;
            this.allowedDomains     = shortenerConfiguration.AllowedDomains.Select(x => new Regex(x)).ToList();

            this.mediaWikiConfig = new MediaWikiConfiguration(
                shortenerConfiguration.MediaWikiApiEndpoint,
                configuration.UserAgent,
                shortenerConfiguration.MediaWikiApiUsername,
                shortenerConfiguration.MediaWikiApiPassword);
        }
 public UrlShortnerController(IUrlShorteningService urlShorteningService)
 {
     UrlShorteningService = urlShorteningService;
 }
Пример #11
0
        /// <summary>
        /// Initialises a new instance of the <see cref="WatcherController"/> class.
        /// </summary>
        /// <param name="messageService">
        /// The message Service.
        /// </param>
        /// <param name="urlShorteningService">
        /// The url Shortening Service.
        /// </param>
        /// <param name="watchedCategoryRepository">
        /// The watched Category Repository.
        /// </param>
        /// <param name="mediaWikiSiteRepository">
        /// The media Wiki Site Repository.
        /// </param>
        /// <param name="ignoredPagesRepository">
        /// The ignored Pages Repository.
        /// </param>
        /// <param name="logger">
        /// The logger.
        /// </param>
        /// <param name="ircClient">
        /// The IRC Client.
        /// </param>
        /// <param name="legacyDatabase">
        /// The legacy Database.
        /// </param>
        protected WatcherController(
            IMessageService messageService, 
            IUrlShorteningService urlShorteningService, 
            IWatchedCategoryRepository watchedCategoryRepository, 
            IMediaWikiSiteRepository mediaWikiSiteRepository,
            IIgnoredPagesRepository ignoredPagesRepository,
            ILogger logger,
            IIrcClient ircClient,
            ILegacyDatabase legacyDatabase)
        {
            this.messageService = messageService;
            this.urlShorteningService = urlShorteningService;
            this.watchers = new Dictionary<string, CategoryWatcher>();
            this.logger = logger;
            this.ircClient = ircClient;

            foreach (WatchedCategory item in watchedCategoryRepository.Get())
            {
                var categoryWatcher = new CategoryWatcher(
                    item,
                    mediaWikiSiteRepository,
                    ignoredPagesRepository,
                    logger.CreateChildLogger("CategoryWatcher[" + item.Keyword + "]"));
                this.watchers.Add(item.Keyword, categoryWatcher);
                categoryWatcher.CategoryHasItemsEvent += this.CategoryHasItemsEvent;
            }

            this.legacyDatabase = legacyDatabase;
        }
Пример #12
0
 public HomeController(IUrlShorteningService urlShortService, IAppSettings settings)
 {
     _urlShortService = urlShortService;
     _settings        = settings;
 }
Пример #13
0
 public ShortenUrlBuilder(ILogger <ShortenUrlBuilder> logger, IUrlShorteningService urlShorteningService)
 {
     _logger = logger;
     _urlShorteningService = urlShorteningService;
 }
Пример #14
0
 public CreateRequestHandler(ISqzToDbContext context, IUrlShorteningService urlShorteningService, IMapper mapper)
 {
     _context = context;
     _urlShorteningService = urlShorteningService;
     _mapper = mapper;
 }
Пример #15
0
 public ShortUrlController(IUrlShorteningService service)
 {
     _service = service;
 }
Пример #16
0
 /// <summary>
 /// Initialises a new instance of the <see cref="CommandServiceHelper"/> class.
 /// </summary>
 /// <param name="client">
 /// The client.
 /// </param>
 /// <param name="messageService">
 /// The message service.
 /// </param>
 /// <param name="urlShorteningService">
 /// The url Shortening Service.
 /// </param>
 /// <param name="configurationHelper">
 /// The configuration Helper.
 /// </param>
 /// <param name="mediaWikiSiteRepository">
 /// The media Wiki Site Repository.
 /// </param>
 /// <param name="interwikiPrefixRepository">
 /// The inter-wiki Prefix Repository.
 /// </param>
 /// <param name="channelRepository">
 /// The channel Repository.
 /// </param>
 public CommandServiceHelper(
     IIrcClient client, 
     IMessageService messageService, 
     IUrlShorteningService urlShorteningService, 
     IConfigurationHelper configurationHelper, 
     IMediaWikiSiteRepository mediaWikiSiteRepository, 
     IInterwikiPrefixRepository interwikiPrefixRepository, 
     IChannelRepository channelRepository)
 {
     this.client = client;
     this.messageService = messageService;
     this.urlShorteningService = urlShorteningService;
     this.configurationHelper = configurationHelper;
     this.mediaWikiSiteRepository = mediaWikiSiteRepository;
     this.interwikiPrefixRepository = interwikiPrefixRepository;
     this.channelRepository = channelRepository;
 }
Пример #17
0
 public UrlShorteningController(IUrlShorteningService urlShorteningService)
 {
     _urlShorteningService = urlShorteningService;
 }