Module: appdb
Branch: master
Commit: 0f74052d3a7f447d79d17ef1fcedcdd243d2f0fd
URL: https://source.winehq.org/git/appdb.git/?a=commit;h=0f74052d3a7f447d79d17ef…
Author: Jeremy Newman <jnewman(a)codeweavers.com>
Date: Tue Sep 21 11:15:46 2021 -0500
remove appimage loader and load images from CDN
this should reduce load on the winehq webserver
---
appimage.php | 88 -----------------------------------------------
include/config.php.sample | 1 +
include/screenshot.php | 33 ++++--------------
3 files changed, 7 insertions(+), 115 deletions(-)
diff --git a/appimage.php b/appimage.php
deleted file mode 100644
index f4d1b58..0000000
--- a/appimage.php
+++ /dev/null
@@ -1,88 +0,0 @@
-<?php
-/**
- * Shows a thumbnail or a full size screenshot.
- *
- * Mandatory parameters:
- * - iId, image identifier
- *
- * Optional parameters:
- * - bThumbnail, "true" if we want to see a thumbnail, "false" otherwise
- * - sREQUEST_METHOD
- *
- * TODO:
- * - rename and document sREQUEST_METHOD
- * - replace iId with iScreenshotId
- */
-
-/**
- * parse all the date formats required by HTTP 1.1 into PHP time values
- */
-function pHttpDate($sDate) {
- $iDate = strtotime($sDate);
- if ($iDate != -1) return $iDate;
- /* the RFC also requires asctime() format... */
- $aTs = strptime($sDate,"%a %b %e %H:%M:%S %Y");
- $iDate = gmmktime($aTs[2],$aTs[1],$aTs[0],$aTs[4],$aTs[3],$aTs[5],0);
- return $iDate;
-}
-
-// application environment
-require("path.php");
-require(BASE."include/incl.php");
-require_once(BASE."include/screenshot.php");
-
-// an image doesn't have a link, so a cookie makes no sense
-header("Set-Cookie: ");
-header("Pragma: ");
-
-// is the user supposed to be viewing this image ?
-if(!$_SESSION['current']->canViewImage($aClean['iId']))
- util_show_error_page_and_exit("Insufficient privileges.");
-
-$oScreenshot = new Screenshot($aClean['iId']);
-$fImage = fopen(appdb_fullpath("data/screenshots/".$oScreenshot->sUrl), "rb");
-
-/* if we can open the image we should get its last modified time and read */
-/* a few bytes from its header information and close it */
-if($fImage)
-{
- $fstat_val = fstat($fImage);
- $iModTime = $fstat_val['mtime'];
- $sMagic = fread($fImage, 8); /* read 8 bytes from the header, that lets us idenfity the type of
- image without loading it */
- fclose($fImage); /* don't leave the fopened image open */
-}
-
-/* identify what kind of image this is, if we can't identify it */
-/* we should report that its a bad image */
-if (strcmp("\x89PNG\r\n\x1A\n", $sMagic)==0)
-{
- header("Content-Type: image/png");
-} else if (preg_match("^\xD8\xFF^", $sMagic)) {
- header("Content-Type: image/jpeg");
-} else {
- header("500 Bad image format");
- exit;
-}
-
-header("Cache-Control: public");
-header("Expires: ");
-
-/* if the browser is asking if the file was modified since a particular date */
-/* and the date is the same that the file was modified, then we can report */
-/* that the file wasn't modified, the browser can used the cached image */
-if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) &&
- $iModTime == pHttpDate($_SERVER['HTTP_IF_MODIFIED_SINCE']))
-{
- header("HTTP/1.0 304 Not Modified");
- exit;
-}
-
-header("Last-Modified: ".gmdate("D, d M Y H:i:s",$iModTime)." GMT");
-
-if(!$aClean['bThumbnail'])
- $oScreenshot->output_screenshot(false);
-else
- $oScreenshot->output_screenshot(true);
-
-?>
diff --git a/include/config.php.sample b/include/config.php.sample
index f75d6d8..8531dca 100644
--- a/include/config.php.sample
+++ b/include/config.php.sample
@@ -18,6 +18,7 @@ define("APPDB_OWNER","WineHQ"); // with what product/company is this AppDB relat
define("APPDB_OWNER_URL","https://www.winehq.org/"); // website of this product/company
define("APPDB_OWNER_EMAIL","appdb(a)winehq.org"); // e-mail of this product/company
define("APPDB_SENDER_EMAIL","appdb-noreply(a)winehq.org"); // The e-mail address which appears as the sender in mails sent by the AppDB
+define("APPDB_SCREENSHOT_URL","https://dl.winehq.org/winehq/appdb/"); // CDN URL of WineHQ appdb images, leave empty to use local
define("BUGZILLA_ROOT","https://bugs.winehq.org/"); // path to bugzilla
// Google reCaptcha Secret Key - required on account creations
diff --git a/include/screenshot.php b/include/screenshot.php
index a2f4da2..9102aa0 100644
--- a/include/screenshot.php
+++ b/include/screenshot.php
@@ -316,24 +316,6 @@ class screenshot
return array();
}
- function get_screenshot_height()
- {
- $this->load_image(false);
- return $this->oScreenshotImage->get_height();
- }
-
- function get_thumbnail_width()
- {
- $this->load_image(true);
- return $this->oThumbnailImage->get_width();
- }
-
- function get_thumbnail_height()
- {
- $this->load_image(true);
- return $this->oThumbnailImage->get_height();
- }
-
function objectGetSubmitterId()
{
return $this->iSubmitterId;
@@ -577,16 +559,13 @@ class screenshot
function get_thumbnail_img()
{
- $sImgUrl = apidb_fullurl("appimage.php").'?iId='.$this->iScreenshotId;
- $sImgWidth = $this->get_thumbnail_width();
- $sImgHeight = $this->get_thumbnail_height();
- if (!$sImgWidth)
- $sImgWidth = '130';
- if (!$sImgHeight)
- $sImgHeight = '100';
+ if (defined("APPDB_SCREENSHOT_URL") and !empty(APPDB_SCREENSHOT_URL))
+ $url = APPDB_SCREENSHOT_URL;
+ else
+ $url = APPDB_ROOT."data/";
$this->sDescription = preg_replace('/\n/', '', $this->sDescription);
- return "<div class=\"whq-shot\"><img src=\"{$sImgUrl}&bThumbnail=true\" style=\"width:{$sImgWidth}px;height:{$sImgHeight}px;\" ".
- "alt=\"{$this->sDescription}\" data-shot=\"{$sImgUrl}\"><i class=\"fa fa-search-plus\"></i></div>\n";
+ return "<div class=\"whq-shot\"><img src=\"".APPDB_SCREENSHOT_URL."thumbnails/".$this->iScreenshotId."\" style=\"width:130px;\" ".
+ "alt=\"{$this->sDescription}\" data-shot=\"".APPDB_SCREENSHOT_URL.$this->iScreenshotId."\"><i class=\"fa fa-search-plus\"></i></div>\n";
}
public static function objectGetItemsPerPage($sState = 'accepted')
Module: wine
Branch: master
Commit: 975d0632a19efd41338cb73a97f1b0bdbe7bc0cc
URL: https://source.winehq.org/git/wine.git/?a=commit;h=975d0632a19efd41338cb73a…
Author: Eduard Permyakov <epermyakov(a)codeweavers.com>
Date: Tue Sep 14 13:05:18 2021 +0300
dsound: Commit next audio chunk between play cursor and write cursor to playing.
This region of the audio buffer is forbidden to be written to by the
DirectSound specification. The documentation states: "The write cursor
is the point after which it is safe to write data into the buffer. The
block between the play cursor and the write cursor is already committed
to be played, and cannot be changed safely." However, some applications
still do this, which has lead to audio glitches only when using the Wine
DirectSound implementation. Experiments showed that the native DirctSound
implementation will still play the old audio the first time around when the
buffer region gets overwritten. Use an approach of copying the next forbidden
region into a "committed buffer" to add the same behavior to the Wine
implementation.
Out of performance considerations, only copy data to the committed buffer
when we detect that an overwrite is possible (i.e. the current mixing
region of the buffer gets locked).
Signed-off-by: Eduard Permyakov <epermyakov(a)codeweavers.com>
Signed-off-by: Andrew Eikum <aeikum(a)codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard(a)winehq.org>
---
dlls/dsound/buffer.c | 66 ++++++++++++++++++++++++++++++++++++++++++--
dlls/dsound/dsound_convert.c | 33 +++++++++++-----------
dlls/dsound/dsound_private.h | 11 ++++++--
dlls/dsound/mixer.c | 48 +++++++++++++++++++++++++-------
4 files changed, 125 insertions(+), 33 deletions(-)
Diff: https://source.winehq.org/git/wine.git/?a=commitdiff;h=975d0632a19efd41338c…